diff options
author | Jonathon Jongsma <jjongsma@redhat.com> | 2014-09-24 09:43:46 -0500 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@redhat.com> | 2014-09-24 09:43:46 -0500 |
commit | f317e950969738783919ea7d7f3a2fa9ddd44c3b (patch) | |
tree | 402127e422fa86ce0dd864cfe4ba04c0cafe3767 | |
parent | 5d6b1b8cceaac11778ff43e75edfe1bc55ae74d7 (diff) |
Move monitor mapping into app_window_try_fullscreen()
Rather than requiring all callers to calculate the initial monitor
mapping before calling app_window_try_fullscreen, move the
responsibility for calculating the correct monitor into this function.
This makes it less likely that somebody will forget and a display will
get placed on the wrong monitor.
-rw-r--r-- | src/virt-viewer-app.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c index a890bf6..613a28f 100644 --- a/src/virt-viewer-app.c +++ b/src/virt-viewer-app.c @@ -326,13 +326,13 @@ app_window_try_fullscreen(VirtViewerApp *self G_GNUC_UNUSED, VirtViewerWindow *win, gint nth) { GdkScreen *screen = gdk_screen_get_default(); - - if (nth >= gdk_screen_get_n_monitors(screen)) { - g_debug("skipping display %d", nth); + gint monitor = virt_viewer_app_get_initial_monitor_for_display(self, nth); + if (monitor >= gdk_screen_get_n_monitors(screen)) { + g_debug("skipping fullscreen for display %d", nth); return; } - virt_viewer_window_enter_fullscreen(win, nth); + virt_viewer_window_enter_fullscreen(win, monitor); } @@ -449,8 +449,7 @@ void virt_viewer_app_set_uuid_string(VirtViewerApp *self, const gchar *uuid_stri g_hash_table_iter_init(&iter, self->priv->windows); while (g_hash_table_iter_next(&iter, NULL, &value)) { - gint monitor = virt_viewer_app_get_initial_monitor_for_display(self, i); - app_window_try_fullscreen(self, VIRT_VIEWER_WINDOW(value), monitor); + app_window_try_fullscreen(self, VIRT_VIEWER_WINDOW(value), i); i++; } } @@ -880,8 +879,7 @@ virt_viewer_app_window_new(VirtViewerApp *self, gint nth) virt_viewer_window_set_zoom_level(window, virt_viewer_window_get_zoom_level(self->priv->main_window)); virt_viewer_app_set_nth_window(self, nth, window); if (self->priv->fullscreen) - app_window_try_fullscreen(self, window, - virt_viewer_app_get_initial_monitor_for_display(self, nth)); + app_window_try_fullscreen(self, window, nth); w = virt_viewer_window_get_window(window); g_signal_connect(w, "hide", G_CALLBACK(viewer_window_visible_cb), self); @@ -2104,7 +2102,7 @@ static void fullscreen_cb(gpointer key, gpointer user_data) { FullscreenOptions *options = (FullscreenOptions *)user_data; - gint nth = virt_viewer_app_get_initial_monitor_for_display(options->app, *(gint*)key); + gint nth = *(gint*)key; VirtViewerWindow *vwin = VIRT_VIEWER_WINDOW(value); g_debug("fullscreen display %d: %d", nth, options->fullscreen); |