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

Christophe Fergeau cfergeau at redhat.com
Thu Dec 6 10:29:28 UTC 2012


On Wed, Dec 05, 2012 at 06:37:39PM +0100, Marc-André Lureau wrote:
> 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));

Why _get_root_window rather than _get_window?

Patch looks good apart from this.

Christophe

> +        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
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20121206/dc1d2bc1/attachment.sig>


More information about the virt-tools-list mailing list