[virt-tools-list] [PATCH 1/2] virt-viewer-display-spice: Pass proper x and y coordinates for monitors
Hans de Goede
hdegoede at redhat.com
Fri Jan 18 16:23:58 UTC 2013
Pass something more sensible then +0+0 as coordinates for the monitor
to spice-gtk. Note that in windowed mode the coordinates passed do not
take the menu + toolbar into account. Just passing the toplevel window
coordinates is good enough to make spice-gtk's monitor alignment code
work properly.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
src/virt-viewer-display-spice.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index 22fde46..e689d9d 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -189,6 +189,7 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
gdouble dw = allocation->width, dh = allocation->height;
guint zoom = 100;
guint nth;
+ gint x, y;
if (virt_viewer_display_get_auto_resize(VIRT_VIEWER_DISPLAY(self)) == FALSE)
return;
@@ -202,8 +203,13 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
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);
+ x = monitor.x;
+ 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 (virt_viewer_display_get_zoom(VIRT_VIEWER_DISPLAY(self))) {
@@ -217,7 +223,7 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
if (self->priv->auto_resize != AUTO_RESIZE_NEVER)
spice_main_set_display(get_main(VIRT_VIEWER_DISPLAY(self)),
- nth, 0, 0, dw, dh);
+ nth, x, y, dw, dh);
if (self->priv->auto_resize == AUTO_RESIZE_FULLSCREEN)
self->priv->auto_resize = AUTO_RESIZE_NEVER;
}
--
1.8.0.2
More information about the virt-tools-list
mailing list