listview: Allow starting rubberband in empty space below last row
authorCorey Berla <corey@berla.me>
Tue, 26 Jul 2022 00:00:46 +0000 (17:00 -0700)
committerCorey Berla <corey@berla.me>
Tue, 26 Jul 2022 00:55:15 +0000 (17:55 -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 listview

gtk/gtklistview.c

index a939fdc52090ca4d4d43435bfe1ca1a7ca85931b..244633fb968ed90ea4357826bbfdaa71952a25de 100644 (file)
@@ -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;