+/**
+ * gtk_window_set_attached_to:
+ * @window: a #GtkWindow
+ * @attach_widget: (allow-none): a #GtkWidget, or %NULL
+ *
+ * Marks @window as attached to @attach_widget. This creates a logical binding
+ * between the window and the widget it belongs to, which is used by GTK+ to
+ * propagate information such as styling or accessibility to @window as if it
+ * was a children of @attach_widget.
+ *
+ * Examples of places where specifying this relation is useful are for instance
+ * a #GtkMenu created by a #GtkComboBox, a completion popup window
+ * created by #GtkEntry or a typeahead search entry created by #GtkTreeView.
+ *
+ * Note that this function should not be confused with
+ * gtk_window_set_transient_for(), which specifies a window manager relation
+ * between two toplevels instead.
+ *
+ * Passing %NULL for @attach_widget detaches the window.
+ *
+ * Since: 3.4
+ **/
+void
+gtk_window_set_attached_to (GtkWindow *window,
+ GtkWidget *attach_widget)
+{
+ GtkStyleContext *context;
+ GtkWindowPrivate *priv;
+
+ g_return_if_fail (GTK_IS_WINDOW (window));
+ g_return_if_fail (GTK_WIDGET (window) != attach_widget);
+
+ priv = window->priv;
+
+ if (priv->attach_widget == attach_widget)
+ return;
+
+ remove_attach_widget (window);
+
+ priv->attach_widget = attach_widget;
+
+ if (priv->attach_widget)
+ {
+ _gtk_widget_add_attached_window (priv->attach_widget, window);
+
+ g_object_ref (priv->attach_widget);
+ }
+
+ /* Update the style, as the widget path might change. */
+ context = gtk_widget_get_style_context (GTK_WIDGET (window));
+ if (priv->attach_widget)
+ gtk_style_context_set_parent (context, gtk_widget_get_style_context (priv->attach_widget));
+ else
+ gtk_style_context_set_parent (context, NULL);
+}
+
+/**
+ * gtk_window_get_attached_to:
+ * @window: a #GtkWindow
+ *
+ * Fetches the attach widget for this window. See
+ * gtk_window_set_attached_to().
+ *
+ * Return value: (transfer none): the widget where the window is attached,
+ * or %NULL if the window is not attached to any widget.
+ *
+ * Since: 3.4
+ **/
+GtkWidget *
+gtk_window_get_attached_to (GtkWindow *window)
+{
+ g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
+
+ return window->priv->attach_widget;
+}
+