[virt-tools-list] [PATCH virt-viewer 2/2] spice: always send auto-conf on agent connection

Marc-André Lureau marcandre.lureau at gmail.com
Fri Mar 22 13:14:28 UTC 2013


Restore the auto-conf client monitor configuration whenever the agent
is started. This ensures the guest has the expected number of monitors
enabled when rebooting in fullscreen.

https://bugzilla.redhat.com/show_bug.cgi?id=918997
---
 src/virt-viewer-session-spice.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 29febc3..586fa26 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -515,15 +515,8 @@ agent_connected_changed(SpiceChannel *cmain G_GNUC_UNUSED,
 {
     // this will force refresh of application menu
     g_signal_emit_by_name(self, "session-display-updated");
-}
 
-static void
-agent_connected_fullscreen_auto_conf(SpiceChannel *cmain,
-                                     GParamSpec *pspec G_GNUC_UNUSED,
-                                     VirtViewerSessionSpice *self)
-{
-    if (virt_viewer_session_spice_fullscreen_auto_conf(self))
-        g_signal_handlers_disconnect_by_func(cmain, agent_connected_fullscreen_auto_conf, self);
+    virt_viewer_session_spice_fullscreen_auto_conf(self);
 }
 
 static void
@@ -625,8 +618,7 @@ virt_viewer_session_spice_channel_new(SpiceSession *s,
         self->priv->main_channel = SPICE_MAIN_CHANNEL(channel);
 
         g_signal_connect(channel, "notify::agent-connected", G_CALLBACK(agent_connected_changed), self);
-        g_signal_connect(channel, "notify::agent-connected", G_CALLBACK(agent_connected_fullscreen_auto_conf), self);
-        agent_connected_fullscreen_auto_conf(channel, NULL, self);
+        virt_viewer_session_spice_fullscreen_auto_conf(self);
     }
 
     if (SPICE_IS_DISPLAY_CHANNEL(channel)) {
@@ -666,12 +658,18 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
 
     DEBUG_LOG("Checking full screen auto-conf");
     g_object_get(app, "fullscreen-auto-conf", &auto_conf, NULL);
-    if (!auto_conf)
-        return TRUE;
-
-    if (cmain == NULL)
+    if (!auto_conf) {
+        DEBUG_LOG("auto-conf disabled");
         return FALSE;
-
+    }
+    if (!virt_viewer_app_get_fullscreen(app)) {
+        DEBUG_LOG("app is not in full screen");
+        return FALSE;
+    }
+    if (cmain == NULL) {
+        DEBUG_LOG("no main channel yet");
+        return FALSE;
+    }
     g_object_get(cmain, "agent-connected", &agent_connected, NULL);
     if (!agent_connected) {
         DEBUG_LOG("Agent not connected, skipping autoconf");
-- 
1.8.1.1.439.g50a6b54




More information about the virt-tools-list mailing list