[PATCH 1/2] Make GTK_DEBUG=nograbs disable grabs



When the GTK_DEBUG environment variable is set to nograbs, disable
gtk_grab_add().
---
 gtk/gtkdebug.h |    3 ++-
 gtk/gtkmain.c  |    7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h
index 2190973..7324ec3 100644
--- a/gtk/gtkdebug.h
+++ b/gtk/gtkdebug.h
@@ -47,7 +47,8 @@ typedef enum {
   GTK_DEBUG_GEOMETRY    = 1 << 8,
   GTK_DEBUG_ICONTHEME   = 1 << 9,
   GTK_DEBUG_PRINTING	= 1 << 10,
-  GTK_DEBUG_BUILDER	= 1 << 11
+  GTK_DEBUG_BUILDER     = 1 << 11,
+  GTK_DEBUG_NOGRABS     = 1 << 12
 } GtkDebugFlag;
 
 #ifdef G_ENABLE_DEBUG
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 11aee08..9d2ee17 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -233,7 +233,8 @@ static const GDebugKey gtk_debug_keys[] = {
   {"geometry", GTK_DEBUG_GEOMETRY},
   {"icontheme", GTK_DEBUG_ICONTHEME},
   {"printing", GTK_DEBUG_PRINTING},
-  {"builder", GTK_DEBUG_BUILDER}
+  {"builder", GTK_DEBUG_BUILDER},
+  {"nograbs", GTK_DEBUG_NOGRABS}
 };
 #endif /* G_ENABLE_DEBUG */
 
@@ -1781,7 +1782,9 @@ gtk_grab_add (GtkWidget *widget)
   
   g_return_if_fail (widget != NULL);
   
-  if (!GTK_WIDGET_HAS_GRAB (widget) && GTK_WIDGET_IS_SENSITIVE (widget))
+  if (!GTK_WIDGET_HAS_GRAB (widget) &&
+      GTK_WIDGET_IS_SENSITIVE (widget) &&
+      !(gtk_debug_flags & GTK_DEBUG_NOGRABS))
     {
       GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_GRAB);
       
-- 
1.6.2.5


--------------020101080509040401080706
Content-Type: text/x-patch;
 name="0002-On-Linux-if-appearing-to-run-in-gdb-disable-grabs.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0002-On-Linux-if-appearing-to-run-in-gdb-disable-grabs.patch"



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