[virt-tools-list] [PATCH virt-viewer 2/2] RFC: resize: simplify and isolate fullscreen aspect logic
Daniel P. Berrange
berrange at redhat.com
Tue Mar 11 16:18:59 UTC 2014
On Tue, Mar 11, 2014 at 04:38:46PM +0100, Marc-André Lureau wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>
> Tbh, I don't understand the purpose of this code (both spice and vnc
> widgets keep the aspect ration), I would welcome some comments. I am not
> sure why we check fullscreen display resolution in window mode either,
> so I moved the code in if (priv->fullscreen)
>
> If it's possible, this code should be removed (surrouding with if 0
> doesn't seem to change anything here with spice or vnc). Please help me
> to understand that logic.
> ---
> src/virt-viewer-window.c | 63 +++++++++++++++++++++++-------------------------
> 1 file changed, 30 insertions(+), 33 deletions(-)
When the guest resolution exceeds the host resolution we need to scale
to ensure we can see the full extent of the guest desktop. If I remove
this code, then as you say, there doesn't appear to be any functional
impact. When the guest resizes, the window resizes sensibly every time,
scaling when too large.
The caveat is that this only works corretly with GTK-3.0 If I build
virt-viewer for GTK-2.0 then the window size isn't limited by GTK
and exceeds the size of the desktop. So this code is basically
working around a limitation fo GTK-2.0
That said, this is stil broken as I mentioned wrt your previous
patch. I tested this patch which appeared to make it work properly
with GTK-2
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 05d5fe7..c2551d4 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -446,11 +446,11 @@ virt_viewer_window_resize(VirtViewerWindow *self, gboolean keep_win_size)
/* Doesn't fit native res, so go as large as possible
maintaining aspect ratio */
if (screenAspect > desktopAspect) {
- width = desktopHeight * desktopAspect;
- height = desktopHeight;
+ width = (fullscreen.height - 128) * desktopAspect;
+ height = (fullscreen.height - 128);
} else {
- width = desktopWidth;
- height = desktopWidth / desktopAspect;
+ width = (fullscreen.width - 128);
+ height = (fullscreen.width - 128) / desktopAspect;
}
the problem is this hardcoded 128 is no longer valid with a typical
GNOME shell world, since there's no bottom bar taking up space anymore.
It was never really all that valid in GNOME panel world either to be
honest. I never found any way to detect what portion of screen real
estate is consumed by fixed panels from the window manager, which is
what this really needed.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the virt-tools-list
mailing list