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
This commit is contained in:
Ray Strode 2016-06-23 16:31:24 -04:00
parent 8430be75ed
commit e0bebba470

View File

@ -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;