[virt-tools-list] [PATCH virt-viewer 2/3] virt-viewer-window: Add helper for getting dimensions of top menu

Pavel Grunt pgrunt at redhat.com
Thu May 14 14:36:33 UTC 2015


It will be used in following commit
---
 src/virt-viewer-window.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 004eafd..0ed4b5f 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -1525,9 +1525,7 @@ virt_viewer_window_set_kiosk(VirtViewerWindow *self, gboolean enabled)
 }
 
 static void
-virt_viewer_window_get_minimal_dimensions(VirtViewerWindow *self,
-                                          guint *width,
-                                          guint *height)
+virt_viewer_window_top_menu_dimensions(VirtViewerWindow *self, guint *width, guint *height)
 {
     GtkRequisition req;
     GtkWidget *top_menu;
@@ -1538,11 +1536,23 @@ virt_viewer_window_get_minimal_dimensions(VirtViewerWindow *self,
 #else
     gtk_widget_get_preferred_size(top_menu, &req, NULL);
 #endif
+    if (width)
+        *width = req.width;
+    if (height)
+        *height = req.height;
+}
+
+static void
+virt_viewer_window_get_minimal_dimensions(VirtViewerWindow *self,
+                                          guint *width,
+                                          guint *height)
+{
     /* minimal dimensions of the window are the maximum of dimensions of the top-menu
      * and minimal dimension of the display
      */
+    virt_viewer_window_top_menu_dimensions(self, width, NULL);
     *height = MIN_DISPLAY_HEIGHT;
-    *width = MAX(MIN_DISPLAY_WIDTH, req.width);
+    *width = MAX(MIN_DISPLAY_WIDTH, *width);
 }
 
 /**
-- 
2.4.0




More information about the virt-tools-list mailing list