Drop gtk_widget_get_toplevel

Not used anymore.
This commit is contained in:
Matthias Clasen 2019-05-20 04:51:31 +00:00
parent 7447abb52b
commit 693b2aa4d1
5 changed files with 2 additions and 70 deletions

View File

@ -4443,7 +4443,6 @@ gtk_widget_set_name
gtk_widget_get_name gtk_widget_get_name
gtk_widget_set_sensitive gtk_widget_set_sensitive
gtk_widget_set_parent gtk_widget_set_parent
gtk_widget_get_toplevel
gtk_widget_get_root gtk_widget_get_root
gtk_widget_get_native gtk_widget_get_native
gtk_widget_get_ancestor gtk_widget_get_ancestor

View File

@ -1419,7 +1419,7 @@ gtk_im_context_xim_get_ic (GtkIMContextXIM *context_xim)
* The toplevel is computed by walking up the GdkSurface * The toplevel is computed by walking up the GdkSurface
* hierarchy from context->client_surface until we find a * hierarchy from context->client_surface until we find a
* window that is owned by some widget, and then calling * window that is owned by some widget, and then calling
* gtk_widget_get_toplevel() on that widget. This should * gtk_widget_get_root() on that widget. This should
* handle both cases where we might have GdkSurfaces without widgets, * handle both cases where we might have GdkSurfaces without widgets,
* and cases where GtkWidgets have strange window hierarchies * and cases where GtkWidgets have strange window hierarchies
* (like a torn off GtkHandleBox.) * (like a torn off GtkHandleBox.)

View File

@ -7498,59 +7498,6 @@ gtk_widget_has_size_request (GtkWidget *widget)
return !(priv->width_request == -1 && priv->height_request == -1); return !(priv->width_request == -1 && priv->height_request == -1);
} }
/**
* gtk_widget_get_toplevel:
* @widget: a #GtkWidget
*
* This function returns the topmost widget in the container hierarchy
* @widget is a part of. If @widget has no parent widgets, it will be
* returned as the topmost widget. No reference will be added to the
* returned widget; it should not be unreferenced.
*
* Note the difference in behavior vs. gtk_widget_get_ancestor();
* `gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW)`
* would return
* %NULL if @widget wasnt inside a toplevel window, and if the
* window was inside a #GtkWindow-derived widget which was in turn
* inside the toplevel #GtkWindow.
*
* To reliably find the toplevel #GtkWindow, use
* gtk_widget_get_toplevel() and call GTK_IS_WINDOW()
* on the result. For instance, to get the title of a widget's toplevel
* window, one might use:
* |[<!-- language="C" -->
* static const char *
* get_widget_toplevel_title (GtkWidget *widget)
* {
* GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
* if (GTK_IS_WINDOW (toplevel))
* {
* return gtk_window_get_title (GTK_WINDOW (toplevel));
* }
*
* return NULL;
* }
* ]|
*
* Returns: (transfer none): the topmost ancestor of @widget, or @widget itself
* if theres no ancestor.
**/
GtkWidget *
gtk_widget_get_toplevel (GtkWidget *widget)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
while (priv->parent)
{
widget = priv->parent;
priv = gtk_widget_get_instance_private (widget);
}
return widget;
}
/** /**
* gtk_widget_get_ancestor: * gtk_widget_get_ancestor:
* @widget: a #GtkWidget * @widget: a #GtkWidget
@ -7559,9 +7506,7 @@ gtk_widget_get_toplevel (GtkWidget *widget)
* Gets the first ancestor of @widget with type @widget_type. For example, * Gets the first ancestor of @widget with type @widget_type. For example,
* `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)` gets * `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)` gets
* the first #GtkBox thats an ancestor of @widget. No reference will be * the first #GtkBox thats an ancestor of @widget. No reference will be
* added to the returned widget; it should not be unreferenced. See note * added to the returned widget; it should not be unreferenced.
* about checking for a toplevel #GtkWindow in the docs for
* gtk_widget_get_toplevel().
* *
* Note that unlike gtk_widget_is_ancestor(), gtk_widget_get_ancestor() * Note that unlike gtk_widget_is_ancestor(), gtk_widget_get_ancestor()
* considers @widget to be an ancestor of itself. * considers @widget to be an ancestor of itself.

View File

@ -607,9 +607,6 @@ void gtk_widget_set_overflow (GtkWidget *widget,
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GtkOverflow gtk_widget_get_overflow (GtkWidget *widget); GtkOverflow gtk_widget_get_overflow (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget, GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
GType widget_type); GType widget_type);

View File

@ -423,15 +423,6 @@ _gtk_widget_get_direction (GtkWidget *widget)
return widget->priv->direction; return widget->priv->direction;
} }
static inline GtkWidget *
_gtk_widget_get_toplevel (GtkWidget *widget)
{
while (widget->priv->parent)
widget = widget->priv->parent;
return widget;
}
static inline GtkRoot * static inline GtkRoot *
_gtk_widget_get_root (GtkWidget *widget) _gtk_widget_get_root (GtkWidget *widget)
{ {