[virt-tools-list] [PATCH virt-viewer 2/4] virt-viewer-display: Use MIN_DISPLAY_WIDTH/HEIGHT instead of numbers

Pavel Grunt pgrunt at redhat.com
Mon Mar 30 20:17:36 UTC 2015


---
 src/virt-viewer-display.c | 8 ++++----
 src/virt-viewer-display.h | 3 +++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index 50245cb..829ee07 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -425,8 +425,8 @@ virt_viewer_display_size_request(GtkWidget *widget,
     if (priv->dirty || !priv->size_request_once) {
         virt_viewer_display_get_preferred_size(display, requisition);
     } else {
-        requisition->width = 50;
-        requisition->height = 50;
+        requisition->width = MIN_DISPLAY_WIDTH;
+        requisition->height = MIN_DISPLAY_HEIGHT;
     }
 
     priv->size_request_once = TRUE;
@@ -460,7 +460,7 @@ static void virt_viewer_display_get_preferred_width(GtkWidget *widget,
     VirtViewerDisplayPrivate *priv = display->priv;
     int border_width = gtk_container_get_border_width(GTK_CONTAINER(widget));
 
-    *minwidth = 50 + 2 * border_width;
+    *minwidth = MIN_DISPLAY_WIDTH + 2 * border_width;
 
     if (priv->zoom) {
         *defwidth = round(priv->desktopWidth * priv->zoom_level / (double) NORMAL_ZOOM_LEVEL) +
@@ -479,7 +479,7 @@ static void virt_viewer_display_get_preferred_height(GtkWidget *widget,
     VirtViewerDisplayPrivate *priv = display->priv;
     int border_height = gtk_container_get_border_width(GTK_CONTAINER(widget));
 
-    *minheight = 50 + 2 * border_height;
+    *minheight = MIN_DISPLAY_HEIGHT + 2 * border_height;
 
     if (priv->zoom) {
         *defheight = round(priv->desktopHeight * priv->zoom_level / (double) NORMAL_ZOOM_LEVEL) +
diff --git a/src/virt-viewer-display.h b/src/virt-viewer-display.h
index b1133e8..9829617 100644
--- a/src/virt-viewer-display.h
+++ b/src/virt-viewer-display.h
@@ -29,6 +29,9 @@
 
 G_BEGIN_DECLS
 
+#define MIN_DISPLAY_WIDTH 50
+#define MIN_DISPLAY_HEIGHT 50
+
 #define VIRT_VIEWER_TYPE_DISPLAY virt_viewer_display_get_type()
 
 #define VIRT_VIEWER_DISPLAY(obj)                                        \
-- 
2.3.4




More information about the virt-tools-list mailing list