diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 2331283531..33f5984760 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4438,8 +4438,6 @@ gtk_widget_set_name gtk_widget_get_name gtk_widget_set_sensitive gtk_widget_set_parent -gtk_widget_set_parent_surface -gtk_widget_get_parent_surface gtk_widget_get_toplevel gtk_widget_get_root gtk_widget_get_ancestor diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index ab33790cb2..579633722c 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -725,7 +725,6 @@ GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR; static GQuark quark_accel_path = 0; static GQuark quark_accel_closures = 0; -static GQuark quark_parent_surface = 0; static GQuark quark_input_shape_info = 0; static GQuark quark_pango_context = 0; static GQuark quark_mnemonic_labels = 0; @@ -876,7 +875,6 @@ gtk_widget_class_init (GtkWidgetClass *klass) quark_accel_path = g_quark_from_static_string ("gtk-accel-path"); quark_accel_closures = g_quark_from_static_string ("gtk-accel-closures"); - quark_parent_surface = g_quark_from_static_string ("gtk-parent-surface"); quark_input_shape_info = g_quark_from_static_string ("gtk-input-shape-info"); quark_pango_context = g_quark_from_static_string ("gtk-pango-context"); quark_mnemonic_labels = g_quark_from_static_string ("gtk-mnemonic-labels"); @@ -3046,13 +3044,6 @@ gtk_widget_unparent (GtkWidget *widget) if (old_parent->priv->layout_manager) gtk_layout_manager_remove_layout_child (old_parent->priv->layout_manager, widget); - /* Now that the parent pointer is nullified and the unroot vfunc already - * called, go ahead and unset the parent window, if we are unparenting - * an embedded GtkWindow the window will become toplevel again and root - * will fire for the new hierarchy. - */ - gtk_widget_set_parent_surface (widget, NULL); - g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_PARENT]); g_object_thaw_notify (G_OBJECT (widget)); @@ -7353,67 +7344,6 @@ gtk_widget_create_pango_layout (GtkWidget *widget, return layout; } -/** - * gtk_widget_set_parent_surface: - * @widget: a #GtkWidget. - * @parent_surface: the new parent window. - * - * Sets a non default parent window for @widget. - * - * For #GtkWindow classes, setting a @parent_surface effects whether - * the window is a toplevel window or can be embedded into other - * widgets. - * - * For #GtkWindow classes, this needs to be called before the - * window is realized. - */ -void -gtk_widget_set_parent_surface (GtkWidget *widget, - GdkSurface *parent_surface) -{ - GdkSurface *old_parent_surface; - - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (!GTK_IS_WINDOW (widget)); - - old_parent_surface = g_object_get_qdata (G_OBJECT (widget), - quark_parent_surface); - - if (parent_surface != old_parent_surface) - { - g_object_set_qdata (G_OBJECT (widget), quark_parent_surface, - parent_surface); - if (old_parent_surface) - g_object_unref (old_parent_surface); - if (parent_surface) - g_object_ref (parent_surface); - } -} - -/** - * gtk_widget_get_parent_surface: - * @widget: a #GtkWidget. - * - * Gets @widget’s parent window, or %NULL if it does not have one. - * - * Returns: (transfer none) (nullable): the parent window of @widget, or %NULL - * if it does not have a parent window. - **/ -GdkSurface * -gtk_widget_get_parent_surface (GtkWidget *widget) -{ - GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); - GdkSurface *parent_surface; - - g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); - - parent_surface = g_object_get_qdata (G_OBJECT (widget), quark_parent_surface); - - return (parent_surface != NULL) ? parent_surface : - (priv->parent != NULL) ? priv->parent->priv->surface : NULL; -} - - /** * gtk_widget_set_child_visible: * @widget: a #GtkWidget @@ -8531,7 +8461,7 @@ gtk_widget_real_realize (GtkWidget *widget) else { g_assert (priv->parent); - priv->surface = gtk_widget_get_parent_surface (widget); + priv->surface = priv->parent->priv->surface; g_object_ref (priv->surface); } diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 30741b9499..9b17b56845 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -556,12 +556,6 @@ GtkWidget * gtk_widget_get_parent (GtkWidget *widget); GDK_AVAILABLE_IN_ALL GtkRoot * gtk_widget_get_root (GtkWidget *widget); -GDK_AVAILABLE_IN_ALL -void gtk_widget_set_parent_surface (GtkWidget *widget, - GdkSurface *parent_surface); -GDK_AVAILABLE_IN_ALL -GdkSurface * gtk_widget_get_parent_surface (GtkWidget *widget); - GDK_AVAILABLE_IN_ALL void gtk_widget_set_child_visible (GtkWidget *widget, gboolean child_visible);