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>
pull/2/head
Michele Calgaro 9 years ago
parent ab959b43ca
commit 1c64345fe4

@ -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();

@ -32,6 +32,7 @@
#include <tdepopupmenu.h>
#include "TECommon.h"
#include "TEScreen.h"
extern unsigned short vt100_graphics[32];
@ -142,6 +143,8 @@ public:
void setRim(int rim) { rimX=rim; rimY=rim; }
void setScreen(int num, TEScreen *scr) { screen_num = num & 0x01; screen = scr; }
public slots:
void setSelectionEnd();
@ -241,6 +244,10 @@ private:
int bX; // offset
int bY; // offset
// Required to handle mouse wheel events correctly in all cases
int screen_num; // Screen number (0 or 1)
TEScreen *screen; // Pointer to current screen. No ownership!!
int lines;
int columns;
int contentHeight;

@ -197,6 +197,7 @@ void TEmulation::setScreen(int n)
{
TEScreen *old = scr;
scr = screen[n&1];
gui->setScreen(n&1, scr);
if (scr != old)
old->setBusySelecting(false);
}

Loading…
Cancel
Save