[PATCH] Don't release passive grabs unless all buttons are up
Peter Hutterer
peter.hutterer at who-t.net
Mon Jan 5 15:12:32 PST 2009
On Mon, Jan 05, 2009 at 10:51:59AM -0800, Keith Packard wrote:
> On Mon, 2009-01-05 at 16:07 +1000, Peter Hutterer wrote:
>
> > Following up on that:
> > Both the core protocol and the XI protocol spec state that a passive grab is
> > to be released when all buttons are logically up, regardless of modifiers..
> > This is where the magic number 5 comes in. Core allows for 5 buttons, XI
> > allows for more.
>
> That's a common misunderstanding -- the core protocol allows for up to
> 255 buttons, and the documentation for GrabButton is fairly clear about
> waiting until *all* buttons are released, not just the five visible in
> the mask.
I agree with the second one (all buttons must be released).
As for the 255 buttons - I couldn't find any limitation to 5 buttons other
than the masks being defined only up to 5. From the spec (page 3):
BUTMASK {Button1, Button2, Button3, Button4, Button5}
Events and a few replies include a state field that is supposed to return the
"the current logical state of the modifier keys and the buttons".
(QueryPointer reply). In addition to the masks only being up to 5, there's
also a built-in limitation to 8 buttons, decided by the size of the "state"
field (CARD16, the lower 8 bits are used for modifier masks).
If core allows for 255 buttons, this means that buttons > 5 (or > 8) may be
down even if the state field is zero. Is this correct?
If this is intended, then Thomas' patch is indeed a lot simpler.
Cheers,
Peter
More information about the xorg
mailing list