From 1aed851ed8e21d65e89ca7e95a64dd2e546b67ae Mon Sep 17 00:00:00 2001 From: Malte Starostik Date: Sun, 18 Aug 2002 20:42:16 +0000 Subject: [PATCH] Pass wheel events to the app in mouse mode. svn path=/trunk/kdebase/konsole/; revision=172583 --- konsole/TEWidget.cpp | 12 ++++++++++++ konsole/TEWidget.h | 1 + konsole/TEmuVt102.cpp | 3 +++ 3 files changed, 16 insertions(+) diff --git a/konsole/TEWidget.cpp b/konsole/TEWidget.cpp index fcb3ad74..e422bbc4 100644 --- a/konsole/TEWidget.cpp +++ b/konsole/TEWidget.cpp @@ -1145,6 +1145,18 @@ void TEWidget::mouseDoubleClickEvent(QMouseEvent* ev) QTimer::singleShot(QApplication::doubleClickInterval(),this,SLOT(tripleClickTimeout())); } +void TEWidget::wheelEvent( QWheelEvent* ev ) +{ + if (!mouse_marks) + { + QPoint tL = contentsRect().topLeft(); + int tLx = tL.x(); + int tLy = tL.y(); + QPoint pos = QPoint((ev->x()-tLx-bX)/font_w,(ev->y()-tLy-bY)/font_h); + emit mouseSignal( ev->delta() > 0 ? 4 : 5, pos.x() + 1, pos.y() + 1 ); + } +} + void TEWidget::tripleClickTimeout() { possibleTripleClick=false; diff --git a/konsole/TEWidget.h b/konsole/TEWidget.h index 9f9138f4..8dcb04fd 100644 --- a/konsole/TEWidget.h +++ b/konsole/TEWidget.h @@ -143,6 +143,7 @@ protected: void mousePressEvent( QMouseEvent* ); void mouseReleaseEvent( QMouseEvent* ); void mouseMoveEvent( QMouseEvent* ); + void wheelEvent( QWheelEvent* ); void focusInEvent( QFocusEvent * ); void focusOutEvent( QFocusEvent * ); diff --git a/konsole/TEmuVt102.cpp b/konsole/TEmuVt102.cpp index fe003836..16d84f1d 100644 --- a/konsole/TEmuVt102.cpp +++ b/konsole/TEmuVt102.cpp @@ -786,6 +786,9 @@ void TEmuVt102::reportAnswerBack() void TEmuVt102::onMouse( int cb, int cx, int cy ) { char tmp[20]; if (!connected) return; + // normal buttons are passed as 0x20 + button, + // mouse wheel (buttons 4,5) as 0x60 + button + if (cb >= 4) cb += 0x40; sprintf(tmp,"\033[M%c%c%c",cb+040,cx+040,cy+040); sendString(tmp); }