Applied patch from Tom Chadwick to synthesize PageUp/PageDown on
X servers that don't support the mouse wheel.
This commit is contained in:
parent
3ae1b916ea
commit
1d0436b31c
|
@ -24,6 +24,10 @@
|
||||||
<td><a href="mailto:bertrand@landryhetu.com">Bertrand Landry Hetu</a></td>
|
<td><a href="mailto:bertrand@landryhetu.com">Bertrand Landry Hetu</a></td>
|
||||||
<td>Mac OS X port</td>
|
<td>Mac OS X port</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><a href="mailto:vttom@users.sourceforge.net">Tom Chadwick</a></td>
|
||||||
|
<td>PageUp/PageDown on X servers without mouse wheel support</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#else
|
#else
|
||||||
# include <X11/X.h>
|
# include <X11/X.h>
|
||||||
# include <X11/Xutil.h>
|
# include <X11/Xutil.h>
|
||||||
|
# define XK_MISCELLANY
|
||||||
# define XK_XKB_KEYS
|
# define XK_XKB_KEYS
|
||||||
# include <X11/keysymdef.h>
|
# include <X11/keysymdef.h>
|
||||||
# if HAVE_X11_EXTENSIONS_XTEST_H
|
# if HAVE_X11_EXTENSIONS_XTEST_H
|
||||||
|
@ -583,6 +584,20 @@ CXWindowsScreen::fakeMouseWheel(SInt32 delta) const
|
||||||
const unsigned int xButton = mapButtonToX(static_cast<ButtonID>(
|
const unsigned int xButton = mapButtonToX(static_cast<ButtonID>(
|
||||||
(delta >= 0) ? -1 : -2));
|
(delta >= 0) ? -1 : -2));
|
||||||
if (xButton == 0) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue