added support for mouse wheel on X.
This commit is contained in:
parent
4542bb9e40
commit
24f5b66cf3
|
@ -293,10 +293,23 @@ void CXWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
|
||||||
XSync(display, False);
|
XSync(display, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXWindowsSecondaryScreen::mouseWheel(SInt32)
|
void CXWindowsSecondaryScreen::mouseWheel(SInt32 delta)
|
||||||
{
|
{
|
||||||
|
// choose button depending on rotation direction
|
||||||
|
const unsigned int button = (delta >= 0) ? 4 : 5;
|
||||||
|
|
||||||
|
// now use absolute value of delta
|
||||||
|
if (delta < 0) {
|
||||||
|
delta = -delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
// send as many clicks as necessary
|
||||||
CDisplayLock display(this);
|
CDisplayLock display(this);
|
||||||
// FIXME
|
for (; delta >= 120; delta -= 120) {
|
||||||
|
XTestFakeButtonEvent(display, button, True, CurrentTime);
|
||||||
|
XTestFakeButtonEvent(display, button, False, CurrentTime);
|
||||||
|
}
|
||||||
|
XSync(display, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXWindowsSecondaryScreen::setClipboard(
|
void CXWindowsSecondaryScreen::setClipboard(
|
||||||
|
|
|
@ -124,6 +124,14 @@ void CXWindowsPrimaryScreen::run()
|
||||||
if (button != kButtonNone) {
|
if (button != kButtonNone) {
|
||||||
m_server->onMouseUp(button);
|
m_server->onMouseUp(button);
|
||||||
}
|
}
|
||||||
|
else if (xevent.xbutton.button == 4) {
|
||||||
|
// wheel forward (away from user)
|
||||||
|
m_server->onMouseWheel(120);
|
||||||
|
}
|
||||||
|
else if (xevent.xbutton.button == 5) {
|
||||||
|
// wheel backward (toward user)
|
||||||
|
m_server->onMouseWheel(-120);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue