[libhandy/tabs: 56/62] Oops




commit 445ae62c8170840fac3085a750ba59f2cdc85af6
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Sep 11 18:59:08 2020 +0500

    Oops

 src/hdy-tab-box.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/hdy-tab-box.c b/src/hdy-tab-box.c
index 1a03031e..64d8ac8e 100644
--- a/src/hdy-tab-box.c
+++ b/src/hdy-tab-box.c
@@ -1661,7 +1661,21 @@ insert_placeholder (HdyTabBox  *self,
     info = create_tab_info (self, page);
 
     info->reorder_ignore_bounds = TRUE;
-    self->placeholder_scroll_offset = hdy_tab_get_child_min_width (info->tab) / 2;
+
+    if (self->adjustment) {
+      gdouble lower, upper, page_size;
+
+      g_object_get (self->adjustment,
+                    "lower", &lower,
+                    "upper", &upper,
+                    "page-size", &page_size,
+                    NULL);
+
+      if (upper - lower > page_size)
+        self->placeholder_scroll_offset = hdy_tab_get_child_min_width (info->tab) / 2;
+      else
+        self->placeholder_scroll_offset = 0;
+    }
 
     index = calculate_placeholder_index (self, pos + self->placeholder_scroll_offset);
 


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