[gtk: 3/11] gridview: Allow starting rubberband in empty space below last row




commit 1e9a36ffa8d198212cde130a021256fd142ba6c5
Author: Corey Berla <corey berla me>
Date:   Mon Jul 25 15:35:20 2022 -0700

    gridview: 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 gridview
    
    Fixes: #3462

 gtk/gtkgridview.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/gtk/gtkgridview.c b/gtk/gtkgridview.c
index c2a4abe9d2..869f4be206 100644
--- a/gtk/gtkgridview.c
+++ b/gtk/gtkgridview.c
@@ -441,6 +441,7 @@ gtk_grid_view_get_position_from_allocation (GtkListBase           *base,
     return FALSE;
 
   n_items = gtk_list_base_get_n_items (base);
+  along = CLAMP (along, 0, gtk_grid_view_compute_total_height (self) - 1);
   if (!gtk_grid_view_get_cell_at_y (self,
                                     along,
                                     &pos,


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