Commit 45257e31 authored by Javier Jardón's avatar Javier Jardón

Don't use GTK_WIDGET_*SET_FLAGS (wid, GTK_TOPLEVEL)

Introduce internal _gtk_widget_set_is_toplvel() for this

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=614510
parent 560e426f
......@@ -95,7 +95,7 @@ gtk_invisible_init (GtkInvisible *invisible)
GdkColormap *colormap;
gtk_widget_set_has_window (GTK_WIDGET (invisible), TRUE);
GTK_WIDGET_SET_FLAGS (invisible, GTK_TOPLEVEL);
_gtk_widget_set_is_toplevel (GTK_WIDGET (invisible), TRUE);
g_object_ref_sink (invisible);
......
......@@ -5953,6 +5953,16 @@ gtk_widget_is_toplevel (GtkWidget *widget)
return (GTK_OBJECT_FLAGS (widget) & GTK_TOPLEVEL) != 0;
}
void
_gtk_widget_set_is_toplevel (GtkWidget *widget,
gboolean is_toplevel)
{
if (is_toplevel)
GTK_OBJECT_FLAGS (widget) |= GTK_TOPLEVEL;
else
GTK_OBJECT_FLAGS (widget) &= ~(GTK_TOPLEVEL);
}
/**
* gtk_widget_is_drawable:
* @widget: a #GtkWidget
......
......@@ -1298,6 +1298,9 @@ void gtk_requisition_free (GtkRequisition *requisition);
void _gtk_widget_set_has_grab (GtkWidget *widget,
gboolean has_grab);
void _gtk_widget_set_is_toplevel (GtkWidget *widget,
gboolean is_toplevel);
void _gtk_widget_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
......
......@@ -85,7 +85,7 @@ gtk_win32_embed_widget_init (GtkWin32EmbedWidget *embed_widget)
window->type = GTK_WINDOW_TOPLEVEL;
GTK_WIDGET_SET_FLAGS (embed_widget, GTK_TOPLEVEL);
_gtk_widget_set_is_toplevel (GTK_WIDGET (embed_widget), TRUE);
gtk_container_set_resize_mode (GTK_CONTAINER (embed_widget), GTK_RESIZE_QUEUE);
}
......
......@@ -901,7 +901,7 @@ gtk_window_init (GtkWindow *window)
GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
gtk_widget_set_has_window (GTK_WIDGET (window), TRUE);
GTK_WIDGET_SET_FLAGS (window, GTK_TOPLEVEL);
_gtk_widget_set_is_toplevel (GTK_WIDGET (window), TRUE);
GTK_PRIVATE_SET_FLAG (window, GTK_ANCHORED);
......@@ -8379,22 +8379,26 @@ void
_gtk_window_set_is_toplevel (GtkWindow *window,
gboolean is_toplevel)
{
if (gtk_widget_is_toplevel (GTK_WIDGET (window)))
GtkWidget *widget;
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 (GTK_WIDGET (window)))
if (is_toplevel == gtk_widget_is_toplevel (widget))
return;
if (is_toplevel)
{
GTK_WIDGET_SET_FLAGS (window, GTK_TOPLEVEL);
_gtk_widget_set_is_toplevel (widget, TRUE);
toplevel_list = g_slist_prepend (toplevel_list, window);
}
else
{
GTK_WIDGET_UNSET_FLAGS (window, GTK_TOPLEVEL);
_gtk_widget_set_is_toplevel (widget, FALSE);
toplevel_list = g_slist_remove (toplevel_list, window);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment