gridview: Fix rubberbanding from negative x coordinates
authorCorey Berla <corey@berla.me>
Wed, 14 Sep 2022 18:27:13 +0000 (11:27 -0700)
committerCorey Berla <corey@berla.me>
Wed, 14 Sep 2022 18:27:52 +0000 (11:27 -0700)
This is a follow-up to 1e9a36ffa8d198212cde130a021256fd142ba6c5. For GridView
we also need to make sure that we aren't rubberbanding below x=0 which
causes unexpected rubberbanding behavior.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2492
gtk/gtkgridview.c

index 17b0ca5a3690bf479bd21582105616490360a268..33c3bb76386776ff3f5c893d66bdc9c318303fae 100644 (file)
@@ -442,6 +442,8 @@ gtk_grid_view_get_position_from_allocation (GtkListBase           *base,
 
   n_items = gtk_list_base_get_n_items (base);
   along = CLAMP (along, 0, gtk_grid_view_compute_total_height (self) - 1);
+  across = across < 0 ? 0 : across;
+
   if (!gtk_grid_view_get_cell_at_y (self,
                                     along,
                                     &pos,