[gtk+/wip/garnacho/gdkseat: 64/74] GdkDisplay: Add ::seat-added/removed signals



commit 1f77217d6891a69e8cc4f4d68c48539e603ccd9b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Dec 9 12:25:10 2015 +0100

    GdkDisplay: Add ::seat-added/removed signals
    
    These will be emitted as seats come and go.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759309

 gdk/gdkdisplay.c |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 37ef5fb..0a4b56d 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -69,6 +69,8 @@
 enum {
   OPENED,
   CLOSED,
+  SEAT_ADDED,
+  SEAT_REMOVED,
   LAST_SIGNAL
 };
 
@@ -187,6 +189,42 @@ gdk_display_class_init (GdkDisplayClass *class)
                  G_TYPE_NONE,
                  1,
                  G_TYPE_BOOLEAN);
+
+  /**
+   * GdkDisplay::seat-added:
+   * @display: the object on which the signal is emitted
+   * @seat: the seat that was just added
+   *
+   * The ::seat-added signal is emitted whenever a new seat is made
+   * known to the windowing system.
+   *
+   * Since: 3.20
+   */
+  signals[SEAT_ADDED] =
+    g_signal_new (g_intern_static_string ("seat-added"),
+                 G_OBJECT_CLASS_TYPE (object_class),
+                 G_SIGNAL_RUN_LAST,
+                 0, NULL, NULL,
+                  g_cclosure_marshal_VOID__OBJECT,
+                 G_TYPE_NONE, 1, GDK_TYPE_SEAT);
+
+  /**
+   * GdkDisplay::seat-removed:
+   * @display: the object on which the signal is emitted
+   * @seat: the seat that was just added
+   *
+   * The ::seat-removed signal is emitted whenever a seat is removed
+   * by the windowing system.
+   *
+   * Since: 3.20
+   */
+  signals[SEAT_REMOVED] =
+    g_signal_new (g_intern_static_string ("seat-removed"),
+                 G_OBJECT_CLASS_TYPE (object_class),
+                 G_SIGNAL_RUN_LAST,
+                 0, NULL, NULL,
+                  g_cclosure_marshal_VOID__OBJECT,
+                 G_TYPE_NONE, 1, GDK_TYPE_SEAT);
 }
 
 static void
@@ -2337,6 +2375,7 @@ gdk_display_add_seat (GdkDisplay *display,
   g_return_if_fail (GDK_IS_SEAT (seat));
 
   display->seats = g_list_prepend (display->seats, g_object_ref (seat));
+  g_signal_emit (display, signals[SEAT_ADDED], 0, seat);
 }
 
 void
@@ -2353,6 +2392,7 @@ gdk_display_remove_seat (GdkDisplay *display,
   if (link)
     {
       display->seats = g_list_remove_link (display->seats, link);
+      g_signal_emit (display, signals[SEAT_REMOVED], 0, seat);
       g_object_unref (link->data);
       g_list_free (link);
     }


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