window: Remove _gtk_window_set_is_toplevel

All GtkWindow instances are toplevels.
This commit is contained in:
Timm Bäder 2017-02-08 14:13:23 +01:00
parent 270d957380
commit cc05fc574c
3 changed files with 1 additions and 82 deletions

View File

@ -9161,6 +9161,7 @@ gtk_widget_set_parent_window (GtkWidget *widget,
GdkWindow *old_parent_window;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (!GTK_IS_WINDOW (widget));
old_parent_window = g_object_get_qdata (G_OBJECT (widget),
quark_parent_window);
@ -9173,13 +9174,6 @@ gtk_widget_set_parent_window (GtkWidget *widget,
g_object_unref (old_parent_window);
if (parent_window)
g_object_ref (parent_window);
/* Unset toplevel flag when adding a parent window to a widget,
* this is the primary entry point to allow toplevels to be
* embeddable.
*/
if (GTK_IS_WINDOW (widget))
_gtk_window_set_is_toplevel (GTK_WINDOW (widget), parent_window == NULL);
}
}

View File

@ -10666,78 +10666,6 @@ _gtk_window_set_is_active (GtkWindow *window,
}
}
/**
* _gtk_window_set_is_toplevel:
* @window: a #GtkWindow
* @is_toplevel: %TRUE if the window is still a real toplevel (nominally a
* child of the root window); %FALSE if it is not (for example, for an
* in-process, parented GtkPlug)
*
* Internal function used by #GtkPlug when it gets parented/unparented by a
* #GtkSocket. This keeps the @windows #GTK_WINDOW_TOPLEVEL flag in sync
* with the global list of toplevel windows.
*/
void
_gtk_window_set_is_toplevel (GtkWindow *window,
gboolean is_toplevel)
{
GtkWidget *widget;
GtkWidget *toplevel;
widget = GTK_WIDGET (window);
if (_gtk_widget_is_toplevel (widget))
g_assert (g_slist_find (toplevel_list, window) != NULL);
else
g_assert (g_slist_find (toplevel_list, window) == NULL);
if (is_toplevel == _gtk_widget_is_toplevel (widget))
return;
if (is_toplevel)
{
/* Pass through regular pathways of an embedded toplevel
* to go through unmapping and hiding the widget before
* becomming a toplevel again.
*
* We remain hidden after becomming toplevel in order to
* avoid problems during an embedded toplevel's dispose cycle
* (When a toplevel window is shown it tries to grab focus again,
* this causes problems while disposing).
*/
gtk_widget_hide (widget);
/* Save the toplevel this widget was previously anchored into before
* propagating a hierarchy-changed.
*
* Usually this happens by way of gtk_widget_unparent() and we are
* already unanchored at this point, just adding this clause incase
* things happen differently.
*/
toplevel = _gtk_widget_get_toplevel (widget);
if (!_gtk_widget_is_toplevel (toplevel))
toplevel = NULL;
_gtk_widget_set_is_toplevel (widget, TRUE);
/* When a window becomes toplevel after being embedded and anchored
* into another window we need to unset its anchored flag so that
* the hierarchy changed signal kicks in properly.
*/
_gtk_widget_set_anchored (widget, FALSE);
_gtk_widget_propagate_hierarchy_changed (widget, toplevel);
toplevel_list = g_slist_prepend (toplevel_list, window);
}
else
{
_gtk_widget_set_is_toplevel (widget, FALSE);
toplevel_list = g_slist_remove (toplevel_list, window);
_gtk_widget_propagate_hierarchy_changed (widget, widget);
}
gtk_window_update_debugging ();
}
/**
* gtk_window_set_auto_startup_notification:
* @setting: %TRUE to automatically do startup notification

View File

@ -52,9 +52,6 @@ void _gtk_window_unset_focus_and_default (GtkWindow *window,
void _gtk_window_set_is_active (GtkWindow *window,
gboolean is_active);
void _gtk_window_set_is_toplevel (GtkWindow *window,
gboolean is_toplevel);
void _gtk_window_set_allocation (GtkWindow *window,
const GtkAllocation *allocation,
GtkAllocation *allocation_out);