button->down used inconsistently

Peter Hutterer peter at cs.unisa.edu.au
Sat Jun 14 19:40:54 PDT 2008

On Sat, Jun 14, 2008 at 01:31:58PM -0700, Keith Packard wrote:
> Some parts of the server use button->down as a bitmask, other parts use
> it as a per-button down count. It seems like using it consistently as a
> bitmask would match the keyboard behaviour nicely. Also, lots of the
> server already uses this as a bitmask, so changing that would be a lot
> more invasive.


This changes the server behaviour if 2 or more SDs are attached to the same
MD. In the current server, the button count is increased and the release is
sent when the _last_ SD releases the respective button.
With this patch, the release is sent for each SD that releases a button.

Reproducable by simply using mouse + touchpad, press button 1 on both, release
button 1 on both and the event sequence is 

press 1 - state 0x0 
  (second press is swallowed)
release 1 - state 0x100 
release 1 - state 0x0

The last is against the specs, and I vaguely remember that some apps don't
like it much.

To avoid that, we'd have to check in DeepCopyDeviceClasses whether we need to
copy the button states from each device, but at that point in time we only get
state, not delta (i.e. we don't know if the respective bit is set to 0 because
it was released or because it was never pressed in the first case). So the
current code, albeit messy, is preferable since it provides the correct


More information about the xorg mailing list