[mutter] MonitorManager: emit a DBus signal when we change the display configuration



commit 44097c1b371a721709c71ed375dc92de9e879efe
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Tue Aug 20 13:25:42 2013 +0200

    MonitorManager: emit a DBus signal when we change the display configuration
    
    Using out-of-band notifications from the wayland protocol or from
    X is racy, in that the client could ask for the new resources before
    we have them.
    Instead, with a signal, we are sure that when the client asks for
    it, it will get the right values.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706382

 src/core/monitor.c |   11 +----------
 src/xrandr.xml     |    9 +++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/core/monitor.c b/src/core/monitor.c
index d1a1283..e3e81ab 100644
--- a/src/core/monitor.c
+++ b/src/core/monitor.c
@@ -42,7 +42,6 @@
 #define ALL_WL_TRANSFORMS ((1 << (WL_OUTPUT_TRANSFORM_FLIPPED_270 + 1)) - 1)
 
 enum {
-  MONITORS_CHANGED,
   CONFIRM_DISPLAY_CHANGE,
   SIGNALS_LAST
 };
@@ -660,14 +659,6 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass)
   klass->get_edid_file = get_edid_file_dummy;
   klass->read_edid = read_edid_dummy;
 
-  signals[MONITORS_CHANGED] =
-    g_signal_new ("monitors-changed",
-                 G_TYPE_FROM_CLASS (object_class),
-                 G_SIGNAL_RUN_LAST,
-                 0,
-                  NULL, NULL, NULL,
-                 G_TYPE_NONE, 0);
-
   signals[CONFIRM_DISPLAY_CHANGE] =
     g_signal_new ("confirm-display-change",
                  G_TYPE_FROM_CLASS (object_class),
@@ -1497,7 +1488,7 @@ invalidate_logical_config (MetaMonitorManager *manager)
 
   make_logical_config (manager);
 
-  g_signal_emit (manager, signals[MONITORS_CHANGED], 0);
+  g_signal_emit_by_name (manager, "monitors-changed");
 
   g_free (old_monitor_infos);
 }
diff --git a/src/xrandr.xml b/src/xrandr.xml
index aa07464..d8574ad 100644
--- a/src/xrandr.xml
+++ b/src/xrandr.xml
@@ -277,5 +277,14 @@
        XRandR interface directly).
     -->
     <property name="PowerSaveMode" type="i" access="readwrite" />
+
+    <!--
+        MonitorsChanged:
+
+       The signal is emitted every time the screen configuration
+       changes.
+       The client should then call GetResources() to read the new layout.
+    -->
+    <signal name="MonitorsChanged" />
   </interface>
 </node>


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