[gtk+] headerbar: simplify calculation in size allocation code



commit e0bebba4701395b8db6027bd8626e879a4cde90d
Author: Ray Strode <rstrode redhat com>
Date:   Thu Jun 23 16:31:24 2016 -0400

    headerbar: simplify calculation in size allocation code
    
    There's some extraneous MIN() calls that have predetermined answers.
    
    This commit drops them and then simplifies a few redudant checks into
    one MIN call.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724332

 gtk/gtkheaderbar.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index fb427d1..c16cf8a 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -1133,14 +1133,7 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
   child_allocation.y = allocation->y;
   child_allocation.height = allocation->height;
 
-  width = MAX (side[0], side[1]);
-
-  if (allocation->width - 2 * width >= title_natural_size)
-    child_size = MIN (title_natural_size, allocation->width - 2 * width);
-  else if (allocation->width - side[0] - side[1] >= title_natural_size)
-    child_size = MIN (title_natural_size, allocation->width - side[0] - side[1]);
-  else
-    child_size = allocation->width - side[0] - side[1];
+  child_size = MIN (allocation->width - side[0] - side[1], title_natural_size);
 
   child_allocation.x = allocation->x + (allocation->width - child_size) / 2;
   child_allocation.width = child_size;


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