summaryrefslogtreecommitdiffstats
path: root/win/tkWinX.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2018-03-25 16:05:26 (GMT)
committerfvogel <fvogelnew1@free.fr>2018-03-25 16:05:26 (GMT)
commitcc843590bf0722f7ce2c48e7ca3673ead6b4c522 (patch)
tree79fd4e4d6200e5f2c238dd35f40cbd84f6722ed8 /win/tkWinX.c
parent737d44808eb279213954f4b5d4417f9bea3bd6a6 (diff)
downloadtk-cc843590bf0722f7ce2c48e7ca3673ead6b4c522.zip
tk-cc843590bf0722f7ce2c48e7ca3673ead6b4c522.tar.gz
tk-cc843590bf0722f7ce2c48e7ca3673ead6b4c522.tar.bz2
Better solution to [75d38f8608], that fixes the problem for all widgets, not only listbox. Thanks to oehhar for some of the ideas in that patch, and to dnikolajevich for providing this implementation.
Diffstat (limited to 'win/tkWinX.c')
-rw-r--r--win/tkWinX.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c
index fca72c3..22bd8c9 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -1131,7 +1131,26 @@ GenerateXEvent(
*/
switch (message) {
- case WM_MOUSEWHEEL:
+ case WM_MOUSEWHEEL: {
+
+ /*
+ * Support for high resolution wheels
+ */
+
+ static DWORD dwTickCountPrev = 0;
+ static short wheel_acc = 0;
+ DWORD dwTickCount;
+
+ dwTickCount = GetTickCount();
+ if (dwTickCount - dwTickCountPrev < 1500) {
+ wheel_acc += (short) HIWORD(wParam);
+ } else {
+ wheel_acc = (short) HIWORD(wParam);
+ }
+ dwTickCountPrev = dwTickCount;
+
+ if (abs(wheel_acc) < WHEEL_DELTA) return;
+
/*
* We have invented a new X event type to handle this event. It
* still uses the KeyPress struct. However, the keycode field has
@@ -1143,9 +1162,12 @@ GenerateXEvent(
event.type = MouseWheelEvent;
event.xany.send_event = -1;
event.xkey.nbytes = 0;
- event.xkey.keycode = (short) HIWORD(wParam);
+ event.xkey.keycode = wheel_acc / WHEEL_DELTA * WHEEL_DELTA;
+ wheel_acc = wheel_acc % WHEEL_DELTA;
break;
- case WM_SYSKEYDOWN:
+ }
+
+ case WM_SYSKEYDOWN:
case WM_KEYDOWN:
/*
* Check for translated characters in the event queue. Setting