Re: Problem with gdk_pointer_is_grabbed() + test program

Damon Chaplin wrote:
> gdk_pointer_is_grabbed() often returns 0 even if there is a grab.

I've just remembered that X does an automatic pointer grab if a
window selects both button_press & button_release events.

So gdk_pointer_is_grabbed() shouldn't be considered totally reliable.

> I was trying to make sure any pointer grab was released before
> calling abort() so I could debug my app. I knew there was a pointer
> grab, but gdk_pointer_is_grabbed() always returned 0.

Maybe this should be done automatically by GTK+/GLib.
How about adding this to GLib:

GVoidFunc g_abort_handler = NULL;

g_set_abort_handler (GVoidFunc *func)
  g_abort_handler = func;

and GTK+ calls this on startup:

  g_set_abort_handler (gtk_abort_handler);

which does this:

gtk_abort_handler (void)
  gdk_pointer_ungrab (GDK_CURRENT_TIME);
  gdk_flush ();
  abort ();

Or maybe use a GHookList just in case multiple functions need to be called.


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