+ attr.wclass = GDK_INPUT_OUTPUT;
+ attr.visual = gtk_widget_get_visual(widget);
+ attr.colormap = gtk_widget_get_colormap(widget);
+ attr.window_type = GDK_WINDOW_CHILD;
+
+ GdkWindow* backing_window = gdk_window_new(
+ gdk_window_get_parent(widget->window),
+ &attr,
+ GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP);
+
+ gdk_window_set_user_data(backing_window, widget);
+ gdk_window_reparent(widget->window, backing_window, 0, 0);
+ gdk_window_resize(widget->window, w, h);
+
+ // Parts of backing window may be exposed temporarily while
+ // resizing. Setting the backing pixmap to None prevents those
+ // areas from being briefly painted black.
+ gdk_window_set_back_pixmap(backing_window, NULL, false);