|
|
4ab194 |
From fcf77734a86732417142e81140f681233a4ef0da Mon Sep 17 00:00:00 2001
|
|
|
4ab194 |
From: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
4ab194 |
Date: Wed, 11 Jun 2014 13:09:30 -0500
|
|
|
4ab194 |
Subject: [PATCH] Fix tiny window when resetting zoom factor in gtk2 build
|
|
|
4ab194 |
|
|
|
4ab194 |
rhbz#1104064 had a couple of symptoms. The first was fixed in
|
|
|
4ab194 |
6edde57862ac30e74ce6412c93a2fa925ae4ea67.
|
|
|
4ab194 |
|
|
|
4ab194 |
The second symptom is that displays could also become tiny when clicking 'View >
|
|
|
4ab194 |
Zoom > Normal Size'. This was because VirtViewerDisplay returned early from
|
|
|
4ab194 |
_display_set_zoom_level() if the zoom level was being set to the current zoom
|
|
|
4ab194 |
setting. However, the calling function (_window_set_zoom_level()) also tries to
|
|
|
4ab194 |
queue a resize event for itself after setting the zoom level on the display. If
|
|
|
4ab194 |
the display doesn't queue a resize event for itself, its size request will only
|
|
|
4ab194 |
be 50x50 during the window resize negotiation. This causes the display to become
|
|
|
4ab194 |
tiny and zoomed out. Queueing a resize on the display widget ensures that it
|
|
|
4ab194 |
will request the proper size during the next allocation.
|
|
|
4ab194 |
---
|
|
|
4ab194 |
src/virt-viewer-display.c | 9 ++++++++-
|
|
|
4ab194 |
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
4ab194 |
|
|
|
4ab194 |
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
|
|
|
4ab194 |
index 48b7090..52e6962 100644
|
|
|
4ab194 |
--- a/src/virt-viewer-display.c
|
|
|
4ab194 |
+++ b/src/virt-viewer-display.c
|
|
|
4ab194 |
@@ -605,12 +605,19 @@ void virt_viewer_display_set_zoom_level(VirtViewerDisplay *display,
|
|
|
4ab194 |
if (zoom > MAX_ZOOM_LEVEL)
|
|
|
4ab194 |
zoom = MAX_ZOOM_LEVEL;
|
|
|
4ab194 |
|
|
|
4ab194 |
+ // For the gtk2 build, we need to queue a resize even if the zoom level
|
|
|
4ab194 |
+ // hasn't changed. This is due to the fact that VirtViewerWindow will queue
|
|
|
4ab194 |
+ // a resize event for itself immediately after calling this function (in
|
|
|
4ab194 |
+ // order to shrink the window to fit the new display size if necessary). If
|
|
|
4ab194 |
+ // we don't queue a resize here, the window will become tiny because we will
|
|
|
4ab194 |
+ // only request 50x50 during the window resize
|
|
|
4ab194 |
+ virt_viewer_display_queue_resize(display);
|
|
|
4ab194 |
+
|
|
|
4ab194 |
if (priv->zoom_level == zoom)
|
|
|
4ab194 |
return;
|
|
|
4ab194 |
|
|
|
4ab194 |
priv->zoom_level = zoom;
|
|
|
4ab194 |
|
|
|
4ab194 |
- virt_viewer_display_queue_resize(display);
|
|
|
4ab194 |
g_object_notify(G_OBJECT(display), "zoom-level");
|
|
|
4ab194 |
}
|
|
|
4ab194 |
|