[virt-tools-list] [PATCH virt-viewer] Do not resize window to minimum when toggling auto-resize
Marc-André Lureau
marcandre.lureau at gmail.com
Tue Oct 16 18:42:14 UTC 2012
The virt_viewer_display_idle() will queue a resize event that will
result in display size requisition of 50x50. If we later resize the
window to 1x1 in virt_viewer_window_resize() we end up with a tiny
window.
It is legitimate not to force that 1x1 window resize when toggling the
option. After the rest of the logic in virt_viewer_window_resize(), if
the remote desktop ends up being resize, that will trigger another
virt_viewer_set_desktop_size() and finally change the window size
appropriately.
https://bugzilla.redhat.com/show_bug.cgi?id=856610
---
src/virt-viewer-window.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 7c6e41f..2aafe94 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -61,7 +61,7 @@ void virt_viewer_window_menu_view_release_cursor(GtkWidget *menu, VirtViewerWind
/* Internal methods */
static void virt_viewer_window_enable_modifiers(VirtViewerWindow *self);
static void virt_viewer_window_disable_modifiers(VirtViewerWindow *self);
-static void virt_viewer_window_resize(VirtViewerWindow *self);
+static void virt_viewer_window_resize(VirtViewerWindow *self, gboolean keep_win_size);
static void virt_viewer_window_toolbar_setup(VirtViewerWindow *self);
static GtkMenu* virt_viewer_window_get_keycombo_menu(VirtViewerWindow *self);
@@ -346,7 +346,7 @@ virt_viewer_window_desktop_resize(VirtViewerDisplay *display G_GNUC_UNUSED,
self->priv->desktop_resize_pending = TRUE;
return;
}
- virt_viewer_window_resize(self);
+ virt_viewer_window_resize(self, FALSE);
}
@@ -403,7 +403,7 @@ virt_viewer_window_menu_view_zoom_reset(GtkWidget *menu G_GNUC_UNUSED,
* scale down to fit, maintaining aspect ratio
*/
static void
-virt_viewer_window_resize(VirtViewerWindow *self)
+virt_viewer_window_resize(VirtViewerWindow *self, gboolean keep_win_size)
{
GdkRectangle fullscreen;
GdkScreen *screen;
@@ -423,7 +423,8 @@ virt_viewer_window_resize(VirtViewerWindow *self)
return;
}
- gtk_window_resize(GTK_WINDOW(priv->window), 1, 1);
+ if (!keep_win_size)
+ gtk_window_resize(GTK_WINDOW(priv->window), 1, 1);
virt_viewer_display_get_desktop_size(VIRT_VIEWER_DISPLAY(priv->display),
&desktopWidth, &desktopHeight);
@@ -741,7 +742,7 @@ virt_viewer_window_menu_view_resize(GtkWidget *menu,
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu))) {
priv->auto_resize = TRUE;
- virt_viewer_window_resize(self);
+ virt_viewer_window_resize(self, TRUE);
} else {
priv->auto_resize = FALSE;
}
@@ -1071,7 +1072,7 @@ virt_viewer_window_show(VirtViewerWindow *self)
virt_viewer_display_set_enabled(self->priv->display, TRUE);
if (self->priv->desktop_resize_pending) {
- virt_viewer_window_resize(self);
+ virt_viewer_window_resize(self, FALSE);
self->priv->desktop_resize_pending = FALSE;
}
}
--
1.7.11.7
More information about the virt-tools-list
mailing list