Pointer grabs causing accessibility issues! Why not deprecate them?

Peter Hutterer mailinglists at who-t.net
Mon Apr 28 06:13:22 PDT 2008

Francesco Fumanti wrote:
> Could you please expand on the main reasons why it is not feasible?
> For example, in what situations are the pointer grabs really unavoidable 
> and unreplacable by other techniques?

pointer grabs are a method of guaranteeing that events are delivered to 
a certain client - and not to the window underneath the pointer as usual.

the most common uses I can think of:
- popup menus: apps use grabs for them because it can tell them whether 
the following click was on the window or outside. implementing the same 
functionality without a grab would require the client to register for 
click events on every single visible window. This is unfeasable.

- drag and drop: grabs are the only way how to guarantee you'll get all 
motion events. the only other way is to register for motion events on 
every single visible window.

- event interception: passive grabs (synchronised ones anyway) allow you 
to receive an event before the actual window under the cursor gets it. 
window managers use this extensively to e.g. raise and focus window when 
you click into it. the WM then tells the X server to replay the event on 
the client window. this can't be done any other way.

- keyboard shortcuts: passive keyboard grabs are what makes your 
shortcuts work. without them - no shortcuts. unless your client 
registers for key events on every... you know the drill :)

and of course the example you mentioned where a grab ensures nobody can 
sniff on the input data (too easily anyway).

I don't know of any other techniques but if you come up with some I'd be 
interested to read about them. The only thing that may work is to 
restrict the exclusiveness of a grab (a event delivered to a grabbing 
client be also delivered to the actual client). but believe me, here be 


PS: I believe windows has a similar feature called "captures", although 
I do not know how they work exactly. Not sure what OS X has, haven't 
done any mentionable GUI programming there.

More information about the xorg mailing list