[gnome-control-center/wip/benzea/display: 1/5] display: Add signal to monitor notifying about position changes



commit 7db3df860d604c2074914cbf119a17a6053f3ede
Author: Benjamin Berg <bberg redhat com>
Date:   Fri Nov 24 12:49:56 2017 +0100

    display: Add signal to monitor notifying about position changes
    
    This is in preparation to a new arrangement widget.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786971

 panels/display/cc-display-config-dbus.c |    9 +++++++++
 panels/display/cc-display-config.c      |    5 +++++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/panels/display/cc-display-config-dbus.c b/panels/display/cc-display-config-dbus.c
index 593cf01..a5049b7 100644
--- a/panels/display/cc-display-config-dbus.c
+++ b/panels/display/cc-display-config-dbus.c
@@ -659,9 +659,18 @@ cc_display_monitor_dbus_set_position (CcDisplayMonitor *pself,
 
   if (self->logical_monitor)
     {
+      gboolean notify = FALSE;
+
+      if (self->logical_monitor->x != x || self->logical_monitor->y != y)
+        notify = TRUE;
+
       self->logical_monitor->x = x;
       self->logical_monitor->y = y;
+
+      if (notify)
+        g_signal_emit_by_name (self, "position-changed");
     }
+
 }
 
 static double
diff --git a/panels/display/cc-display-config.c b/panels/display/cc-display-config.c
index af1ff78..616711e 100644
--- a/panels/display/cc-display-config.c
+++ b/panels/display/cc-display-config.c
@@ -107,6 +107,11 @@ cc_display_monitor_class_init (CcDisplayMonitorClass *klass)
                 G_SIGNAL_RUN_LAST,
                 0, NULL, NULL, NULL,
                 G_TYPE_NONE, 0);
+  g_signal_new ("position-changed",
+                CC_TYPE_DISPLAY_MONITOR,
+                G_SIGNAL_RUN_LAST,
+                0, NULL, NULL, NULL,
+                G_TYPE_NONE, 0);
 }
 
 const char *


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