diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt index b7f1b09f60..bc132a0691 100644 --- a/docs/reference/gdk/gdk3-sections.txt +++ b/docs/reference/gdk/gdk3-sections.txt @@ -864,6 +864,7 @@ gdk_events_get_angle gdk_events_get_center gdk_events_get_distance gdk_event_triggers_context_menu +gdk_event_get_seat gdk_event_handler_set diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index ed649130fc..a4c743d8a3 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -2314,3 +2314,38 @@ gdk_event_get_event_type (const GdkEvent *event) return event->type; } + +/** + * gdk_event_get_seat: + * @event: a #GdkEvent + * + * Returns the #GdkSeat this event was generated for. + * + * Returns: (transfer none): The #GdkSeat of this event + * + * Since: 3.20 + **/ +GdkSeat * +gdk_event_get_seat (const GdkEvent *event) +{ + const GdkEventPrivate *priv; + + if (!gdk_event_is_allocated (event)) + return NULL; + + priv = (const GdkEventPrivate *) event; + return priv->seat; +} + +void +gdk_event_set_seat (GdkEvent *event, + GdkSeat *seat) +{ + GdkEventPrivate *priv; + + if (gdk_event_is_allocated (event)) + { + priv = (GdkEventPrivate *) event; + priv->seat = seat; + } +} diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h index 53bf167829..ca019b7b9d 100644 --- a/gdk/gdkevents.h +++ b/gdk/gdkevents.h @@ -1427,6 +1427,9 @@ GdkEventSequence *gdk_event_get_event_sequence (const GdkEvent *event); GDK_AVAILABLE_IN_3_10 GdkEventType gdk_event_get_event_type (const GdkEvent *event); +GDK_AVAILABLE_IN_3_20 +GdkSeat *gdk_event_get_seat (const GdkEvent *event); + GDK_AVAILABLE_IN_ALL void gdk_set_show_events (gboolean show_events); GDK_AVAILABLE_IN_ALL diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index b75eb3a9fb..c9aa52430d 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -185,6 +185,7 @@ struct _GdkEventPrivate gpointer windowing_data; GdkDevice *device; GdkDevice *source_device; + GdkSeat *seat; }; typedef struct _GdkWindowPaint GdkWindowPaint; @@ -390,6 +391,9 @@ void _gdk_event_set_pointer_emulated (GdkEvent *event, gboolean emulated); gboolean _gdk_event_get_pointer_emulated (GdkEvent *event); +void gdk_event_set_seat (GdkEvent *event, + GdkSeat *seat); + void _gdk_event_emit (GdkEvent *event); GList* _gdk_event_queue_find_first (GdkDisplay *display); void _gdk_event_queue_remove_link (GdkDisplay *display,