[gtk+] Don't use GTK_WIDGET_*SET_FLAGS (wid, GTK_HAS_GRAB)



commit 560e426f16fc5a8a8eaaac2cf6feb85d26e69388
Author: Javier Jardón <jjardon gnome org>
Date:   Sun Apr 11 23:19:42 2010 +0200

    Don't use GTK_WIDGET_*SET_FLAGS (wid, GTK_HAS_GRAB)
    
    Introduce internal _gtk_widget_set_has_grab() for this
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=614513

 gtk/gtkmain.c   |    4 ++--
 gtk/gtkwidget.c |   10 ++++++++++
 gtk/gtkwidget.h |    2 ++
 3 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 641e19b..f01f68c 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1829,7 +1829,7 @@ gtk_grab_add (GtkWidget *widget)
   
   if (!gtk_widget_has_grab (widget) && gtk_widget_is_sensitive (widget))
     {
-      GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_GRAB);
+      _gtk_widget_set_has_grab (widget, TRUE);
       
       group = gtk_main_get_window_group (widget);
 
@@ -1867,7 +1867,7 @@ gtk_grab_remove (GtkWidget *widget)
   
   if (gtk_widget_has_grab (widget))
     {
-      GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_GRAB);
+      _gtk_widget_set_has_grab (widget, FALSE);
 
       group = gtk_main_get_window_group (widget);
       group->grabs = g_slist_remove (group->grabs, widget);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index de85182..61c6b1c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5714,6 +5714,16 @@ gtk_widget_has_grab (GtkWidget *widget)
   return (GTK_OBJECT_FLAGS (widget) & GTK_HAS_GRAB) != 0;
 }
 
+void
+_gtk_widget_set_has_grab (GtkWidget *widget,
+                          gboolean   has_grab)
+{
+  if (has_grab)
+    GTK_OBJECT_FLAGS (widget) |= GTK_HAS_GRAB;
+  else
+    GTK_OBJECT_FLAGS (widget) &= ~(GTK_HAS_GRAB);
+}
+
 /**
  * gtk_widget_set_name:
  * @widget: a #GtkWidget
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index bf7c342..dd8eb31 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -1296,6 +1296,8 @@ void            gtk_requisition_free     (GtkRequisition       *requisition);
 #  define gtk_widget_unref g_object_unref
 #endif	/* GTK_TRACE_OBJECTS && __GNUC__ */
 
+void              _gtk_widget_set_has_grab                (GtkWidget    *widget,
+                                                           gboolean      has_grab);
 void              _gtk_widget_grab_notify                 (GtkWidget    *widget,
 						           gboolean	was_grabbed);
 



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