[gtk+] Don't use GTK_WIDGET_*SET_FLAGS (wid, GTK_TOPLEVEL)
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Don't use GTK_WIDGET_*SET_FLAGS (wid, GTK_TOPLEVEL)
- Date: Mon, 26 Apr 2010 19:17:23 +0000 (UTC)
commit 45257e31c721d1ffbd2cdcfb25ae637d7e1e7b29
Author: Javier Jardón <jjardon gnome org>
Date: Mon Apr 12 17:48:09 2010 +0200
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
gtk/gtkinvisible.c | 2 +-
gtk/gtkwidget.c | 10 ++++++++++
gtk/gtkwidget.h | 3 +++
gtk/gtkwin32embedwidget.c | 2 +-
gtk/gtkwindow.c | 14 +++++++++-----
5 files changed, 24 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c
index c24487c..8c0b3be 100644
--- a/gtk/gtkinvisible.c
+++ b/gtk/gtkinvisible.c
@@ -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);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 61c6b1c..772619f 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index dd8eb31..17bb2b6 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -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);
diff --git a/gtk/gtkwin32embedwidget.c b/gtk/gtkwin32embedwidget.c
index 2e1a6b1..9c276ea 100644
--- a/gtk/gtkwin32embedwidget.c
+++ b/gtk/gtkwin32embedwidget.c
@@ -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);
}
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 51ff500..108a7c1 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]