gdk: Depend less on gdk_event_get_device()

For the most part, we are interested in seats here.
This commit is contained in:
Carlos Garnacho 2020-06-23 11:00:46 +02:00
parent cf1fbdf8b5
commit 7be6afe84d
5 changed files with 14 additions and 18 deletions

View File

@ -2947,11 +2947,9 @@ gdk_surface_get_seat_from_event (GdkSurface *surface,
{
if (event)
{
GdkDevice *device = gdk_event_get_device (event);
GdkSeat *seat = NULL;
if (device)
seat = gdk_device_get_seat (device);
seat = gdk_event_get_seat (event);
if (seat)
return seat;

View File

@ -4886,10 +4886,9 @@ _gdk_wayland_display_remove_seat (GdkWaylandDisplay *display_wayland,
}
uint32_t
_gdk_wayland_device_get_implicit_grab_serial (GdkWaylandDevice *device,
GdkEvent *event)
_gdk_wayland_seat_get_implicit_grab_serial (GdkSeat *seat,
GdkEvent *event)
{
GdkSeat *seat = gdk_device_get_seat (GDK_DEVICE (device));
GdkEventSequence *sequence = NULL;
GdkWaylandTouchData *touch = NULL;

View File

@ -134,8 +134,8 @@ void _gdk_wayland_display_remove_seat (GdkWaylandDisplay *displa
guint32 id);
GdkKeymap *_gdk_wayland_device_get_keymap (GdkDevice *device);
uint32_t _gdk_wayland_device_get_implicit_grab_serial(GdkWaylandDevice *device,
GdkEvent *event);
uint32_t _gdk_wayland_seat_get_implicit_grab_serial(GdkSeat *seat,
GdkEvent *event);
uint32_t _gdk_wayland_seat_get_last_implicit_grab_serial (GdkWaylandSeat *seat,
GdkEventSequence **seqence);
struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_device);

View File

@ -3830,8 +3830,8 @@ gdk_wayland_surface_show_window_menu (GdkSurface *surface,
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
struct wl_seat *seat;
GdkWaylandDevice *device;
GdkSeat *seat;
struct wl_seat *wl_seat;
double x, y;
uint32_t serial;
@ -3850,21 +3850,21 @@ gdk_wayland_surface_show_window_menu (GdkSurface *surface,
if (!is_realized_toplevel (surface))
return FALSE;
device = GDK_WAYLAND_DEVICE (gdk_event_get_device (event));
seat = gdk_wayland_device_get_wl_seat (GDK_DEVICE (device));
seat = gdk_event_get_seat (event);
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
gdk_event_get_position (event, &x, &y);
serial = _gdk_wayland_device_get_implicit_grab_serial (device, event);
serial = _gdk_wayland_seat_get_implicit_grab_serial (seat, event);
switch (display_wayland->shell_variant)
{
case GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL:
xdg_toplevel_show_window_menu (impl->display_server.xdg_toplevel,
seat, serial, x, y);
wl_seat, serial, x, y);
break;
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
zxdg_toplevel_v6_show_window_menu (impl->display_server.zxdg_toplevel_v6,
seat, serial, x, y);
wl_seat, serial, x, y);
break;
default:
g_assert_not_reached ();

View File

@ -152,9 +152,8 @@ static void
handle_touch_synthetic_crossing (GdkEvent *event)
{
GdkEventType evtype = gdk_event_get_event_type (event);
GdkDevice *device = gdk_event_get_device (event);
GdkEvent *crossing = NULL;
GdkSeat *seat = gdk_device_get_seat (device);
GdkSeat *seat = gdk_event_get_seat (event);
gboolean needs_enter, set_needs_enter = FALSE;
if (quark_needs_enter == 0)
@ -208,7 +207,7 @@ handle_touch_synthetic_crossing (GdkEvent *event)
if (crossing)
{
gdk_display_put_event (gdk_device_get_display (device), crossing);
gdk_display_put_event (gdk_seat_get_display (seat), crossing);
gdk_event_unref (crossing);
}
}