summaryrefslogtreecommitdiffstats
path: root/konsole/konsole/TEWidget.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2016-03-14 17:47:44 +0100
committerMichele Calgaro <michele.calgaro@yahoo.it>2016-03-14 17:47:44 +0100
commit1c64345fe4da851982f69ebf6e92bc88cebbad46 (patch)
treed46116eaa873e5eb06cf97f665973cca07ec6905 /konsole/konsole/TEWidget.cpp
parentab959b43ca0d41104fc828e0a0b57cc8a6c5108c (diff)
downloadtdebase-1c64345fe4da851982f69ebf6e92bc88cebbad46.tar.gz
tdebase-1c64345fe4da851982f69ebf6e92bc88cebbad46.zip
Konsole : added support for mouse wheel events in the alternate screen. This allows scrolling within vim, less and similar applications.
This resolves bug 2597. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'konsole/konsole/TEWidget.cpp')
-rw-r--r--konsole/konsole/TEWidget.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/konsole/konsole/TEWidget.cpp b/konsole/konsole/TEWidget.cpp
index f151044fc..52cd1236b 100644
--- a/konsole/konsole/TEWidget.cpp
+++ b/konsole/konsole/TEWidget.cpp
@@ -340,6 +340,8 @@ TEWidget::TEWidget(TQWidget *parent, const char *name)
,font_h(1)
,font_w(1)
,font_a(1)
+,screen_num(0)
+,screen(NULL)
,lines(1)
,columns(1)
,contentHeight(1)
@@ -1694,7 +1696,22 @@ void TEWidget::wheelEvent( TQWheelEvent* ev )
return;
if ( mouse_marks )
- TQApplication::sendEvent(scrollbar, ev);
+ {
+ if (!screen || screen->hasScroll() || (scrollbar->maxValue() == 0 && screen_num == 0))
+ {
+ // Send event to scroll bar
+ TQApplication::sendEvent(scrollbar, ev);
+ }
+ else
+ {
+ // Terminal window can not be scrolled, so emulate key up/key down when mouse wheel is used
+ TQKeyEvent ke(TQEvent::KeyPress, ev->delta() > 0 ? TQt::Key_Up : TQt::Key_Down, 0, TQt::NoButton);
+ for (int i = 0; i < TQApplication::wheelScrollLines(); ++i)
+ {
+ emit keyPressedSignal(&ke);
+ }
+ }
+ }
else
{
TQPoint tL = contentsRect().topLeft();