listitemmanager: Add a split vfunc and use it
authorBenjamin Otte <otte@redhat.com>
Thu, 2 Mar 2023 02:53:56 +0000 (03:53 +0100)
committerBenjamin Otte <otte.benjamin@googlemail.com>
Sun, 5 Mar 2023 15:23:20 +0000 (15:23 +0000)
commitd949afb80e3e80dfb798d49d7927df14f87258de
tree7fe92fb2fc59a575fa60a6d879260538448c1894
parent08c583b1b331bd0263c5f9360ce3848aa56f54c5
listitemmanager: Add a split vfunc and use it

Instead of randomly changing tiles, the listitemmanager gains a split
vfunc that listview and gridview implement so they can keep their tile
areas intact. The listitemmanager will now conform to these rules:

1. Never delete a tile.
   This ensures that all areas stay intact.

2. Never change the n_items of a tile other than setting them to 0.
   This causes "empty" areas to appear, but listview/gridview can
   easily check for them by checking for tile->n_items == 0.
   gtk_list_tile_gc() will get rid of them.

3. Adding items always creates new tiles that are added with empty area.
   That way they don't interrupt any existing machinery until the next
   allocation.

4. Adding/removing widgets has no effect on areas
   This is useful in particular when scrolling where new widgets are
   moving between tiles. When the manager moves the widgets, it may
   split some areas, but will not remove any existing tiles, so the
   whole area stays intact and the list can deal with further scroll
   events before an allocation.

This improve the situation for #3334
gtk/gtkgridview.c
gtk/gtklistbase.c
gtk/gtklistbaseprivate.h
gtk/gtklistitemmanager.c
gtk/gtklistitemmanagerprivate.h
gtk/gtklistview.c