diff --git a/doc/authors.html b/doc/authors.html index 18c420b7..f96dfcfd 100644 --- a/doc/authors.html +++ b/doc/authors.html @@ -24,6 +24,10 @@ Bertrand Landry Hetu Mac OS X port + + Tom Chadwick + PageUp/PageDown on X servers without mouse wheel support +

diff --git a/lib/platform/CXWindowsScreen.cpp b/lib/platform/CXWindowsScreen.cpp index 677bfc54..ad62425b 100644 --- a/lib/platform/CXWindowsScreen.cpp +++ b/lib/platform/CXWindowsScreen.cpp @@ -31,6 +31,7 @@ #else # include # include +# define XK_MISCELLANY # define XK_XKB_KEYS # include # if HAVE_X11_EXTENSIONS_XTEST_H @@ -583,6 +584,20 @@ CXWindowsScreen::fakeMouseWheel(SInt32 delta) const const unsigned int xButton = mapButtonToX(static_cast( (delta >= 0) ? -1 : -2)); if (xButton == 0) { + // If we get here, then the XServer does not support the scroll + // wheel buttons, so send PageUp/PageDown keystrokes instead. + // Patch by Tom Chadwick. + KeyCode keycode = 0; + if (delta >= 0) { + keycode = XKeysymToKeycode(m_display, XK_Page_Up); + } + else { + keycode = XKeysymToKeycode(m_display, XK_Page_Down); + } + if (keycode != 0) { + XTestFakeKeyEvent(m_display, keycode, True, CurrentTime); + XTestFakeKeyEvent(m_display, keycode, False, CurrentTime); + } return; }