Re: Problem with gdk_pointer_is_grabbed() + test program



On Wed, 7 Apr 1999, Damon Chaplin wrote:

> 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.
> 

this i've never heard of, lots of gtk windows select button clicks and
releases and the server doesn't issue a pointer grab for that.
this would mean that you couldnt use other applications while a 
window with button press and release events is mapped.


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

it should be considered reliable, it just needs fixing if there are
cases where it doesn't behave appropriatedly.

> > 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;
> 
> void
> 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:
> 
> void
> 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.
> 
> Damon
> 

---
ciaoTJ



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