+void wxPizza::put(GtkWidget* widget, int x, int y, int width, int height)
+{
+ // Re-parenting a TLW under a child window is possible at wx level but
+ // using a TLW as child at GTK+ level results in problems, so don't do it.
+#if GTK_CHECK_VERSION(2,19,3)
+ if (!gtk_widget_is_toplevel(GTK_WIDGET(widget)))
+#else
+ if (!GTK_WIDGET_TOPLEVEL(GTK_WIDGET(widget)))
+#endif
+ gtk_fixed_put(GTK_FIXED(this), widget, 0, 0);
+
+ wxPizzaChild* child = new wxPizzaChild;
+ child->widget = widget;
+ child->x = x;
+ child->y = y;
+ child->width = width;
+ child->height = height;
+ m_children = g_list_append(m_children, child);
+}
+
+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);
+ GtkAllocation a;
+ gtk_widget_get_allocation(widget, &a);
+ a.x += p->dx;
+ a.y += p->dy;
+ gtk_widget_set_allocation(widget, &a);
+
+ if (gtk_widget_get_window(widget) == 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);
+ }
+}
+}
+