gridview: Allow starting rubberband in empty space below last row
authorCorey Berla <corey@berla.me>
Mon, 25 Jul 2022 22:35:20 +0000 (15:35 -0700)
committerCorey Berla <corey@berla.me>
Tue, 26 Jul 2022 00:54:35 +0000 (17:54 -0700)
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

index c2a4abe9d28a521121b600fc97e404a79f760889..869f4be206d1212e5a1f80373008e72f898a71c3 100644 (file)
@@ -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,