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

Jonathon Jongsma jjongsma at redhat.com
Tue Aug 12 18:31:58 UTC 2014


On Tue, 2014-08-12 at 18:03 +0200, Fabiano Fidêncio wrote:
> 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,

Does this fix a particular bug?  If so, it should be mentioned here.

> ---
>  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);


I don't love the name _update_displays_geometry(), but I can't really
think of anything better at the moment.  I think the approach is
basically correct (unsurprisingly, I suppose, since I suggested it), so
ACK from me.




More information about the virt-tools-list mailing list