forked from AuroraMiddleware/gtk
gridview: Limit rectangle to gridview columns
The function gtk_grid_view_get_items_in_rect() erroneously calculates columns less than 0 and greater than n_columns when the user attempts to rubberband all the way to the left or right respectively. This causes the rubberband to persistent and creates unexpected behavior. Limit the rows to a minimum of 0 and maximum of n_columns - 1. Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3445
This commit is contained in:
parent
2bcae546b3
commit
c6f357e447
@ -484,8 +484,8 @@ gtk_grid_view_get_items_in_rect (GtkListBase *base,
|
||||
if (n_items == 0)
|
||||
return result;
|
||||
|
||||
first_column = floor (rect->x / self->column_width);
|
||||
last_column = floor ((rect->x + rect->width) / self->column_width);
|
||||
first_column = fmax (floor (rect->x / self->column_width), 0);
|
||||
last_column = fmin (floor ((rect->x + rect->width) / self->column_width), self->n_columns - 1);
|
||||
if (!gtk_grid_view_get_cell_at_y (self, rect->y, &first_row, NULL, NULL))
|
||||
first_row = rect->y < 0 ? 0 : n_items - 1;
|
||||
if (!gtk_grid_view_get_cell_at_y (self, rect->y + rect->height, &last_row, NULL, NULL))
|
||||
|
Loading…
Reference in New Issue
Block a user