+ if (gtk_widget_get_realized (widget))
+ {
+ gboolean visible = gtk_widget_get_visible (widget);
+
+ if (visible)
+ gtk_widget_hide (widget);
+
+ gtk_widget_unrealize (widget);
+
+ gtk_widget_set_has_window (widget, visible_window);
+
+ gtk_widget_realize (widget);
+
+ if (visible)
+ gtk_widget_show (widget);
+ }
+ else
+ {
+ gtk_widget_set_has_window (widget, visible_window);
+ }
+
+ if (gtk_widget_get_visible (widget))
+ gtk_widget_queue_resize (widget);
+
+ g_object_notify (G_OBJECT (event_box), "visible-window");
+ }
+}
+
+/**
+ * gtk_event_box_get_above_child:
+ * @event_box: a #GtkEventBox
+ *
+ * Returns whether the event box window is above or below the
+ * windows of its child. See gtk_event_box_set_above_child()
+ * for details.
+ *
+ * Return value: %TRUE if the event box window is above the
+ * window of its child
+ *
+ * Since: 2.4
+ */
+gboolean
+gtk_event_box_get_above_child (GtkEventBox *event_box)
+{
+ GtkEventBoxPrivate *priv = event_box->priv;
+
+ g_return_val_if_fail (GTK_IS_EVENT_BOX (event_box), FALSE);
+
+ return priv->above_child;
+}
+
+/**
+ * gtk_event_box_set_above_child:
+ * @event_box: a #GtkEventBox
+ * @above_child: %TRUE if the event box window is above its child
+ *
+ * Set whether the event box window is positioned above the windows
+ * of its child, as opposed to below it. If the window is above, all
+ * events inside the event box will go to the event box. If the window
+ * is below, events in windows of child widgets will first got to that
+ * widget, and then to its parents.
+ *
+ * The default is to keep the window below the child.
+ *
+ * Since: 2.4
+ */
+void
+gtk_event_box_set_above_child (GtkEventBox *event_box,
+ gboolean above_child)
+{
+ GtkEventBoxPrivate *priv = event_box->priv;
+ GtkWidget *widget;
+
+ g_return_if_fail (GTK_IS_EVENT_BOX (event_box));