[gtk/wip/carlosg/input-cleanups: 7/26] gdk: Add gdk_event_get_seat()



commit cf1fbdf8b5f56dfe8cafb18332c7878acfce9a43
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jun 23 01:14:53 2020 +0200

    gdk: Add gdk_event_get_seat()
    
    It currently fetches the seat from the event device, will be changed
    in future commits.

 gdk/gdkevents.c | 16 ++++++++++++++++
 gdk/gdkevents.h |  3 +++
 2 files changed, 19 insertions(+)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index c9ad0df308..aacf5a9cc0 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -1185,6 +1185,22 @@ gdk_event_get_surface (GdkEvent *event)
   return event->surface;
 }
 
+/**
+ * gdk_event_get_seat:
+ * @event: a #GdkEvent.
+ *
+ * Returns the seat that originated the event.
+ *
+ * Returns: (nullable) (transfer none): a #GdkSeat.
+ */
+GdkSeat *
+gdk_event_get_seat (GdkEvent *event)
+{
+  g_return_val_if_fail (GDK_IS_EVENT (event), NULL);
+
+  return event->device ? gdk_device_get_seat (event->device) : NULL;
+}
+
 /**
  * gdk_event_get_device:
  * @event: a #GdkEvent.
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index 9abb9a96cd..53bd51b98c 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -344,6 +344,9 @@ GdkEventType            gdk_event_get_event_type        (GdkEvent *event);
 GDK_AVAILABLE_IN_ALL
 GdkSurface *            gdk_event_get_surface           (GdkEvent *event);
 
+GDK_AVAILABLE_IN_ALL
+GdkSeat *               gdk_event_get_seat              (GdkEvent *event);
+
 GDK_AVAILABLE_IN_ALL
 GdkDevice *             gdk_event_get_device            (GdkEvent *event);
 


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