[libadwaita/wip/exalm/tab-style: 3/5] tab-box: Never scroll on click if the tab bar doesn't scroll




commit 102e0391f85bcd484d115f744a095db953702b29
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Apr 6 16:31:13 2022 +0400

    tab-box: Never scroll on click if the tab bar doesn't scroll
    
    We'll remove the spacing at the end for pinned tabs later, and the last
    pinned tab will fail this check.

 src/adw-tab-box.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/adw-tab-box.c b/src/adw-tab-box.c
index a9cc4f20..3f3be10b 100644
--- a/src/adw-tab-box.c
+++ b/src/adw-tab-box.c
@@ -2714,10 +2714,11 @@ handle_click (AdwTabBox  *self,
   if (self->adjustment) {
     int pos = get_tab_position (self, info);
     double value = gtk_adjustment_get_value (self->adjustment);
+    double upper = gtk_adjustment_get_upper (self->adjustment);
     double page_size = gtk_adjustment_get_page_size (self->adjustment);
 
-    if (pos - SPACING < value ||
-        pos + info->width + SPACING > value + page_size) {
+    if (value + page_size < upper &&
+        (pos - SPACING < value || pos + SPACING + info->width > value + page_size)) {
       gtk_gesture_set_state (gesture, GTK_EVENT_SEQUENCE_CLAIMED);
 
       scroll_to_tab (self, info, SCROLL_ANIMATION_DURATION);


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