session: skip monitor changes if there is no sized monitors

spice-gtk discards configurations without any sized monitors.

Also shuts extra warnings when shifting the monitors.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
Marc-André Lureau 2018-07-26 21:28:36 +02:00
parent 1ad52ea8e9
commit ad64d0a3ac

View File

@ -406,6 +406,7 @@ virt_viewer_session_on_monitor_geometry_changed(VirtViewerSession* self,
gboolean all_fullscreen = TRUE;
/* GHashTable<gint, GdkRectangle*> */
GHashTable *monitors;
gint n_sized_monitors = 0;
GList *l;
klass = VIRT_VIEWER_SESSION_GET_CLASS(self);
@ -421,6 +422,8 @@ virt_viewer_session_on_monitor_geometry_changed(VirtViewerSession* self,
g_object_get(d, "nth-display", &nth, NULL);
virt_viewer_display_get_preferred_monitor_geometry(d, rect);
if (rect->width > 0 && rect->height > 0)
n_sized_monitors++;
if (virt_viewer_display_get_enabled(d) &&
!virt_viewer_display_get_fullscreen(d))
@ -428,12 +431,18 @@ virt_viewer_session_on_monitor_geometry_changed(VirtViewerSession* self,
g_hash_table_insert(monitors, GINT_TO_POINTER(nth), rect);
}
if (n_sized_monitors == 0) {
goto cleanup;
}
if (!all_fullscreen)
virt_viewer_align_monitors_linear(monitors);
virt_viewer_shift_monitors_to_origin(monitors);
klass->apply_monitor_geometry(self, monitors);
cleanup:
g_hash_table_unref(monitors);
}