[gtk/matthiasc/for-master] gridview: Compute right amount of items to skip



commit 7c2d21892fca112cbb4c1744460adff5f3661571
Author: Benjamin Otte <otte redhat com>
Date:   Sat Jun 20 12:08:46 2020 -0400

    gridview: Compute right amount of items to skip
    
    We only want to skip the remaining items in the current row, not since
    the start of the widget.

 gtk/gtkgridview.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkgridview.c b/gtk/gtkgridview.c
index 5531b5c53c..b9c2c9a87c 100644
--- a/gtk/gtkgridview.c
+++ b/gtk/gtkgridview.c
@@ -269,7 +269,8 @@ gtk_grid_view_get_cell_at_y (GtkGridView *self,
       /* skip remaining items at end of row */
       if (pos % self->n_columns)
         {
-          skip = pos - pos % self->n_columns;
+          skip = self->n_columns - pos % self->n_columns;
+          g_assert (n_items > skip);
           n_items -= skip;
           pos += skip;
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]