[gtk: 1/3] GDK W32: send both smooth and discrete scrolling events
- From: LRN <ruslanizhb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/3] GDK W32: send both smooth and discrete scrolling events
- Date: Tue, 18 Sep 2018 16:43:59 +0000 (UTC)
commit d4098099ddeb1016faebc0846e59237ab9254a82
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date: Wed Sep 12 06:55:49 2018 +0000
GDK W32: send both smooth and discrete scrolling events
Commit d64467b33475bf8358f66bec9450101f37c05e9c 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 6eed24329f..ad05ee6314 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -2749,6 +2749,20 @@ gdk_event_translate (MSG *msg,
event->scroll.state = build_pointer_event_state (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_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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]