[Spice-devel] [vdagent-linux 1/2] randr: remove monitors.xml on auto-configuration

Marc-André Lureau marcandre.lureau at redhat.com
Wed Aug 27 10:22:07 PDT 2014


From: Marc-Andre Lureau <marcandre.lureau at redhat.com>

GNOME will restore monitors.xml configuration whenever the timestamp
"config > change". The "change" timestamp is the last user applied
configuration, whereas the "config" timestamp is updated when
the screen is updated or ouput/crtc modes are added/removed.

These condition are triggered by vdagent during monitor config. Since we
can't control the timestamps (playing with delay will be inherently
event more racy), the only sane way I can think of is to disable gsd
behaviour. This can be achieved by deleting the ~/.config/monitors.xml,
which is the intended configuration to restore, so vdagent will override
whatever configuration was saved previously.

Somehow, if vdagent would be better integrated with gnome2, it would use
the gnome-rr and/or org.gnome.SettingsDaemon.XRANDR dbus
API. Thanksfully, in gnome3, the monitor auto-configuration has been
merged in.

https://bugzilla.redhat.com/show_bug.cgi?id=1086657
---
 src/vdagent-x11-randr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
index 46367bc..5faaee6 100644
--- a/src/vdagent-x11-randr.c
+++ b/src/vdagent-x11-randr.c
@@ -21,6 +21,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <glib.h>
 #include <string.h>
 #include <syslog.h>
 #include <stdlib.h>
@@ -745,6 +746,10 @@ void vdagent_x11_set_monitor_config(struct vdagent_x11 *x11,
         goto exit;
     }
 
+    gchar *config = g_build_filename (g_get_user_config_dir (), "monitors.xml", NULL);
+    g_unlink(config);
+    g_free(config);
+
     for (i = mon_config->num_of_monitors; i < x11->randr.res->noutput; i++)
         xrandr_disable_output(x11, i);
 
-- 
1.9.3



More information about the Spice-devel mailing list