summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-10-06 16:08:21 +0300
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-10-06 16:08:21 +0300
commit4b6e2f12f7296e17b2850f36b3adcf8156125cbe (patch)
tree83d5ea09ac6b0de0d56f57378efbd6fe62701f7b /xkb
parentebf9b3bbbb04acb78cdf8a84e47a96755fbfe854 (diff)
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.
Diffstat (limited to 'xkb')
-rw-r--r--xkb/xkb.c87
1 files changed, 49 insertions, 38 deletions
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 23b9798dc..3052288fd 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -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 )
- return status;
-
- XkbComputeDerivedState(dev->key->xkbInfo);
- dev->key->state= XkbStateFieldFromRec(newState);
- changed = XkbStateChangedFlags(&oldState,newState);
- if (changed) {
- xkbStateNotify sn;
- sn.keycode= 0;
- sn.eventType= 0;
- sn.requestMajor = XkbReqCode;
- sn.requestMinor = X_kbLatchLockState;
- sn.changed= changed;
- XkbSendStateNotify(dev,&sn);
- changed= XkbIndicatorsToUpdate(dev,changed,False);
- if (changed) {
- XkbEventCauseRec cause;
- XkbSetCauseXkbReq(&cause,X_kbLatchLockState,client);
- XkbUpdateIndicators(dev,changed,True,NULL,&cause);
- }
+ 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(tmpd->key->xkbInfo);
+ tmpd->key->state = XkbStateFieldFromRec(newState);
+
+ changed = XkbStateChangedFlags(&oldState, newState);
+ if (changed) {
+ sn.keycode = 0;
+ sn.eventType = 0;
+ sn.requestMajor = XkbReqCode;
+ sn.requestMinor = X_kbLatchLockState;
+ sn.changed = changed;
+ XkbSendStateNotify(tmpd, &sn);
+ changed = XkbIndicatorsToUpdate(tmpd, changed, False);
+ if (changed) {
+ XkbSetCauseXkbReq(&cause, X_kbLatchLockState, client);
+ XkbUpdateIndicators(tmpd, changed, True, NULL, &cause);
+ }
+ }
+ }
}
+
return client->noClientException;
}