I’ve implemented a custom widget, which implements the GtkScrollable interface and is placed inside a GtkScrolledWindow. Fetching and rendering the data to display isn’t particularly cheap, hence I’d like to avoid frequent redraws on scroll.
I was under the impression that the GtkScrolledWindow provides some caching mechanism, like it’s common on many platforms, where a rendered region larger than the current view is cached and just moved on scroll, without requesting a redraw for the whole view every time. But this doesn’t seem to be the case by, at least not by default.
In GTK3 some widgets were using the private GtkPixelCache, which I suppose was doing something like that, but it was removed in GTK4. So how do other GTK scrollable widgets (like GtkTextView, GtkColumnView, GtkTreeView) implement that kind of optimization and how are custom widgets supposed to do it?