[gtk+/wip/csd] window: Refactor allocation code to ensure more consistent results



commit 8d308d5e4bb9c1f24b1ce746d5c2bfa8b434d8e0
Author: Rob Bradford <rob linux intel com>
Date:   Thu Jan 31 16:02:31 2013 +0000

    window: Refactor allocation code to ensure more consistent results

 gtk/gtkwindow.c |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 2afb65a..568f61b 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5722,7 +5722,16 @@ _gtk_window_set_allocation (GtkWindow     *window,
 
   border_width = gtk_container_get_border_width (GTK_CONTAINER (window));
 
-  if (priv->title_box && gtk_widget_get_visual(priv->title_box))
+  /* Apply border width */
+  child_allocation = *allocation;
+  child_allocation.x += border_width;
+  child_allocation.y += border_width;
+  child_allocation.width -= border_width * 2;
+  child_allocation.height -= border_width * 2;
+
+  if (priv->client_decorated && priv->decorated &&
+      priv->title_box &&
+      gtk_widget_get_visual(priv->title_box))
     {
       GtkAllocation title_allocation;
 
@@ -5739,15 +5748,20 @@ _gtk_window_set_allocation (GtkWindow     *window,
       gtk_widget_size_allocate (priv->title_box, &title_allocation);
     }
 
-  child_allocation.x = border_width + priv->window_border.left;
-  child_allocation.y =
-    border_width + priv->window_border.top + priv->title_height +
-    priv->title_border.top + priv->title_border.bottom;
-  child_allocation.width =
-    MAX (1, (gint)allocation->width - child_allocation.x * 2);
-  child_allocation.height =
-    MAX (1, (gint)allocation->height -
-         child_allocation.y - border_width - priv->window_border.bottom);
+  if (priv->client_decorated && priv->decorated)
+    {
+      child_allocation.x += priv->window_border.left;
+
+      child_allocation.y += priv->window_border.top +
+                            priv->title_height +
+                            priv->title_border.top +
+                            priv->title_border.bottom;
+
+      child_allocation.width -= (priv->window_border.left +
+                                 priv->window_border.right);
+      child_allocation.height -= (child_allocation.y +
+                                  priv->window_border.bottom);
+    }
 
   if (gtk_widget_get_realized (widget))
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]