[gtk+/wip/matthiasc/monitor-signals: 1/2] gdk: Add ::enter/leave-monitor signals



commit 2287e936f38155aef7a40453c300a0a7fd94a8af
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Nov 28 22:36:17 2017 -0500

    gdk: Add ::enter/leave-monitor signals
    
    These are useful to keep track of what monitors a window is on.

 gdk/gdkinternals.h |    5 +++++
 gdk/gdkwindow.c    |   40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 15913d8..dff0b1a 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -385,6 +385,11 @@ cairo_region_t *gdk_window_get_current_paint_region (GdkWindow *window);
 void       _gdk_window_process_updates_recurse (GdkWindow *window,
                                                 cairo_region_t *expose_region);
 
+void       gdk_window_enter_monitor (GdkWindow  *window,
+                                     GdkMonitor *monitor);
+void       gdk_window_leave_monitor (GdkWindow  *window,
+                                     GdkMonitor *monitor);
+
 /*****************************************
  * Interfaces provided by windowing code *
  *****************************************/
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 31ff1e4..d661dee 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -93,6 +93,8 @@
 
 enum {
   MOVED_TO_RECT,
+  ENTER_MONITOR,
+  LEAVE_MONITOR,
   LAST_SIGNAL
 };
 
@@ -316,6 +318,30 @@ gdk_window_class_init (GdkWindowClass *klass)
                   G_TYPE_POINTER,
                   G_TYPE_BOOLEAN,
                   G_TYPE_BOOLEAN);
+
+  signals[ENTER_MONITOR] =
+    g_signal_new (g_intern_static_string ("enter-monitor"),
+                  G_OBJECT_CLASS_TYPE (object_class),
+                  G_SIGNAL_RUN_FIRST,
+                  0,
+                  NULL,
+                  NULL,
+                  NULL,
+                  G_TYPE_NONE,
+                  1,
+                  GDK_TYPE_MONITOR);
+
+  signals[LEAVE_MONITOR] =
+    g_signal_new (g_intern_static_string ("leave-monitor"),
+                  G_OBJECT_CLASS_TYPE (object_class),
+                  G_SIGNAL_RUN_FIRST,
+                  0,
+                  NULL,
+                  NULL,
+                  NULL,
+                  G_TYPE_NONE,
+                  1,
+                  GDK_TYPE_MONITOR);
 }
 
 static void
@@ -7446,3 +7472,17 @@ gdk_window_supports_edge_constraints (GdkWindow *window)
   else
     return FALSE;
 }
+
+void
+gdk_window_enter_monitor (GdkWindow  *window,
+                          GdkMonitor *monitor)
+{
+  g_signal_emit (window, signals[ENTER_MONITOR], 0, monitor);
+}
+
+void
+gdk_window_leave_monitor (GdkWindow  *window,
+                          GdkMonitor *monitor)
+{
+  g_signal_emit (window, signals[LEAVE_MONITOR], 0, monitor);
+}


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