[gtk+] gdkevents: Fallback to the event device seat



commit 7a926cc7e0e12e70c920e28bdce1d2c4ecbf63a0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Dec 16 19:00:39 2015 +0100

    gdkevents: Fallback to the event device seat
    
    There's places where we don't set a seat yet, plus the places
    outside GTK+ where events are created, we should warn and fall
    back to the master device seat with these.

 gdk/gdkevents.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 62a4748..9ed4317 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -2333,6 +2333,20 @@ gdk_event_get_seat (const GdkEvent *event)
     return NULL;
 
   priv = (const GdkEventPrivate *) event;
+
+  if (!priv->seat)
+    {
+      GdkDevice *device;
+
+      g_warning ("Event with type %d not holding a GdkSeat. "
+                 "It is most likely synthesized outside Gdk/GTK+\n",
+                 event->type);
+
+      device = gdk_event_get_device (event);
+
+      return device ? gdk_device_get_seat (device) : NULL;
+    }
+
   return priv->seat;
 }
 


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