From 71419bfa71b435ee0374d491dcec81911c75394b Mon Sep 17 00:00:00 2001
From: Jonathon Jongsma <jjongsma@redhat.com>
Date: Fri, 12 Oct 2018 14:11:11 -0500
Subject: [PATCH virt-viewer] Fullscreen displays on wrong monitors in Wayland
In fullscreen mode, we attempt to enable a guest display for each client
monitor and then place a fullscreen window for each display on the
appropriate monitor. Previously, we were using gtk_window_move() to move
the window to the proper monitor, and then calling
gtk_window_fullscreen() to enter fullscreen mode on that monitor.
However, under wayland, gtk_window_move() no longer has any effect for
toplevel windows, so all displays were showing up on top of eachother on
the same client monitor.
Fortunately, Gtk+ 3.18 added a new gtk_window_fullscreen_on_monitor()
API that works on Wayland. In theory this allows us to remove the call
to gtk_window_move() from the code. But to avoid potentially changing
behavior on xorg or older systems, I left the existing logic.
This requires a dependency bump for gtk+ from 3.12 to 3.18. Gtk 3.18 is
provided by the following distributions (or newer):
- RHEL 7.4
- Fedora 23
- Ubuntu 16.04LTS
Resolves: rhbz#1584561
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
---
configure.ac | 4 ++--
src/virt-viewer-window.c | 8 +++++++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9b52eb4..e349e62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,8 +17,8 @@ GLIB2_REQUIRED="2.38"
GLIB2_ENCODED_VERSION="GLIB_VERSION_2_38"
# Keep these two definitions in agreement.
-GTK_REQUIRED="3.12"
-GTK_ENCODED_VERSION="GDK_VERSION_3_12"
+GTK_REQUIRED="3.18"
+GTK_ENCODED_VERSION="GDK_VERSION_3_18"
LIBXML2_REQUIRED="2.6.0"
LIBVIRT_REQUIRED="0.10.0"
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 241b627..aace0f8 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -525,7 +525,13 @@ virt_viewer_window_enter_fullscreen(VirtViewerWindow *self, gint monitor)
}
virt_viewer_window_move_to_monitor(self);
- gtk_window_fullscreen(GTK_WINDOW(priv->window));
+ if (monitor == -1) {
+ // just go fullscreen on the current monitor
+ gtk_window_fullscreen(GTK_WINDOW(priv->window));
+ } else {
+ gtk_window_fullscreen_on_monitor(GTK_WINDOW(priv->window),
+ gdk_screen_get_default(), monitor);
+ }
}
#define MAX_KEY_COMBO 4
--
2.17.2