[virt-tools-list] [PATCH 1/2] virt-viewer-display-spice: Pass proper x and y coordinates for monitors

Marc-André Lureau mlureau at redhat.com
Sat Jan 19 02:51:57 UTC 2013


Hi

----- Mensaje original -----
> 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;

It clearly makes sense in fullscreen / monitor.

> +    } else {
> +        GtkWidget *top = gtk_widget_get_toplevel(GTK_WIDGET(self));
> +        gtk_window_get_position(GTK_WINDOW(top), &x, &y);

However, I really don't think it's a good idea to reorder monitors depending on their window position, even if it may be funny, just 5 sec. ;)




More information about the virt-tools-list mailing list