[libhandy] header-bar: Stop centering an expanded title when loose



commit c36b4a341a93a288685dfb2fd8a68a874e878baf
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Apr 12 12:48:16 2021 +0200

    header-bar: Stop centering an expanded title when loose
    
    This stops allocating the same extra space on each side of an expanded
    title with the loose centering policy, letting a side grow bigger than
    the other if more space is available, making it match the behavior of
    GtkHeaderBar. The strict centering policy is there to handle other
    cases.
    
    Fixes https://gitlab.gnome.org/GNOME/libhandy/-/issues/431

 src/hdy-header-bar.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
---
diff --git a/src/hdy-header-bar.c b/src/hdy-header-bar.c
index 32833006..e07f31a8 100644
--- a/src/hdy-header-bar.c
+++ b/src/hdy-header-bar.c
@@ -1154,7 +1154,6 @@ get_loose_centering_allocations (HdyHeaderBar   *self,
   gint side_free_space[2] = { 0 };
   gint center_free_space[2] = { 0 };
   gint nexpand_children[2] = { 0 };
-  gint center_free_space_min;
   GList *l;
   gint i;
   Child *child;
@@ -1230,7 +1229,7 @@ get_loose_centering_allocations (HdyHeaderBar   *self,
    * that space for the expanded children.
    *
    * If the title itself is expanded, then it gets half the spoils from each
-   * side.
+   * side, or all the spoil of that side if no child is expanded there.
    */
   for (packing = GTK_PACK_START; packing <= GTK_PACK_END; packing++) {
     side_free_space[packing] = MIN (MAX (allocation->width / 2 - title_size.natural_size / 2 - 
decoration_width[packing] - side[packing], 0), width);
@@ -1239,9 +1238,7 @@ get_loose_centering_allocations (HdyHeaderBar   *self,
         side_free_space[packing] / 2 :
         side_free_space[packing];
   }
-  center_free_space_min = MIN (center_free_space[0], center_free_space[1]);
   for (packing = GTK_PACK_START; packing <= GTK_PACK_END; packing++) {
-    center_free_space[packing] = center_free_space_min;
     side_free_space[packing] -= center_free_space[packing];
     width -= side_free_space[packing];
 


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