Re: emit_event warning in GnomeCanvas



On Sat, 2001-12-08 at 15:37, Owen Taylor wrote:
> 
> jacob berkman <jacob ximian com> writes:
> 
> > On Sat, 2001-12-08 at 14:07, Owen Taylor wrote:
> > > 
> > > jacob berkman <jacob ximian com> writes:
> > > 
> > > > On Fri, 2001-12-07 at 13:43, Darin Adler wrote:
> > > > > On 12/7/01 10:38 AM, "jacob berkman" <jacob ximian com> wrote:
> > > > > 
> > > > > > is there a mechanism for propogating debug flags from gtk to gdk?
> > > > > > should i add a function gdk_disable_pointer_grabs() ?
> > > > > 
> > > > > Gdk has its own debug flags. GDK_DEBUG. Grep for it.
> > > > 
> > > > ahh thanks. i should have guessed that.
> > > > 
> > > > here's an initial patch that does what my old one did.
> > > > 
> > > > is it necessary to do the checks before every XGrab* and XUngrab* call,
> > > > or is this sufficiently helpful?
> > > 
> > > I think you should handle keyboard grabs as well, but not
> > > server grabs ... they are only used when we need
> > > atomicity guarantees, GTK+ doesn't provide a public
> > > interfaces for them, and if you step into the internals
> > > of, say, gtkdnd.c, you better know what you are
> > > doing.
> > 
> > ok.  what about XGrabDevice() ?
> 
> I don't think it matters much since you aren't going
> to be using your graphics tablet in gdb... but I'd
> say for consistency it's probably good to do that
> one as well.

ok, here's a new version of the patch (and this one actually compiles).

jacob
-- 
"In fact, can you imagine anything more terrifying than a zombie clown?"
	-- moby
? gdkrgb.c.flc
Index: gdk.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdk.c,v
retrieving revision 1.134
diff -u -r1.134 gdk.c
--- gdk.c	2001/12/08 21:13:02	1.134
+++ gdk.c	2001/12/09 01:14:29
@@ -67,7 +67,8 @@
   {"events",	    GDK_DEBUG_EVENTS},
   {"misc",	    GDK_DEBUG_MISC},
   {"dnd",	    GDK_DEBUG_DND},
-  {"xim",	    GDK_DEBUG_XIM}
+  {"xim",	    GDK_DEBUG_XIM},
+  {"nograbs",       GDK_DEBUG_NOGRABS},
 };
 
 static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey);
Index: gdkinternals.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkinternals.h,v
retrieving revision 1.12
diff -u -r1.12 gdkinternals.h
--- gdkinternals.h	2001/11/18 02:15:48	1.12
+++ gdkinternals.h	2001/12/09 01:14:29
@@ -67,7 +67,8 @@
   GDK_DEBUG_MISC          = 1 << 0,
   GDK_DEBUG_EVENTS        = 1 << 1,
   GDK_DEBUG_DND           = 1 << 2,
-  GDK_DEBUG_XIM           = 1 << 3
+  GDK_DEBUG_XIM           = 1 << 3,
+  GDK_DEBUG_NOGRABS       = 1 << 4,
 } GdkDebugFlag;
 
 #ifndef GDK_DISABLE_DEPRECATED
Index: x11/gdkinput-xfree.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkinput-xfree.c,v
retrieving revision 1.15
diff -u -r1.15 gdkinput-xfree.c
--- x11/gdkinput-xfree.c	2001/09/07 21:50:09	1.15
+++ x11/gdkinput-xfree.c	2001/12/09 01:14:29
@@ -277,11 +277,15 @@
 	      gdk_input_common_find_events (window, gdkdev,
 					    event_mask,
 					    event_classes, &num_classes);
-	      
-	      result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
-				    GDK_WINDOW_XWINDOW (window),
-				    owner_events, num_classes, event_classes,
-				    GrabModeAsync, GrabModeAsync, time);
+#ifdef G_ENABLE_DEBUG
+	      if (_gdk_debug_flags & GDK_DEBUG_NOGRABS)
+		result = GrabSuccess;
+	      else
+#endif
+		result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
+				      GDK_WINDOW_XWINDOW (window),
+				      owner_events, num_classes, event_classes,
+				      GrabModeAsync, GrabModeAsync, time);
 	      
 	      /* FIXME: if failure occurs on something other than the first
 		 device, things will be badly inconsistent */
Index: x11/gdkmain-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkmain-x11.c,v
retrieving revision 1.140
diff -u -r1.140 gdkmain-x11.c
--- x11/gdkmain-x11.c	2001/10/26 23:43:32	1.140
+++ x11/gdkmain-x11.c	2001/12/09 01:14:29
@@ -90,18 +90,6 @@
 static gint autorepeat;
 static gboolean gdk_synchronize = FALSE;
 
-#ifdef G_ENABLE_DEBUG
-static const GDebugKey gdk_debug_keys[] = {
-  {"events",	    GDK_DEBUG_EVENTS},
-  {"misc",	    GDK_DEBUG_MISC},
-  {"dnd",	    GDK_DEBUG_DND},
-  {"xim",	    GDK_DEBUG_XIM}
-};
-
-static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey);
-
-#endif /* G_ENABLE_DEBUG */
-
 GdkArgDesc _gdk_windowing_args[] = {
   { "display",     GDK_ARG_STRING,   &_gdk_display_name,    (GdkArgFunc)NULL   },
   { "sync",        GDK_ARG_BOOL,     &gdk_synchronize,     (GdkArgFunc)NULL   },
@@ -298,14 +286,21 @@
   if (return_val == GrabSuccess)
     {
       if (!GDK_WINDOW_DESTROYED (window))
-	return_val = XGrabPointer (GDK_WINDOW_XDISPLAY (window),
-				   xwindow,
-				   owner_events,
-				   xevent_mask,
-				   GrabModeAsync, GrabModeAsync,
-				   xconfine_to,
-				   xcursor,
-				   time);
+	{
+#ifdef G_ENABLE_DEBUG
+	  if (_gdk_debug_flags & GDK_DEBUG_NOGRABS)
+	    return_val = GrabSuccess;
+	  else
+#endif
+	    return_val = XGrabPointer (GDK_WINDOW_XDISPLAY (window),
+				       xwindow,
+				       owner_events,
+				       xevent_mask,
+				       GrabModeAsync, GrabModeAsync,
+				       xconfine_to,
+				       xcursor,
+				       time);
+	}
       else
 	return_val = AlreadyGrabbed;
     }
@@ -392,11 +387,18 @@
   g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
   
   if (!GDK_WINDOW_DESTROYED (window))
-    return_val = XGrabKeyboard (GDK_WINDOW_XDISPLAY (window),
-				GDK_WINDOW_XID (window),
-				owner_events,
-				GrabModeAsync, GrabModeAsync,
-				time);
+    {
+#ifdef G_ENABLE_DEBUG
+      if (_gdk_debug_flags & GDK_DEBUG_NOGRABS)
+	return_val = GrabSuccess;
+      else
+#endif
+	return_val = XGrabKeyboard (GDK_WINDOW_XDISPLAY (window),
+				    GDK_WINDOW_XID (window),
+				    owner_events,
+				    GrabModeAsync, GrabModeAsync,
+				    time);
+    }
   else
     return_val = AlreadyGrabbed;
 


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