+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);
+ if (widget->window == p->window)
+ {
+ widget->allocation.x += p->dx;
+ widget->allocation.y += p->dy;
+ // 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);
+ }
+}
+}
+