+struct AdjustData {
+ GdkWindow* window;
+ int dx, dy;
+};
+
+// Adjust allocations for all widgets using the GdkWindow which was just scrolled
+extern "C" {
+static void scroll_adjust(GtkWidget* widget, void* data)
+{
+ const AdjustData* p = static_cast<AdjustData*>(data);
+ widget->allocation.x += p->dx;
+ widget->allocation.y += p->dy;
+
+ if (widget->window == p->window)
+ {
+ // GtkFrame requires a queue_resize, otherwise parts of
+ // the frame newly exposed by the scroll are not drawn.
+ // To be safe, do it for all widgets.
+ gtk_widget_queue_resize_no_redraw(widget);
+ if (GTK_IS_CONTAINER(widget))
+ gtk_container_forall(GTK_CONTAINER(widget), scroll_adjust, data);
+ }
+}
+}
+