[gtk: 9/11] listview: Allow starting rubberband in empty space below last row




commit d6fab1408a10f9bc431af6e4dacf73bfbb481fd6
Author: Corey Berla <corey berla me>
Date:   Mon Jul 25 17:00:46 2022 -0700

    listview: Allow starting rubberband in empty space below last row
    
    Rubberband does not work when initiated past the last row
    (warning is printed "Could not start rubberbanding: No item).
    
    Clamp y at the max height of the widgets in the listview

 gtk/gtklistview.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gtk/gtklistview.c b/gtk/gtklistview.c
index a939fdc520..244633fb96 100644
--- a/gtk/gtklistview.c
+++ b/gtk/gtklistview.c
@@ -428,6 +428,8 @@ gtk_list_view_get_position_from_allocation (GtkListBase           *base,
   if (across >= self->list_width)
     return FALSE;
 
+  along = CLAMP (along, 0, gtk_list_view_get_list_height (self) - 1);
+
   row = gtk_list_view_get_row_at_y (self, along, &remaining);
   if (row == NULL)
     return FALSE;


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