[Spice-devel] [PATCH spice-gtk] Send monitor config to the agent on spice_main_set_display_enabled (#881072)

Hans de Goede hdegoede at redhat.com
Wed Jan 9 10:47:01 PST 2013

Currently we send an updated monitor-config to the agent whenever some
of the display settings are changed (whenever spice_main_set_display is
called), including when a new display is enabled, as that involves
creating a new window, which calls spice_main_set_display. The only
exception to this is when a display gets disabled.

This is rather inconistent, it causes the user to be able to move windows
in the guest to the now no longer visible monitor, and any windows which
were already there are hidden... until something else triggers us sending
updated monitor info. Withe gnome3 an alt-tab away and back again from a still
open display-window is enough to trigger the update, and then the guest will
all of a sudden become aware of the monitor no longer being there and
re-arrange windows accordingly, on an alt-tab in the client machine ...
not pretty.

So lets make things consistent and also send the agent updated monitor info
from spice_main_set_display_enabled, like we already do from

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
 gtk/channel-main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 6b9ba8d..653b989 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -2245,4 +2245,9 @@ void spice_main_set_display_enabled(SpiceMainChannel *channel, int id, gboolean
         g_return_if_fail(id < G_N_ELEMENTS(c->display));
         c->display[id].enabled = enabled;
+    if (c->timer_id) {
+        g_source_remove(c->timer_id);
+    }
+    c->timer_id = g_timeout_add_seconds(1, timer_set_display, channel);

More information about the Spice-devel mailing list