[virt-tools-list] [PATCH virt-viewer 2/2] RFC: resize: simplify and isolate fullscreen aspect logic

Daniel P. Berrange berrange at redhat.com
Wed Mar 12 17:24:31 UTC 2014


On Wed, Mar 12, 2014 at 07:51:21AM -0400, Marc-André Lureau wrote:
> 
> 
> ----- Original Message -----
> > On Tue, Mar 11, 2014 at 04:18:59PM +0000, Daniel P. Berrange wrote:
> > > 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
> > 
> > BTW, when RHEL-7.0 is finally released I suggest that we could /
> > should drop support for GTK-2.0, at which point this discussion
> > point becomes moot, since GTK-3.0 will already do the right thing
> > itself
> 
> We would still welcome a solution for RHEL6.

What about the fix I suggested elsewhere in the thread

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;
         }
     } else {
         width = desktopWidth;


if that's not sufficient, then perhaps we should just remove
the '-128' fudge factor, so we're not trying to second guess
panel size.

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