Re: emit_event warning in GnomeCanvas
- From: Owen Taylor <otaylor redhat com>
- To: jacob berkman <jacob ximian com>
- Cc: Darin Adler <darin bentspoon com>, gnome-libs-devel gnome org
- Subject: Re: emit_event warning in GnomeCanvas
- Date: 08 Dec 2001 14:07:21 -0500
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.
Looks basically fine to commit - I'd probably suggest
that you just ungrab unconditionally - there is no
benefit to making it conditional and not conditionalizing
will prevent a stuck grab in the unlikely case
of the flag being turned on between grab and ungrab.
Owen
> Index: gdk/gdkinternals.h
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gdk/gdkinternals.h,v
> retrieving revision 1.12
> diff -u -r1.12 gdkinternals.h
> --- gdk/gdkinternals.h 2001/11/18 02:15:48 1.12
> +++ gdk/gdkinternals.h 2001/12/07 19:01:07
> @@ -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: gdk/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
> --- gdk/x11/gdkmain-x11.c 2001/10/26 23:43:32 1.140
> +++ gdk/x11/gdkmain-x11.c 2001/12/07 19:01:08
> @@ -95,7 +95,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);
> @@ -298,14 +299,20 @@
> 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;
> }
> @@ -335,8 +342,10 @@
> gdk_pointer_ungrab (guint32 time)
> {
> _gdk_input_ungrab_pointer (time);
> -
> - XUngrabPointer (gdk_display, time);
> +#ifdef G_ENABLE_DEBUG
> + if (!(_gdk_debug_flags & GDK_DEBUG_NOGRABS)
> +#endif
> + XUngrabPointer (gdk_display, time);
> _gdk_xgrab_window = NULL;
> }
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]