[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Wheelmouse & konsole
From: Malte Starostik <malte () kde ! org>
Date: 2002-08-18 4:42:30
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
Hi,
on the topic of wheelmice... actually it's a new feature so I'll ask before.
The attached patch makes konsole pass wheel events on to the terminal app
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*
-Malte
[" " (text/x-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);
}
[Attachment #6 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic