summaryrefslogtreecommitdiffstats
path: root/src/virt-viewer-session-spice.c
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2015-03-19 10:53:55 -0500
committerJonathon Jongsma <jjongsma@redhat.com>2015-03-23 10:15:03 -0500
commitc586dc8c2bf84c2eda4db8759907e954dfb6ad6a (patch)
treef48adf64dfa636ffc500872dd9d393d95641f08d /src/virt-viewer-session-spice.c
parentb368761ea1ed461e175af175ba4d5b268debc9a8 (diff)
downloadvirt-viewer-c586dc8c2bf84c2eda4db8759907e954dfb6ad6a.tar.gz
virt-viewer-c586dc8c2bf84c2eda4db8759907e954dfb6ad6a.tar.xz
virt-viewer-c586dc8c2bf84c2eda4db8759907e954dfb6ad6a.zip
Monitor config at sometimes leaves additional monitors enabled
When using the configuration file to specify which remote monitors should be enabled when using the --full-screen option, it sometimes left additional displays enabled, or didn't place the displays on the right monitor, or didn't fullscreen them. This was especially true when not enabling the first display on the remote host. For example: monitor-mapping=2:2;3:3 (note that configuration file uses 1-based indexes, rather than 0-based indexes, so the numbers used below will be 1 less than those above) Previously, when performing fullscreen auto-conf, we were configuring displays starting at #0 and ending at ndisplays. So for the previous configuration, we looped from i = 0 to i < 2 (i.e. display #0 and #1) even though we should have configured display #1 and #2. After this fix, we configure the exact displays that were specified in the monitor-mapping configuration. Resolves: rhbz#1200750
Diffstat (limited to 'src/virt-viewer-session-spice.c')
-rw-r--r--src/virt-viewer-session-spice.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 5eb7234..4fdab2b 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -824,7 +824,8 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
GdkRectangle *displays;
gboolean agent_connected;
gint i;
- gsize ndisplays = 0;
+ GList *initial_displays, *l;
+ guint ndisplays;
/* only do auto-conf once at startup. Avoid repeating auto-conf later due to
* agent disconnection/re-connection, etc */
@@ -854,18 +855,20 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
spice_main_set_display_enabled(cmain, -1, FALSE);
- ndisplays = virt_viewer_app_get_n_initial_displays(app);
- g_debug("Performing full screen auto-conf, %" G_GSIZE_FORMAT " host monitors", ndisplays);
+ 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);
- for (i = 0; i < ndisplays; i++) {
+ for (i = 0, l = initial_displays; l != NULL; l = l->next, i++) {
GdkRectangle* rect = &displays[i];
- gint j = virt_viewer_app_get_initial_monitor_for_display(app, i);
+ 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);
}
+ g_list_free(initial_displays);
virt_viewer_shift_monitors_to_origin(displays, ndisplays);