mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2026-01-06 16:45:14 +00:00
spice: avoid rounding issues when scaling up display
Fix some unwanted guest resize due to rounding issues (at least when scaling up) We may want to save the original remote desktop size, instead of always checking widget requisition. That way zooming shouldn't resize guest at all, but it seems tricky to handle that special case vs user window resize that should trigger guest resize. https://bugzilla.redhat.com/show_bug.cgi?id=856678
This commit is contained in:
parent
143bc8a33f
commit
435a542de2
@ -24,6 +24,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <spice-audio.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
@ -191,8 +192,8 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
|
||||
if (virt_viewer_display_get_zoom(VIRT_VIEWER_DISPLAY(self))) {
|
||||
zoom = virt_viewer_display_get_zoom_level(VIRT_VIEWER_DISPLAY(self));
|
||||
|
||||
dw /= ((double)zoom / 100.0);
|
||||
dh /= ((double)zoom / 100.0);
|
||||
dw = round(dw * 100 / zoom);
|
||||
dh = round(dh * 100 / zoom);
|
||||
}
|
||||
|
||||
g_object_get(self, "nth-display", &nth, NULL);
|
||||
|
||||
@ -354,8 +354,8 @@ virt_viewer_display_size_request(GtkWidget *widget,
|
||||
|
||||
if (priv->dirty) {
|
||||
if (priv->zoom) {
|
||||
requisition->width += priv->desktopWidth * priv->zoom_level / 100;
|
||||
requisition->height += priv->desktopHeight * priv->zoom_level / 100;
|
||||
requisition->width += round(priv->desktopWidth * priv->zoom_level / 100.0);
|
||||
requisition->height += round(priv->desktopHeight * priv->zoom_level / 100.0);
|
||||
} else {
|
||||
requisition->width += priv->desktopWidth;
|
||||
requisition->height += priv->desktopHeight;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user