From kde-core-devel Sun Aug 18 04:42:30 2002 From: Malte Starostik Date: Sun, 18 Aug 2002 04:42:30 +0000 To: kde-core-devel Subject: Wheelmouse & konsole X-MARC-Message: https://marc.info/?l=kde-core-devel&m=102964591723934 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-03=_1YyX924GuB84lKM" --Boundary-03=_1YyX924GuB84lKM Content-Type: multipart/mixed; boundary="Boundary-01=_vYyX9cDEmoSMdyz" Content-Transfer-Encoding: 7bit Content-Description: signed data Content-Disposition: inline --Boundary-01=_vYyX9cDEmoSMdyz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Description: body text Content-Disposition: inline Hi, on the topic of wheelmice... actually it's a new feature so I'll ask before= =2E=20 The attached patch makes konsole pass wheel events on to the terminal app=20 when in mouse mode. This enables e.g. wheel scrolling in vim. It *could* also be seen as a fix to make konsole more xterm-compatible *g* =2DMalte --Boundary-01=_vYyX9cDEmoSMdyz Content-Type: text/x-diff; charset="us-ascii"; name=" " Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="konsole-wheel.diff" Index: TEWidget.cpp =================================================================== RCS file: /home/kde/kdebase/konsole/konsole/TEWidget.cpp,v retrieving revision 1.163 diff -u -3 -d -p -r1.163 TEWidget.cpp --- TEWidget.cpp 2002/08/08 21:41:12 1.163 +++ TEWidget.cpp 2002/08/18 04:31:45 @@ -1145,6 +1145,18 @@ void TEWidget::mouseDoubleClickEvent(QMo 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; Index: TEWidget.h =================================================================== RCS file: /home/kde/kdebase/konsole/konsole/TEWidget.h,v retrieving revision 1.59 diff -u -3 -d -p -r1.59 TEWidget.h --- TEWidget.h 2002/08/08 21:41:12 1.59 +++ TEWidget.h 2002/08/18 04:31:46 @@ -143,6 +143,7 @@ protected: void mousePressEvent( QMouseEvent* ); void mouseReleaseEvent( QMouseEvent* ); void mouseMoveEvent( QMouseEvent* ); + void wheelEvent( QWheelEvent* ); void focusInEvent( QFocusEvent * ); void focusOutEvent( QFocusEvent * ); Index: TEmuVt102.cpp =================================================================== RCS file: /home/kde/kdebase/konsole/konsole/TEmuVt102.cpp,v retrieving revision 1.90 diff -u -3 -d -p -r1.90 TEmuVt102.cpp --- TEmuVt102.cpp 2002/07/26 21:20:55 1.90 +++ TEmuVt102.cpp 2002/08/18 04:31:47 @@ -786,6 +786,7 @@ void TEmuVt102::reportAnswerBack() void TEmuVt102::onMouse( int cb, int cx, int cy ) { char tmp[20]; if (!connected) return; + if (cb >= 4) cb += 0x40; sprintf(tmp,"\033[M%c%c%c",cb+040,cx+040,cy+040); sendString(tmp); } --Boundary-01=_vYyX9cDEmoSMdyz-- --Boundary-03=_1YyX924GuB84lKM Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQA9XyY1VDF3RdLzx4cRAjQcAJ9rObete8LoYb14+aH0ahCOGMsQ5QCePhLx hVFI4HAXuHNd/D12JGFlNRI= =N0w7 -----END PGP SIGNATURE----- --Boundary-03=_1YyX924GuB84lKM--