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
This commit is contained in:
Giovanni Campagna 2013-08-20 13:25:42 +02:00
parent e66db2eab3
commit eeb3dfc991
2 changed files with 10 additions and 10 deletions

View File

@ -42,7 +42,6 @@
#define ALL_WL_TRANSFORMS ((1 << (WL_OUTPUT_TRANSFORM_FLIPPED_270 + 1)) - 1) #define ALL_WL_TRANSFORMS ((1 << (WL_OUTPUT_TRANSFORM_FLIPPED_270 + 1)) - 1)
enum { enum {
MONITORS_CHANGED,
CONFIRM_DISPLAY_CHANGE, CONFIRM_DISPLAY_CHANGE,
SIGNALS_LAST SIGNALS_LAST
}; };
@ -660,14 +659,6 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass)
klass->get_edid_file = get_edid_file_dummy; klass->get_edid_file = get_edid_file_dummy;
klass->read_edid = read_edid_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] = signals[CONFIRM_DISPLAY_CHANGE] =
g_signal_new ("confirm-display-change", g_signal_new ("confirm-display-change",
G_TYPE_FROM_CLASS (object_class), G_TYPE_FROM_CLASS (object_class),
@ -1497,7 +1488,7 @@ invalidate_logical_config (MetaMonitorManager *manager)
make_logical_config (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); g_free (old_monitor_infos);
} }

View File

@ -277,5 +277,14 @@
XRandR interface directly). XRandR interface directly).
--> -->
<property name="PowerSaveMode" type="i" access="readwrite" /> <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> </interface>
</node> </node>