[gtk+] widget: Insist on widgets calling gtk_widget_set_has_window()



commit b0a5e8764c59043dc9b38f300e9b44a878aec26c
Author: Benjamin Otte <otte redhat com>
Date:   Wed Nov 2 06:51:59 2016 +0100

    widget: Insist on widgets calling gtk_widget_set_has_window()
    
    This way, we can grep the code for the bad widgets that set this to
    TRUE and fix them.

 gtk/gtkwidget.c        |    6 ++++++
 gtk/gtkwidgetprivate.h |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index f7879b6..59ed2c1 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -8168,6 +8168,7 @@ gtk_widget_set_has_window (GtkWidget *widget,
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
   widget->priv->no_window = !has_window;
+  widget->priv->no_window_set = TRUE;
 }
 
 /**
@@ -10415,6 +10416,11 @@ gtk_widget_constructed (GObject *object)
     g_object_set_qdata (object, quark_widget_path, NULL);
 
   G_OBJECT_CLASS (gtk_widget_parent_class)->constructed (object);
+
+  if (!widget->priv->no_window_set)
+    {
+      g_warning ("%s does not call gtk_widget_set_has_window() in its init function", G_OBJECT_TYPE_NAME 
(widget));
+    }
 }
 
 static void
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 039dc1b..8169281 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -53,6 +53,7 @@ struct _GtkWidgetPrivate
   guint toplevel              : 1;
   guint anchored              : 1;
   guint no_window             : 1;
+  guint no_window_set         : 1;
   guint realized              : 1;
   guint mapped                : 1;
   guint visible               : 1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]