[virt-tools-list] [PATCH virt-viewer 2/4] display: make a function to queue the dirty display allocation trick
Marc-André Lureau
marcandre.lureau at gmail.com
Mon Mar 25 21:26:54 UTC 2013
---
src/virt-viewer-display.c | 23 +++++++++++++----------
src/virt-viewer-display.h | 1 +
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index 23f145f..e509092 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -503,11 +503,21 @@ void virt_viewer_display_get_desktop_size(VirtViewerDisplay *display,
}
+void virt_viewer_display_queue_resize(VirtViewerDisplay *display)
+{
+ VirtViewerDisplayPrivate *priv = display->priv;
+ GtkWidget *child = gtk_bin_get_child(GTK_BIN(display));
+
+ if (child && gtk_widget_get_visible(child)) {
+ priv->dirty = TRUE;
+ gtk_widget_queue_resize(GTK_WIDGET(display));
+ }
+}
+
void virt_viewer_display_set_zoom_level(VirtViewerDisplay *display,
guint zoom)
{
VirtViewerDisplayPrivate *priv = display->priv;
- GtkWidget *child = gtk_bin_get_child(GTK_BIN(display));
if (zoom < 10)
zoom = 10;
@@ -515,10 +525,7 @@ void virt_viewer_display_set_zoom_level(VirtViewerDisplay *display,
zoom = 400;
priv->zoom_level = zoom;
- if (child && gtk_widget_get_visible(child)) {
- priv->dirty = TRUE;
- gtk_widget_queue_resize(GTK_WIDGET(display));
- }
+ virt_viewer_display_queue_resize(display);
}
@@ -533,13 +540,9 @@ void virt_viewer_display_set_zoom(VirtViewerDisplay *display,
gboolean zoom)
{
VirtViewerDisplayPrivate *priv = display->priv;
- GtkWidget *child = gtk_bin_get_child(GTK_BIN(display));
priv->zoom = zoom;
- if (child && gtk_widget_get_visible(child)) {
- priv->dirty = TRUE;
- gtk_widget_queue_resize(GTK_WIDGET(display));
- }
+ virt_viewer_display_queue_resize(display);
}
diff --git a/src/virt-viewer-display.h b/src/virt-viewer-display.h
index 21d6fa4..17b44a9 100644
--- a/src/virt-viewer-display.h
+++ b/src/virt-viewer-display.h
@@ -122,6 +122,7 @@ void virt_viewer_display_release_cursor(VirtViewerDisplay *display);
void virt_viewer_display_close(VirtViewerDisplay *display);
void virt_viewer_display_set_enabled(VirtViewerDisplay *display, gboolean enabled);
gboolean virt_viewer_display_get_selectable(VirtViewerDisplay *display);
+void virt_viewer_display_queue_resize(VirtViewerDisplay *display);
G_END_DECLS
--
1.8.1.1.439.g50a6b54
More information about the virt-tools-list
mailing list