forked from AuroraMiddleware/gtk
Merge branch 'parent-surface' into 'master'
Drop the parent surface getter and setter See merge request GNOME/gtk!774
This commit is contained in:
commit
a98f857a82
@ -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
|
||||
|
@ -557,7 +557,7 @@ gtk_widget_accessible_get_extents (AtkComponent *component,
|
||||
{
|
||||
*x = allocation.x;
|
||||
*y = allocation.y;
|
||||
surface = gtk_widget_get_parent_surface (widget);
|
||||
surface = gtk_widget_get_surface (gtk_widget_get_parent (widget));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -564,7 +564,7 @@ gtk_popover_realize (GtkWidget *widget)
|
||||
|
||||
gtk_widget_get_surface_allocation (widget, &allocation);
|
||||
|
||||
surface = gdk_surface_new_child (gtk_widget_get_parent_surface (widget), &allocation);
|
||||
surface = gdk_surface_new_child (gtk_widget_get_surface (gtk_widget_get_parent (widget)), &allocation);
|
||||
|
||||
gtk_widget_set_surface (widget, surface);
|
||||
gtk_widget_register_surface (widget, surface);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -25,7 +25,7 @@ set_fullscreen_monitor_cb (GtkWidget *widget, gpointer user_data)
|
||||
GdkFullscreenMode mode = (GdkFullscreenMode) GPOINTER_TO_INT (user_data);
|
||||
GdkSurface *window;
|
||||
|
||||
window = gtk_widget_get_parent_surface (widget);
|
||||
window = gtk_widget_get_surface (gtk_widget_get_parent (widget));
|
||||
gdk_surface_set_fullscreen_mode (window, mode);
|
||||
gdk_surface_fullscreen (window);
|
||||
}
|
||||
@ -35,7 +35,7 @@ remove_fullscreen_cb (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
GdkSurface *window;
|
||||
|
||||
window = gtk_widget_get_parent_surface (widget);
|
||||
window = gtk_widget_get_surface (gtk_widget_get_parent (widget));
|
||||
gdk_surface_unfullscreen (window);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user