summaryrefslogtreecommitdiff
path: root/src/virt-viewer-app.c
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2014-09-22 14:08:30 -0500
committerJonathon Jongsma <jjongsma@redhat.com>2014-09-24 10:19:29 -0500
commitf26a5fe16cc5d71a3edad17026ab35411286b140 (patch)
tree4e33ad78b7b1b4dfb8eefaa5927201425e94471a /src/virt-viewer-app.c
parentf317e950969738783919ea7d7f3a2fa9ddd44c3b (diff)
Don't show extra screens in fullscreen mode
When using the fullscreen display mapping configuration file, extra monitors could end up enabled by mistake. This was because virt_viewer_app_get_initial_monitor_for_display would end up returning Nmonitor = Ndisplay when the display map hash lookup failed. In reality, when a display map is specified, but the hash lookup fails, the display should not be enabled. This function now returns -1 to distinguish this case, and the display is not enabled when this value is returned. Resolves issue described at https://bugzilla.redhat.com/show_bug.cgi?id=1129477#c9
Diffstat (limited to 'src/virt-viewer-app.c')
-rw-r--r--src/virt-viewer-app.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 613a28f..5151393 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -314,8 +314,11 @@ gint virt_viewer_app_get_initial_monitor_for_display(VirtViewerApp* self, gint d
if (self->priv->initial_display_map) {
gpointer value = NULL;
- if (g_hash_table_lookup_extended(self->priv->initial_display_map, GINT_TO_POINTER(display), NULL, &value))
+ if (g_hash_table_lookup_extended(self->priv->initial_display_map, GINT_TO_POINTER(display), NULL, &value)) {
monitor = GPOINTER_TO_INT(value);
+ } else {
+ monitor = -1;
+ }
}
return monitor;
@@ -327,7 +330,7 @@ app_window_try_fullscreen(VirtViewerApp *self G_GNUC_UNUSED,
{
GdkScreen *screen = gdk_screen_get_default();
gint monitor = virt_viewer_app_get_initial_monitor_for_display(self, nth);
- if (monitor >= gdk_screen_get_n_monitors(screen)) {
+ if (monitor == -1 || monitor >= gdk_screen_get_n_monitors(screen)) {
g_debug("skipping fullscreen for display %d", nth);
return;
}