From f02d4352d3157a953fa4609c48746cffaee45d14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Mon, 11 Aug 2014 22:38:38 +0200
Subject: [PATCH] Force displays to update geometry when agent connects
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.
https://bugzilla.redhat.com/sho_bug.cgi?id=1021841
(cherry picked from commit e85ae4c27c84282572e42145a56e37c171a8a24a)
---
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 ceef067..0c8cefb 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -589,6 +589,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 9410004..8413bfe 100644
--- a/src/virt-viewer-session.c
+++ b/src/virt-viewer-session.c
@@ -475,6 +475,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);