summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdk/gdkinternals.h2
-rw-r--r--gdk/gdksurface.c19
2 files changed, 21 insertions, 0 deletions
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 2af0cf36ca..21f75d7dc5 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -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 *
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 25d6efc7a8..7432a9b348 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -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);
+}