diff options
author | Luca Bacci <luca.bacci982@gmail.com> | 2022-08-15 21:33:19 +0000 |
---|---|---|
committer | Luca Bacci <luca.bacci982@gmail.com> | 2022-08-15 21:33:19 +0000 |
commit | fbd11fc5955aa3be8febe87da14b9c47787ab2e1 (patch) | |
tree | 4b85b53eeffd09d0849607537ce59aedec7dd34c | |
parent | bebaac64e1779807a47a8e275866ecddb12749a4 (diff) | |
parent | 6ceacee0f90c6e5a7a09380ef4be810b76db10cb (diff) | |
download | gtk+-fbd11fc5955aa3be8febe87da14b9c47787ab2e1.tar.gz |
Merge branch 'overshoot-win32-fix' into 'main'
GdkWin32: Support high resolution scroll wheel events
See merge request GNOME/gtk!4950
-rw-r--r-- | gdk/win32/gdkevents-win32.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 23f99c1ab7..ee5bc47b39 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -2669,6 +2669,7 @@ gdk_event_translate (MSG *msg, { int16_t scroll_x = 0; int16_t scroll_y = 0; + GdkScrollDirection direction; char classname[64]; @@ -2720,15 +2721,24 @@ gdk_event_translate (MSG *msg, _gdk_device_virtual_set_active (_gdk_device_manager->core_pointer, _gdk_device_manager->system_pointer); - event = gdk_scroll_event_new (window, - device_manager_win32->core_pointer, - NULL, - _gdk_win32_get_next_tick (msg->time), - build_pointer_event_state (msg), - (double) scroll_x / (double) WHEEL_DELTA, - (double) -scroll_y / (double) WHEEL_DELTA, - FALSE, - GDK_SCROLL_UNIT_WHEEL); + direction = 0; + if (msg->message == WM_MOUSEWHEEL) + direction = (((short) HIWORD (msg->wParam)) > 0) + ? GDK_SCROLL_UP + : GDK_SCROLL_DOWN; + else if (msg->message == WM_MOUSEHWHEEL) + direction = (((short) HIWORD (msg->wParam)) > 0) + ? GDK_SCROLL_RIGHT + : GDK_SCROLL_LEFT; + + event = gdk_scroll_event_new_value120 (window, + device_manager_win32->core_pointer, + NULL, + _gdk_win32_get_next_tick (msg->time), + build_pointer_event_state (msg), + direction, + (double) scroll_x, + (double) -scroll_y); _gdk_win32_append_event (event); |