xkb: make LatchLockGroup work on all core-sending devices

Apply the settings to all devices sending core events, if we're working on the
core keyboard.
This commit is contained in:
Daniel Stone 2006-10-06 16:08:21 +03:00 committed by Daniel Stone
parent ebf9b3bbbb
commit 4b6e2f12f7

View File

@ -534,56 +534,67 @@ int
ProcXkbLatchLockState(ClientPtr client)
{
int status;
DeviceIntPtr dev;
DeviceIntPtr dev, tmpd;
XkbStateRec oldState,*newState;
CARD16 changed;
xkbStateNotify sn;
XkbEventCauseRec cause;
REQUEST(xkbLatchLockStateReq);
REQUEST_SIZE_MATCH(xkbLatchLockStateReq);
if (!(client->xkbClientFlags&_XkbClientInitialized))
if (!(client->xkbClientFlags & _XkbClientInitialized))
return BadAccess;
CHK_KBD_DEVICE(dev,stuff->deviceSpec);
CHK_MASK_MATCH(0x01,stuff->affectModLocks,stuff->modLocks);
CHK_MASK_MATCH(0x01,stuff->affectModLatches,stuff->modLatches);
CHK_KBD_DEVICE(dev, stuff->deviceSpec);
CHK_MASK_MATCH(0x01, stuff->affectModLocks, stuff->modLocks);
CHK_MASK_MATCH(0x01, stuff->affectModLatches, stuff->modLatches);
status = Success;
oldState= dev->key->xkbInfo->state;
newState= &dev->key->xkbInfo->state;
if ( stuff->affectModLocks ) {
newState->locked_mods&= ~stuff->affectModLocks;
newState->locked_mods|= (stuff->affectModLocks&stuff->modLocks);
}
if (( status == Success ) && stuff->lockGroup )
newState->locked_group = stuff->groupLock;
if (( status == Success ) && stuff->affectModLatches )
status=XkbLatchModifiers(dev,stuff->affectModLatches,stuff->modLatches);
if (( status == Success ) && stuff->latchGroup )
status=XkbLatchGroup(dev,stuff->groupLatch);
if ( status != Success )
for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
if ((dev == inputInfo.keyboard && tmpd->key && tmpd->coreEvents) ||
tmpd == inputInfo.keyboard) {
if (!tmpd->key->xkbInfo)
continue;
oldState = tmpd->key->xkbInfo->state;
newState = &tmpd->key->xkbInfo->state;
if (stuff->affectModLocks) {
newState->locked_mods &= ~stuff->affectModLocks;
newState->locked_mods |= (stuff->affectModLocks & stuff->modLocks);
}
if (status == Success && stuff->lockGroup)
newState->locked_group = stuff->groupLock;
if (status == Success && stuff->affectModLatches)
status = XkbLatchModifiers(tmpd, stuff->affectModLatches,
stuff->modLatches);
if (status == Success && stuff->latchGroup)
status = XkbLatchGroup(tmp, stuff->groupLatch);
if (status != Success)
return status;
XkbComputeDerivedState(dev->key->xkbInfo);
dev->key->state= XkbStateFieldFromRec(newState);
XkbComputeDerivedState(tmpd->key->xkbInfo);
tmpd->key->state = XkbStateFieldFromRec(newState);
changed = XkbStateChangedFlags(&oldState,newState);
changed = XkbStateChangedFlags(&oldState, newState);
if (changed) {
xkbStateNotify sn;
sn.keycode= 0;
sn.eventType= 0;
sn.keycode = 0;
sn.eventType = 0;
sn.requestMajor = XkbReqCode;
sn.requestMinor = X_kbLatchLockState;
sn.changed= changed;
XkbSendStateNotify(dev,&sn);
changed= XkbIndicatorsToUpdate(dev,changed,False);
sn.changed = changed;
XkbSendStateNotify(tmpd, &sn);
changed = XkbIndicatorsToUpdate(tmpd, changed, False);
if (changed) {
XkbEventCauseRec cause;
XkbSetCauseXkbReq(&cause,X_kbLatchLockState,client);
XkbUpdateIndicators(dev,changed,True,NULL,&cause);
XkbSetCauseXkbReq(&cause, X_kbLatchLockState, client);
XkbUpdateIndicators(tmpd, changed, True, NULL, &cause);
}
}
}
}
return client->noClientException;
}