[virt-tools-list] [PATCH][virt-viewer] Force displays to update geometry when agent connects

Fabiano Fidêncio fidencio at redhat.com
Tue Aug 12 16:03:19 UTC 2014


We have to force displays to update geometry when the agent connects to
ensure the client will have the guest with the right resolution when the
guest has rebooted or the agent has crashed,
---
 src/virt-viewer-session-spice.c | 4 ++++
 src/virt-viewer-session.c       | 4 ++++
 src/virt-viewer-session.h       | 1 +
 3 files changed, 9 insertions(+)

diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index b6886be..a27d433 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -618,6 +618,10 @@ agent_connected_changed(SpiceChannel *cmain G_GNUC_UNUSED,
 {
     // this will force refresh of application menu
     g_signal_emit_by_name(self, "session-display-updated");
+
+    /* this will force update displays geometry when the agent has connected
+     * after the application (eg: rebooting the guest) */
+    virt_viewer_session_update_displays_geometry(VIRT_VIEWER_SESSION(self));
 }
 
 static void
diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
index c432719..d9c84a6 100644
--- a/src/virt-viewer-session.c
+++ b/src/virt-viewer-session.c
@@ -476,6 +476,10 @@ void virt_viewer_session_clear_displays(VirtViewerSession *session)
     session->priv->displays = NULL;
 }
 
+void virt_viewer_session_update_displays_geometry(VirtViewerSession *session)
+{
+    virt_viewer_session_on_monitor_geometry_changed(session, NULL);
+}
 
 
 void virt_viewer_session_close(VirtViewerSession *session)
diff --git a/src/virt-viewer-session.h b/src/virt-viewer-session.h
index 316fdf0..ba0f6b2 100644
--- a/src/virt-viewer-session.h
+++ b/src/virt-viewer-session.h
@@ -107,6 +107,7 @@ void virt_viewer_session_add_display(VirtViewerSession *session,
 void virt_viewer_session_remove_display(VirtViewerSession *session,
                                         VirtViewerDisplay *display);
 void virt_viewer_session_clear_displays(VirtViewerSession *session);
+void virt_viewer_session_update_displays_geometry(VirtViewerSession *session);
 
 void virt_viewer_session_close(VirtViewerSession* session);
 gboolean virt_viewer_session_open_fd(VirtViewerSession* session, int fd);
-- 
1.9.3




More information about the virt-tools-list mailing list