[virt-tools-list] [PATCH virt-viewer 1/2] resize: avoid rounding issues
Daniel P. Berrange
berrange at redhat.com
Tue Mar 11 16:03:01 UTC 2014
On Tue, Mar 11, 2014 at 04:38:45PM +0100, Marc-André Lureau wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>
> desktopWidth / desktopAspect
> = desktopWidth / ((double)desktopWidth / (double)desktopHeight)
> = desktopHeight
>
> This solves the display being blurry with some resolutions:
> https://bugzilla.redhat.com/show_bug.cgi?id=1056041
> ---
> src/virt-viewer-window.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> index 05d5fe7..08cacd5 100644
> --- a/src/virt-viewer-window.c
> +++ b/src/virt-viewer-window.c
> @@ -450,7 +450,7 @@ virt_viewer_window_resize(VirtViewerWindow *self, gboolean keep_win_size)
> height = desktopHeight;
> } else {
> width = desktopWidth;
> - height = desktopWidth / desktopAspect;
> + height = desktopHeight;
This isn't right - now this 'else' clause is not reducing the size
at all when it is too large to display, but the 'if' does.
I think they are actually both wrong and what it should have been
doing is this:
if (screenAspect > desktopAspect) {
height = fullscreen.height - 128;
width = height * desktopAspect;
} else {
width = fullscreen.width - 128;
height = width / desktopAspect;
}
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