|
|
03a6ff |
From 8cfeee4e3d82e4ae5227a0d4ae28cd273a188fbf Mon Sep 17 00:00:00 2001
|
|
|
03a6ff |
From: Pavel Grunt <pgrunt@redhat.com>
|
|
|
03a6ff |
Date: Tue, 20 Oct 2015 14:29:08 +0200
|
|
|
03a6ff |
Subject: [PATCH] app: Add helper for number of client monitors
|
|
|
03a6ff |
|
|
|
03a6ff |
(cherry picked from commit 4d6f730fce9818beb9f5d2639ffad256b9ede391)
|
|
|
03a6ff |
---
|
|
|
03a6ff |
src/virt-viewer-app.c | 17 +++++++++++------
|
|
|
03a6ff |
1 file changed, 11 insertions(+), 6 deletions(-)
|
|
|
03a6ff |
|
|
|
03a6ff |
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
|
|
|
03a6ff |
index 297c6f6..1638669 100644
|
|
|
03a6ff |
--- a/src/virt-viewer-app.c
|
|
|
03a6ff |
+++ b/src/virt-viewer-app.c
|
|
|
03a6ff |
@@ -300,12 +300,18 @@ virt_viewer_app_quit(VirtViewerApp *self)
|
|
|
03a6ff |
gtk_main_quit();
|
|
|
03a6ff |
}
|
|
|
03a6ff |
|
|
|
03a6ff |
+static gint
|
|
|
03a6ff |
+get_n_client_monitors()
|
|
|
03a6ff |
+{
|
|
|
03a6ff |
+ return gdk_screen_get_n_monitors(gdk_screen_get_default());
|
|
|
03a6ff |
+}
|
|
|
03a6ff |
+
|
|
|
03a6ff |
GList* virt_viewer_app_get_initial_displays(VirtViewerApp* self)
|
|
|
03a6ff |
{
|
|
|
03a6ff |
if (!self->priv->initial_display_map) {
|
|
|
03a6ff |
GList *l = NULL;
|
|
|
03a6ff |
gint i;
|
|
|
03a6ff |
- gint n = gdk_screen_get_n_monitors(gdk_screen_get_default());
|
|
|
03a6ff |
+ gint n = get_n_client_monitors();
|
|
|
03a6ff |
|
|
|
03a6ff |
for (i = 0; i < n; i++) {
|
|
|
03a6ff |
l = g_list_append(l, GINT_TO_POINTER(i));
|
|
|
03a6ff |
@@ -351,9 +357,8 @@ static void
|
|
|
03a6ff |
app_window_try_fullscreen(VirtViewerApp *self G_GNUC_UNUSED,
|
|
|
03a6ff |
VirtViewerWindow *win, gint nth)
|
|
|
03a6ff |
{
|
|
|
03a6ff |
- GdkScreen *screen = gdk_screen_get_default();
|
|
|
03a6ff |
gint monitor = virt_viewer_app_get_initial_monitor_for_display(self, nth);
|
|
|
03a6ff |
- if (monitor == -1 || monitor >= gdk_screen_get_n_monitors(screen)) {
|
|
|
03a6ff |
+ if (monitor == -1 || monitor >= get_n_client_monitors()) {
|
|
|
03a6ff |
g_debug("skipping fullscreen for display %d", nth);
|
|
|
03a6ff |
return;
|
|
|
03a6ff |
}
|
|
|
03a6ff |
@@ -365,7 +370,7 @@ app_window_try_fullscreen(VirtViewerApp *self G_GNUC_UNUSED,
|
|
|
03a6ff |
static GHashTable*
|
|
|
03a6ff |
virt_viewer_app_parse_monitor_mappings(gchar **mappings, gsize nmappings)
|
|
|
03a6ff |
{
|
|
|
03a6ff |
- gint nmonitors = gdk_screen_get_n_monitors(gdk_screen_get_default());
|
|
|
03a6ff |
+ gint nmonitors = get_n_client_monitors();
|
|
|
03a6ff |
GHashTable *displaymap = g_hash_table_new(g_direct_hash, g_direct_equal);
|
|
|
03a6ff |
GHashTable *monitormap = g_hash_table_new(g_direct_hash, g_direct_equal);
|
|
|
03a6ff |
int i = 0;
|
|
|
03a6ff |
@@ -953,7 +958,7 @@ display_show_hint(VirtViewerDisplay *display,
|
|
|
03a6ff |
win = virt_viewer_app_get_nth_window(self, nth);
|
|
|
03a6ff |
|
|
|
03a6ff |
if (self->priv->fullscreen &&
|
|
|
03a6ff |
- nth >= gdk_screen_get_n_monitors(gdk_screen_get_default())) {
|
|
|
03a6ff |
+ nth >= get_n_client_monitors()) {
|
|
|
03a6ff |
if (win)
|
|
|
03a6ff |
virt_viewer_window_hide(win);
|
|
|
03a6ff |
} else if (hint & VIRT_VIEWER_DISPLAY_SHOW_HINT_DISABLED) {
|
|
|
03a6ff |
@@ -1523,7 +1528,7 @@ virt_viewer_app_set_kiosk(VirtViewerApp *self, gboolean enabled)
|
|
|
03a6ff |
|
|
|
03a6ff |
/* create windows for each client monitor */
|
|
|
03a6ff |
for (i = g_list_length(self->priv->windows);
|
|
|
03a6ff |
- i < gdk_screen_get_n_monitors(gdk_screen_get_default()); i++) {
|
|
|
03a6ff |
+ i < get_n_client_monitors(); i++) {
|
|
|
03a6ff |
virt_viewer_app_window_new(self, i);
|
|
|
03a6ff |
}
|
|
|
03a6ff |
|