{
GtkGridView *self = GTK_GRID_VIEW (base);
guint first_row, last_row, first_column, last_column;
- GdkRectangle bounds;
GtkBitset *result;
result = gtk_bitset_new_empty ();
- /* limit rect to the region that actually overlaps items */
- gtk_list_item_manager_get_tile_bounds (self->item_manager, &bounds);
- if (!gdk_rectangle_intersect (&bounds, rect, &bounds))
- return result;
-
- first_column = fmax (floor (bounds.x / self->column_width), 0);
- last_column = fmin (floor ((bounds.x + bounds.width) / self->column_width), self->n_columns - 1);
+ 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);
/* match y = 0 here because we care about the rows, not the cells */
- if (!gtk_grid_view_get_position_from_allocation (base, 0, bounds.y, &first_row, NULL))
+ if (!gtk_grid_view_get_position_from_allocation (base, 0, rect->y, &first_row, NULL))
g_return_val_if_reached (result);
- if (!gtk_grid_view_get_position_from_allocation (base, 0, bounds.y + bounds.height - 1, &last_row, NULL))
+ if (!gtk_grid_view_get_position_from_allocation (base, 0, rect->y + rect->height - 1, &last_row, NULL))
g_return_val_if_reached (result);
gtk_bitset_add_rectangle (result,
gtk_list_base_get_items_in_rect (GtkListBase *self,
const GdkRectangle *rect)
{
- return GTK_LIST_BASE_GET_CLASS (self)->get_items_in_rect (self, rect);
+ GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
+ GdkRectangle bounds;
+
+ gtk_list_item_manager_get_tile_bounds (priv->item_manager, &bounds);
+ if (!gdk_rectangle_intersect (&bounds, rect, &bounds))
+ return gtk_bitset_new_empty ();
+
+ return GTK_LIST_BASE_GET_CLASS (self)->get_items_in_rect (self, &bounds);
}
static gboolean
g_print (" => %u widgets in %u list rows\n", n_widgets, n_list_rows);
}
-static int
-gtk_list_view_get_list_height (GtkListView *self)
-{
- GtkListTile *tile;
- GtkListTileAugment *aug;
-
- tile = gtk_list_item_manager_get_root (self->item_manager);
- if (tile == NULL)
- return 0;
-
- aug = gtk_list_tile_get_augment (self->item_manager, tile);
- return aug->area.height;
-}
-
static GtkListTile *
gtk_list_view_split (GtkListBase *base,
GtkListTile *tile,
result = gtk_bitset_new_empty ();
- if (rect->y >= gtk_list_view_get_list_height (self))
- return result;
-
n_items = gtk_list_base_get_n_items (base);
if (n_items == 0)
return result;