Store a copy of the configuration that we send down for initial fullscreen auto-conf. This will allow us to determine whether the guest has actually been configured properly. --- src/virt-viewer-session-spice.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c index 58f2af5..8e93b4a 100644 --- a/src/virt-viewer-session-spice.c +++ b/src/virt-viewer-session-spice.c @@ -59,6 +59,7 @@ struct _VirtViewerSessionSpicePrivate { guint pass_try; gboolean did_auto_conf; GList *display_channels; + GArray *fullscreen_config; }; #define VIRT_VIEWER_SESSION_SPICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_SESSION_SPICE, VirtViewerSessionSpicePrivate)) @@ -148,6 +149,7 @@ virt_viewer_session_spice_dispose(GObject *obj) g_clear_object(&spice->priv->main_window); g_clear_pointer(&spice->priv->display_channels, (GDestroyNotify*)g_list_free); + g_clear_pointer(&spice->priv->fullscreen_config, g_array_unref); G_OBJECT_CLASS(virt_viewer_session_spice_parent_class)->dispose(obj); } @@ -829,11 +831,11 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self) GdkScreen *screen = gdk_screen_get_default(); SpiceMainChannel* cmain = virt_viewer_session_spice_get_main_channel(self); VirtViewerApp *app = NULL; - GdkRectangle *displays; gboolean agent_connected; gint i; GList *initial_displays, *l; guint ndisplays; + GArray *config; /* only do auto-conf once at startup. Avoid repeating auto-conf later due to * agent disconnection/re-connection, etc */ @@ -866,32 +868,34 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self) initial_displays = virt_viewer_app_get_initial_displays(app); ndisplays = g_list_length(initial_displays); g_debug("Performing full screen auto-conf, %u host monitors", ndisplays); - displays = g_new0(GdkRectangle, ndisplays); + config = g_array_sized_new(FALSE, TRUE, sizeof(GdkRectangle), ndisplays); for (i = 0, l = initial_displays; l != NULL; l = l->next, i++) { - GdkRectangle* rect = &displays[i]; + GdkRectangle rect = { 0 }; gint j = virt_viewer_app_get_initial_monitor_for_display(app, GPOINTER_TO_INT(l->data)); - if (j == -1) - continue; - - gdk_screen_get_monitor_geometry(screen, j, rect); + if (j != -1) { + gdk_screen_get_monitor_geometry(screen, j, &rect); + g_array_append_val(config, rect); + } } g_list_free(initial_displays); - virt_viewer_shift_monitors_to_origin(displays, ndisplays); + virt_viewer_shift_monitors_to_origin((GdkRectangle*)config->data, + config->len); - for (i = 0; i < ndisplays; i++) { - GdkRectangle *rect = &displays[i]; + for (i = 0; i < config->len; i++) { + GdkRectangle *rect = &g_array_index(config, GdkRectangle, i); spice_main_set_display(cmain, i, rect->x, rect->y, rect->width, rect->height); spice_main_set_display_enabled(cmain, i, TRUE); g_debug("Set SPICE display %d to (%d,%d)-(%dx%d)", i, rect->x, rect->y, rect->width, rect->height); } - g_free(displays); spice_main_send_monitor_config(cmain); self->priv->did_auto_conf = TRUE; + + self->priv->fullscreen_config = config; return TRUE; } -- 2.1.0 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list