From db2c9a6ec8f856abd1a7c7c74d65371d68c609cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Wed, 12 Sep 2018 06:55:49 +0000 Subject: [PATCH] GDK W32: send both smooth and discrete scrolling events Commit 359df028be7b1dae76a1abb9bad8a3b86a648765 changed the code to send GDK_SCROLL_SMOOTH with deltas instead of GDK_SCROLL_(UP|DOWN|LEFT|RIGHT). Change it again, to send both the GDK_SCROLL_SMOOTH and the GDK_SCROLL_(UP|DOWN|LEFT|RIGHT) event separately (with the discrete event marked as emulated), as this is what other backends (such as wayland) do. --- gdk/win32/gdkevents-win32.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index beaac53f49..8b2d2f7ec9 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -3109,6 +3109,20 @@ gdk_event_translate (MSG *msg, gdk_event_set_device (event, device_manager_win32->core_pointer); gdk_event_set_source_device (event, device_manager_win32->system_pointer); gdk_event_set_seat (event, gdk_device_get_seat (device_manager_win32->core_pointer)); + gdk_event_set_pointer_emulated (event, FALSE); + + _gdk_win32_append_event (gdk_event_copy (event)); + + /* Append the discrete version too */ + if (msg->message == WM_MOUSEWHEEL) + event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ? + GDK_SCROLL_UP : GDK_SCROLL_DOWN; + else if (msg->message == WM_MOUSEHWHEEL) + event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ? + GDK_SCROLL_RIGHT : GDK_SCROLL_LEFT; + event->scroll.delta_x = 0; + event->scroll.delta_y = 0; + gdk_event_set_pointer_emulated (event, TRUE); _gdk_win32_append_event (event);