summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/tkWinX.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c
index f73c739..67411f0 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -1139,51 +1139,58 @@ GenerateXEvent(
switch (message) {
case WM_MOUSEWHEEL: {
+
/*
- * Support for high resolution wheels (vertical).
+ * Send an Xevent using a KeyPress struct, but with the type field
+ * set to MouseWheelEventq and the keypress field set to the value
+ * of the MouseWheel delta. For high resolution events the
+ * ControlMask bit is set and delta is stored in the high word of
+ * the keycode. For low resolution scrolls the delta is in the
+ * low word of the keycode. Set nbytes to 0 to prevent conversion
+ * of the keycode to a keysym in TkpGetString. [Bug 1118340].
*/
int delta = (short) HIWORD(wParam);
int mod = delta % WHEELDELTA;
if ( mod != 0 || lastMod != 0) {
- printf("Trackpad scroll\n");
+ /* High resolution. */
+ event.x.type = MouseWheelEvent;
+ event.x.xany.send_event = -1;
+ event.key.nbytes = 0;
+ event.x.xkey.state = state | ControlMask ;
+ event.x.xkey.keycode = (unsigned int) delta;
} else {
-
- /*
- * We have invented a new X event type to handle this
- * event. It still uses the KeyPress struct. However, the
- * keycode field has been overloaded to hold the zDelta of the
- * wheel. Set nbytes to 0 to prevent conversion of the keycode
- * to a keysym in TkpGetString. [Bug 1118340].
- */
-
event.x.type = MouseWheelEvent;
event.x.xany.send_event = -1;
event.key.nbytes = 0;
- event.x.xkey.keycode = (unsigned int)delta;
+ event.x.xkey.keycode = (unsigned int) delta;
}
lastMod = mod;
break;
}
case WM_MOUSEHWHEEL: {
+
/*
- * Support for high resolution wheels (horizontal).
+ * Send an Xevent using a KeyPress struct, but with the type field
+ * set to MouseWheelEventq and the keypress field set to the value
+ * of the MouseWheel delta. For high resolution scrolls the
+ * ControlMask bit is set and deltaX is stored in the high word of
+ * the keycode. For low resolution scrolls the delta is in the
+ * low word of the keycode and the ShiftMask bit is set. Set
+ * nbytes to 0 to prevent conversion of the keycode to a keysym in
+ * TkpGetString. [Bug 1118340].
*/
int delta = (short) HIWORD(wParam);
int mod = delta % WHEELDELTA;
if ( mod != 0 || lastMod != 0) {
- printf("Trackpad scroll\n");
+ /* High resolution. */
+ event.x.type = MouseWheelEvent;
+ event.x.xany.send_event = -1;
+ event.key.nbytes = 0;
+ event.x.xkey.state = state | ControlMask ;
+ event.x.xkey.keycode = delta << 16;
} else {
-
- /*
- * We have invented a new X event type to handle this event. It
- * still uses the KeyPress struct. However, the keycode field has
- * been overloaded to hold the zDelta of the wheel. Set nbytes to
- * 0 to prevent conversion of the keycode to a keysym in
- * TkpGetString. [Bug 1118340].
- */
-
event.x.type = MouseWheelEvent;
event.x.xany.send_event = -1;
event.key.nbytes = 0;