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
This commit is contained in:
Julius Lehmann
2019-08-05 12:50:49 +02:00
parent 52b125c928
commit 94960b828f

View File

@ -634,6 +634,7 @@ static void
emulate_crossing (GdkWindow *window, emulate_crossing (GdkWindow *window,
GdkWindow *subwindow, GdkWindow *subwindow,
GdkDevice *device, GdkDevice *device,
GdkDevice *source,
GdkEventType type, GdkEventType type,
GdkCrossingMode mode, GdkCrossingMode mode,
guint32 time_) guint32 time_)
@ -647,7 +648,7 @@ emulate_crossing (GdkWindow *window,
event->crossing.mode = mode; event->crossing.mode = mode;
event->crossing.detail = GDK_NOTIFY_NONLINEAR; event->crossing.detail = GDK_NOTIFY_NONLINEAR;
gdk_event_set_device (event, device); 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_event_set_seat (event, gdk_device_get_seat (device));
gdk_window_get_device_position_double (window, device, gdk_window_get_device_position_double (window, device,
@ -724,9 +725,9 @@ device_emit_grab_crossing (GdkDevice *device,
else else
{ {
if (from) 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) 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) if (event->type == GDK_PROXIMITY_OUT)
emulate_crossing (event->proximity.window, NULL, emulate_crossing (event->proximity.window, NULL, tablet->master,
tablet->master, GDK_LEAVE_NOTIFY, tablet->current_device, GDK_LEAVE_NOTIFY,
GDK_CROSSING_NORMAL, time); GDK_CROSSING_NORMAL, time);
_gdk_wayland_display_deliver_event (gdk_seat_get_display (tablet->seat), _gdk_wayland_display_deliver_event (gdk_seat_get_display (tablet->seat),
event); event);
if (event->type == GDK_PROXIMITY_IN) if (event->type == GDK_PROXIMITY_IN)
emulate_crossing (event->proximity.window, NULL, emulate_crossing (event->proximity.window, NULL, tablet->master,
tablet->master, GDK_ENTER_NOTIFY, tablet->current_device, GDK_ENTER_NOTIFY,
GDK_CROSSING_NORMAL, time); GDK_CROSSING_NORMAL, time);
} }