[virt-tools-list] [PATCH 3/5] virt-viewer-display-spice: Pass proper x and y coordinates in windowed mode

Hans de Goede hdegoede at redhat.com
Wed Feb 6 13:39:21 UTC 2013


This stops monitor order from the guest from being re-arranged in multi-
monitor setups when switching between fullscreen and windowed mode.

Note this relies on spice-gtk's auto monitor alignment code, which currently
does not properly handle setups where there is more then 1 row of monitors,
ie 2x1 - 5x1 will work fine, but 2x2 will not.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/virt-viewer-display-spice.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index d15f415..1e17ca5 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -209,6 +209,13 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
         y = monitor.y;
         dw = monitor.width;
         dh = monitor.height;
+    } else {
+        GtkWidget *top = gtk_widget_get_toplevel(GTK_WIDGET(self));
+        gtk_window_get_position(GTK_WINDOW(top), &x, &y);
+        if (x < 0)
+            x = 0;
+        if (y < 0)
+            y = 0;
     }
 
     if (virt_viewer_display_get_zoom(VIRT_VIEWER_DISPLAY(self))) {
-- 
1.8.1




More information about the virt-tools-list mailing list