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



commit 181543ad05b34173fbd12036080369ded4f0c915
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(+)
---
diff --git a/panels/display/cc-display-config-dbus.c b/panels/display/cc-display-config-dbus.c
index 593cf0155..a5049b78a 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 af1ff78cd..616711e0d 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]