+static GdkWindow *
+gtk_paned_create_child_window (GtkPaned *paned,
+ GtkWidget *child) /* may be NULL */
+{
+ GtkWidget *widget = GTK_WIDGET (paned);
+ GtkPanedPrivate *priv = paned->priv;
+ GdkWindow *window;
+ GdkWindowAttr attributes;
+ gint attributes_mask;
+
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
+ if (child)
+ {
+ GtkAllocation allocation;
+ int handle_size;
+
+ gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
+
+ gtk_widget_get_allocation (widget, &allocation);
+ if (priv->orientation == GTK_ORIENTATION_HORIZONTAL &&
+ child == priv->child2 && priv->child1 &&
+ gtk_widget_get_visible (priv->child1))
+ attributes.x = priv->handle_pos.x + handle_size;
+ else
+ attributes.x = allocation.x;
+ if (priv->orientation == GTK_ORIENTATION_VERTICAL &&
+ child == priv->child2 && priv->child1 &&
+ gtk_widget_get_visible (priv->child1))
+ attributes.y = priv->handle_pos.y + handle_size;
+ else
+ attributes.y = allocation.y;
+
+ gtk_widget_get_allocation (child, &allocation);
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
+ attributes_mask = GDK_WA_X | GDK_WA_Y;
+ }
+ else
+ {
+ attributes.width = 1;
+ attributes.height = 1;
+ attributes_mask = 0;
+ }
+
+ window = gdk_window_new (gtk_widget_get_window (widget),
+ &attributes, attributes_mask);
+ gtk_widget_register_window (widget, window);
+ gtk_style_context_set_background (gtk_widget_get_style_context (widget), window);
+
+ if (child)
+ gtk_widget_set_parent_window (child, window);
+
+ return window;
+}
+