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:
parent
ebf9b3bbbb
commit
4b6e2f12f7
41
xkb/xkb.c
41
xkb/xkb.c
|
@ -534,9 +534,11 @@ int
|
||||||
ProcXkbLatchLockState(ClientPtr client)
|
ProcXkbLatchLockState(ClientPtr client)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev, tmpd;
|
||||||
XkbStateRec oldState,*newState;
|
XkbStateRec oldState,*newState;
|
||||||
CARD16 changed;
|
CARD16 changed;
|
||||||
|
xkbStateNotify sn;
|
||||||
|
XkbEventCauseRec cause;
|
||||||
|
|
||||||
REQUEST(xkbLatchLockStateReq);
|
REQUEST(xkbLatchLockStateReq);
|
||||||
REQUEST_SIZE_MATCH(xkbLatchLockStateReq);
|
REQUEST_SIZE_MATCH(xkbLatchLockStateReq);
|
||||||
|
@ -549,41 +551,50 @@ ProcXkbLatchLockState(ClientPtr client)
|
||||||
CHK_MASK_MATCH(0x01, stuff->affectModLatches, stuff->modLatches);
|
CHK_MASK_MATCH(0x01, stuff->affectModLatches, stuff->modLatches);
|
||||||
|
|
||||||
status = Success;
|
status = Success;
|
||||||
oldState= dev->key->xkbInfo->state;
|
|
||||||
newState= &dev->key->xkbInfo->state;
|
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) {
|
if (stuff->affectModLocks) {
|
||||||
newState->locked_mods &= ~stuff->affectModLocks;
|
newState->locked_mods &= ~stuff->affectModLocks;
|
||||||
newState->locked_mods |= (stuff->affectModLocks & stuff->modLocks);
|
newState->locked_mods |= (stuff->affectModLocks & stuff->modLocks);
|
||||||
}
|
}
|
||||||
if (( status == Success ) && stuff->lockGroup )
|
if (status == Success && stuff->lockGroup)
|
||||||
newState->locked_group = stuff->groupLock;
|
newState->locked_group = stuff->groupLock;
|
||||||
if (( status == Success ) && stuff->affectModLatches )
|
if (status == Success && stuff->affectModLatches)
|
||||||
status=XkbLatchModifiers(dev,stuff->affectModLatches,stuff->modLatches);
|
status = XkbLatchModifiers(tmpd, stuff->affectModLatches,
|
||||||
if (( status == Success ) && stuff->latchGroup )
|
stuff->modLatches);
|
||||||
status=XkbLatchGroup(dev,stuff->groupLatch);
|
if (status == Success && stuff->latchGroup)
|
||||||
|
status = XkbLatchGroup(tmp, stuff->groupLatch);
|
||||||
|
|
||||||
if (status != Success)
|
if (status != Success)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
XkbComputeDerivedState(dev->key->xkbInfo);
|
XkbComputeDerivedState(tmpd->key->xkbInfo);
|
||||||
dev->key->state= XkbStateFieldFromRec(newState);
|
tmpd->key->state = XkbStateFieldFromRec(newState);
|
||||||
|
|
||||||
changed = XkbStateChangedFlags(&oldState, newState);
|
changed = XkbStateChangedFlags(&oldState, newState);
|
||||||
if (changed) {
|
if (changed) {
|
||||||
xkbStateNotify sn;
|
|
||||||
sn.keycode = 0;
|
sn.keycode = 0;
|
||||||
sn.eventType = 0;
|
sn.eventType = 0;
|
||||||
sn.requestMajor = XkbReqCode;
|
sn.requestMajor = XkbReqCode;
|
||||||
sn.requestMinor = X_kbLatchLockState;
|
sn.requestMinor = X_kbLatchLockState;
|
||||||
sn.changed = changed;
|
sn.changed = changed;
|
||||||
XkbSendStateNotify(dev,&sn);
|
XkbSendStateNotify(tmpd, &sn);
|
||||||
changed= XkbIndicatorsToUpdate(dev,changed,False);
|
changed = XkbIndicatorsToUpdate(tmpd, changed, False);
|
||||||
if (changed) {
|
if (changed) {
|
||||||
XkbEventCauseRec cause;
|
|
||||||
XkbSetCauseXkbReq(&cause, X_kbLatchLockState, client);
|
XkbSetCauseXkbReq(&cause, X_kbLatchLockState, client);
|
||||||
XkbUpdateIndicators(dev,changed,True,NULL,&cause);
|
XkbUpdateIndicators(tmpd, changed, True, NULL, &cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return client->noClientException;
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue