diff options
author | Jonathon Jongsma <jjongsma@redhat.com> | 2014-06-11 13:09:30 -0500 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@redhat.com> | 2014-06-11 15:17:53 -0500 |
commit | b707b4524ff12ae1c2c3deff0e8c3f0d098f0503 (patch) | |
tree | de2d6df4b2fab7f2495d40fe53c3b9ea761ca3b5 /src/virt-viewer-display.c | |
parent | d1b2840997f47f0c39c16b6ffc7c2ae5e7934e01 (diff) | |
download | virt-viewer-b707b4524ff12ae1c2c3deff0e8c3f0d098f0503.tar.gz virt-viewer-b707b4524ff12ae1c2c3deff0e8c3f0d098f0503.tar.xz virt-viewer-b707b4524ff12ae1c2c3deff0e8c3f0d098f0503.zip |
Fix tiny window when resetting zoom factor in gtk2 build
rhbz#1104064 had a couple of symptoms. The first was fixed in
6edde57862ac30e74ce6412c93a2fa925ae4ea67.
The second symptom is that displays could also become tiny when clicking 'View >
Zoom > Normal Size'. This was because VirtViewerDisplay returned early from
_display_set_zoom_level() if the zoom level was being set to the current zoom
setting. However, the calling function (_window_set_zoom_level()) also tries to
queue a resize event for itself after setting the zoom level on the display. If
the display doesn't queue a resize event for itself, its size request will only
be 50x50 during the window resize negotiation. This causes the display to become
tiny and zoomed out. Queueing a resize on the display widget ensures that it
will request the proper size during the next allocation.
Diffstat (limited to 'src/virt-viewer-display.c')
-rw-r--r-- | src/virt-viewer-display.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c index fc38f59..c5170c4 100644 --- a/src/virt-viewer-display.c +++ b/src/virt-viewer-display.c @@ -605,12 +605,19 @@ void virt_viewer_display_set_zoom_level(VirtViewerDisplay *display, if (zoom > MAX_ZOOM_LEVEL) zoom = MAX_ZOOM_LEVEL; + // For the gtk2 build, we need to queue a resize even if the zoom level + // hasn't changed. This is due to the fact that VirtViewerWindow will queue + // a resize event for itself immediately after calling this function (in + // order to shrink the window to fit the new display size if necessary). If + // we don't queue a resize here, the window will become tiny because we will + // only request 50x50 during the window resize + virt_viewer_display_queue_resize(display); + if (priv->zoom_level == zoom) return; priv->zoom_level = zoom; - virt_viewer_display_queue_resize(display); g_object_notify(G_OBJECT(display), "zoom-level"); } |