[PATCH] xkb: merge lockedPtrButtons state from all attached SDs.

Peter Hutterer peter.hutterer at who-t.net
Mon Jun 28 23:02:15 PDT 2010


On Mon, Jun 28, 2010 at 10:30:24PM -0700, Keith Packard wrote:
> On Tue, 29 Jun 2010 14:05:52 +1000, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> 
> > +
> > +/* Merge the lockedPtrButtons from all attached SDs for the given master
> > + * device into the MD's state.
> > + */
> > +void
> > +XkbMergeLockedPtrBtns(DeviceIntPtr master)
> > +{
> > +    DeviceIntPtr d = inputInfo.devices;
> > +    XkbSrvInfoPtr xkbi = NULL;
> > +
> > +    if (!master->key)
> > +        return;
> > +
> > +    xkbi = master->key->xkbInfo;
> > +
> > +    for (; d; d = d->next) {
> > +        if (IsMaster(d) || GetMaster(d, MASTER_KEYBOARD) != master || !d->key)
> > +            continue;
> > +
> > +        xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons;
> > +    }
> > +}
> 
> Should this function set xkbi->lockedPtrButtons to 0 before looping over
> the devices? Otherwise, it seems like this function is misnamed (not
> that I understand what the code is doing...)

I don't think it would have any effect, positive or negative.
As it stands, the MD's bit is cleared in the caller already. Thus in the
cases where xkbi->lockedPtrButtons isn't already 0, at least one SD should
still have the bit set and the bit comes back here.

So if it makes the code more obvious, I can put it in.
Alternatively, I can name it XkbMergeInLockedPtrBtns, if that expresses the
actual workings better. Or whatever else you can come up with that's more
expressive.

Cheers,
  Peter


More information about the xorg-devel mailing list