[virt-tools-list] [PATCH virt-viewer] Use monitor geometry, not screen size

Marc-André Lureau marcandre.lureau at gmail.com
Wed Dec 5 17:37:39 UTC 2012


In a recent commit, 3bb6f5ec805ecfe78eba6d4d98e3ffcab195273a, I
introduced a regression: going fullscreen would no longer match client
and guest resolution correctly.

A GdkScreen is not necessarily the physical screen monitor size.
Lookup the physical monitor size using
gdk_screen_get_monitor_geometry().

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=881020
---
 src/virt-viewer-display-spice.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index 753e369..8ad770a 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -197,9 +197,13 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
         return;
 
     if (self->priv->auto_resize == AUTO_RESIZE_FULLSCREEN) {
+        GdkRectangle monitor;
         GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(self));
-        dw = gdk_screen_get_width(screen);
-        dh = gdk_screen_get_height(screen);
+        GdkWindow *window = gtk_widget_get_root_window(GTK_WIDGET(self));
+        int n = gdk_screen_get_monitor_at_window(screen, window);
+        gdk_screen_get_monitor_geometry(screen, n, &monitor);
+        dw = monitor.width;
+        dh = monitor.height;
     }
 
     if (virt_viewer_display_get_zoom(VIRT_VIEWER_DISPLAY(self))) {
-- 
1.7.11.7




More information about the virt-tools-list mailing list