gdk: add internal gdk_surface_get_seat_from_event()

This can come handy to get the seat from a surface/event.
This commit is contained in:
Olivier Fourdan
2020-03-30 16:55:05 +02:00
parent 3e1f59af61
commit a07a69e24e
2 changed files with 21 additions and 0 deletions

View File

@@ -181,6 +181,8 @@ void gdk_surface_get_unscaled_size (GdkSurface *surface,
int *unscaled_width,
int *unscaled_height);
gboolean gdk_surface_handle_event (GdkEvent *event);
GdkSeat * gdk_surface_get_seat_from_event (GdkSurface *surface,
GdkEvent *event);
/*****************************************
* Interfaces provided by windowing code *

View File

@@ -3015,3 +3015,22 @@ gdk_surface_translate_coordinates (GdkSurface *from,
return TRUE;
}
GdkSeat *
gdk_surface_get_seat_from_event (GdkSurface *surface,
GdkEvent *event)
{
if (event)
{
GdkDevice *device = gdk_event_get_device (event);
GdkSeat *seat = NULL;
device = gdk_event_get_device (event);
if (device)
seat = gdk_device_get_seat (device);
if (seat)
return seat;
}
return gdk_display_get_default_seat (surface->display);
}