[gtk/gtk-3-24: 1/2] Add slave device option for emulated crossing events under Wayland



commit 94960b828f4ea1f83c748e8022c7f9813bf9861a
Author: Julius Lehmann <internet devpi de>
Date:   Mon Aug 5 12:50:49 2019 +0200

    Add slave device option for emulated crossing events under Wayland
    
    This fixes an issue where stylus proximity in/out events emulate enter/leave events.
    The emulated events didn't contain the correct slave device and therefore the
    resulting device class was set incorrectly. Crossing event emulation now also
    works with slave devices.
    
    Closes #2070
    Fixes #2070
    Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2070

 gdk/wayland/gdkdevice-wayland.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 0d06141ff2..79b08b53b2 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -634,6 +634,7 @@ static void
 emulate_crossing (GdkWindow       *window,
                   GdkWindow       *subwindow,
                   GdkDevice       *device,
+                  GdkDevice       *source,
                   GdkEventType     type,
                   GdkCrossingMode  mode,
                   guint32          time_)
@@ -647,7 +648,7 @@ emulate_crossing (GdkWindow       *window,
   event->crossing.mode = mode;
   event->crossing.detail = GDK_NOTIFY_NONLINEAR;
   gdk_event_set_device (event, device);
-  gdk_event_set_source_device (event, device);
+  gdk_event_set_source_device (event, source);
   gdk_event_set_seat (event, gdk_device_get_seat (device));
 
   gdk_window_get_device_position_double (window, device,
@@ -724,9 +725,9 @@ device_emit_grab_crossing (GdkDevice       *device,
   else
     {
       if (from)
-        emulate_crossing (from, to, device, GDK_LEAVE_NOTIFY, mode, time_);
+        emulate_crossing (from, to, device, device, GDK_LEAVE_NOTIFY, mode, time_);
       if (to)
-        emulate_crossing (to, from, device, GDK_ENTER_NOTIFY, mode, time_);
+        emulate_crossing (to, from, device, device, GDK_ENTER_NOTIFY, mode, time_);
     }
 }
 
@@ -3504,16 +3505,16 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet,
     }
 
   if (event->type == GDK_PROXIMITY_OUT)
-    emulate_crossing (event->proximity.window, NULL,
-                      tablet->master, GDK_LEAVE_NOTIFY,
+    emulate_crossing (event->proximity.window, NULL, tablet->master,
+                      tablet->current_device, GDK_LEAVE_NOTIFY,
                       GDK_CROSSING_NORMAL, time);
 
   _gdk_wayland_display_deliver_event (gdk_seat_get_display (tablet->seat),
                                       event);
 
   if (event->type == GDK_PROXIMITY_IN)
-    emulate_crossing (event->proximity.window, NULL,
-                      tablet->master, GDK_ENTER_NOTIFY,
+    emulate_crossing (event->proximity.window, NULL, tablet->master,
+                      tablet->current_device, GDK_ENTER_NOTIFY,
                       GDK_CROSSING_NORMAL, time);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]