summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-09-29 00:34:23 +0300
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-09-29 00:34:23 +0300
commitad631afcf3fbc74024cddaaacd05d38addc047a2 (patch)
treeb7d57ec7a90d22615c8fe0053bd720bd42790e7c
parenta5d639cd87f30f9b3d765352d27253940f33b2b7 (diff)
make core keyboard/pointer map functions act on all core-sending devices
Make Set{Keyboard,Modifier,Pointer}Mapping act on all devices which send core events. Change LegalModifier to accept a DeviceIntPtr.
-rw-r--r--dix/devices.c496
-rw-r--r--hw/darwin/darwinKeyboard.c2
-rw-r--r--hw/dmx/dmxinput.c2
-rw-r--r--hw/kdrive/src/kinput.c2
-rw-r--r--hw/vfb/InitInput.c2
-rw-r--r--hw/xfree86/common/xf86Events.c2
-rw-r--r--hw/xgl/egl/module/xeglmodule.c2
-rw-r--r--hw/xgl/egl/xegl.c2
-rw-r--r--hw/xgl/egl/xegl.h2
-rw-r--r--hw/xgl/egl/xeglinit.c2
-rw-r--r--hw/xgl/glx/module/xglxmodule.c2
-rw-r--r--hw/xgl/glx/xglx.c2
-rw-r--r--hw/xgl/glx/xglx.h2
-rw-r--r--hw/xgl/glx/xglxinit.c2
-rw-r--r--hw/xgl/xglinit.c2
-rw-r--r--hw/xnest/Keyboard.c2
-rw-r--r--hw/xprint/ddxInit.c2
-rw-r--r--hw/xwin/InitInput.c2
-rw-r--r--include/input.h2
19 files changed, 297 insertions, 235 deletions
diff --git a/dix/devices.c b/dix/devices.c
index 60c2d297b..74474c9b9 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1139,112 +1139,102 @@ AllModifierKeysAreUp(dev, map1, per1, map2, per2)
return TRUE;
}
+static int
+DoSetModifierMapping(ClientPtr client, KeyCode *inputMap,
+ int numKeyPerModifier)
+{
+ KeyClassPtr keyc = NULL;
+ DeviceIntPtr pDev = NULL;
+ KeyCode *map = NULL;
+ int i = 0, inputMapLen = numKeyPerModifier * 8;
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
+ for (i = 0; i < inputMapLen; i++) {
+ /* Check that all the new modifiers fall within the advertised
+ * keycode range, and are okay with the DDX. */
+ if (inputMap[i] && ((inputMap[i] < pDev->key->curKeySyms.minKeyCode ||
+ inputMap[i] > pDev->key->curKeySyms.maxKeyCode) ||
+ !LegalModifier(inputMap[i], pDev))) {
+ client->errorValue = inputMap[i];
+ return BadValue;
+ }
+ }
+#ifdef XCSECURITY
+ if (!SecurityCheckDeviceAccess(client, pDev, TRUE))
+ return BadAccess;
+#endif
+ /* None of the modifiers (old or new) may be down while we change
+ * the map. */
+ if (!AllModifierKeysAreUp(pDev, pDev->key->modifierKeyMap,
+ pDev->key->maxKeysPerModifier,
+ inputMap, numKeyPerModifier) ||
+ !AllModifierKeysAreUp(pDev, inputMap, numKeyPerModifier,
+ pDev->key->modifierKeyMap,
+ pDev->key->maxKeysPerModifier)) {
+ return MappingBusy;
+ }
+ }
+ }
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
+ bzero(pDev->key->modifierMap, MAP_LENGTH);
+
+ /* Annoyingly, we lack a modifierKeyMap size, so we have to just free
+ * and re-alloc it every time. */
+ if (pDev->key->modifierKeyMap)
+ xfree(pDev->key->modifierKeyMap);
+
+ if (inputMapLen) {
+ pDev->key->modifierKeyMap = (KeyCode *) xalloc(inputMapLen);
+ if (!pDev->key->modifierKeyMap)
+ return BadAlloc;
+
+ memcpy(pDev->key->modifierKeyMap, inputMap, inputMapLen);
+ pDev->key->maxKeysPerModifier = numKeyPerModifier;
+
+ for (i = 0; i < inputMapLen; i++) {
+ if (inputMap[i]) {
+ pDev->key->modifierMap[inputMap[i]] |=
+ (1 << (((unsigned int)i) / numKeyPerModifier));
+ }
+ }
+ }
+ else {
+ pDev->key->modifierKeyMap = NULL;
+ }
+ }
+ }
+
+ return Success;
+}
+
int
ProcSetModifierMapping(ClientPtr client)
{
xSetModifierMappingReply rep;
REQUEST(xSetModifierMappingReq);
- KeyCode *inputMap;
- int inputMapLen;
register int i;
DeviceIntPtr keybd = inputInfo.keyboard;
- register KeyClassPtr keyc = keybd->key;
REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq);
- if (client->req_len != ((stuff->numKeyPerModifier<<1) +
- (sizeof (xSetModifierMappingReq)>>2)))
+ if (client->req_len != ((stuff->numKeyPerModifier << 1) +
+ (sizeof (xSetModifierMappingReq) >> 2)))
return BadLength;
- inputMapLen = 8*stuff->numKeyPerModifier;
- inputMap = (KeyCode *)&stuff[1];
-
- /*
- * Now enforce the restriction that "all of the non-zero keycodes must be
- * in the range specified by min-keycode and max-keycode in the
- * connection setup (else a Value error)"
- */
- i = inputMapLen;
- while (i--)
- {
- if (inputMap[i]
- && (inputMap[i] < keyc->curKeySyms.minKeyCode
- || inputMap[i] > keyc->curKeySyms.maxKeyCode))
- {
- client->errorValue = inputMap[i];
- return BadValue;
- }
- }
-
-#ifdef XCSECURITY
- if (!SecurityCheckDeviceAccess(client, keybd, TRUE))
- return BadAccess;
-#endif
-
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.success = MappingSuccess;
- /*
- * Now enforce the restriction that none of the old or new
- * modifier keys may be down while we change the mapping, and
- * that the DDX layer likes the choice.
- */
- if (!AllModifierKeysAreUp(keybd, keyc->modifierKeyMap,
- (int)keyc->maxKeysPerModifier,
- inputMap, (int)stuff->numKeyPerModifier)
- ||
- !AllModifierKeysAreUp(keybd, inputMap, (int)stuff->numKeyPerModifier,
- keyc->modifierKeyMap,
- (int)keyc->maxKeysPerModifier))
- {
- rep.success = MappingBusy;
- }
- else
- {
- for (i = 0; i < inputMapLen; i++)
- {
- if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr)keybd))
- {
- rep.success = MappingFailed;
- break;
- }
- }
- }
-
- if (rep.success == MappingSuccess)
- {
- KeyCode *map;
- /*
- * Now build the keyboard's modifier bitmap from the
- * list of keycodes.
- */
- map = (KeyCode *)xalloc(inputMapLen);
- if (!map && inputMapLen)
- return BadAlloc;
- if (keyc->modifierKeyMap)
- xfree(keyc->modifierKeyMap);
- keyc->modifierKeyMap = map;
- memmove((char *)map, (char *)inputMap, inputMapLen);
-
- keyc->maxKeysPerModifier = stuff->numKeyPerModifier;
- for (i = 0; i < MAP_LENGTH; i++)
- keyc->modifierMap[i] = 0;
- for (i = 0; i < inputMapLen; i++)
- {
- if (inputMap[i])
- keyc->modifierMap[inputMap[i]] |=
- (1<<(((unsigned int)i)/keyc->maxKeysPerModifier));
- }
- }
-
- if (rep.success == MappingSuccess)
- SendMappingNotify(MappingModifier, 0, 0, client);
+ rep.success = DoSetModifierMapping(client, (KeyCode *)&stuff[1],
+ stuff->numKeyPerModifier);
+ /* FIXME: Send mapping notifies for all the extended devices as well. */
+ SendMappingNotify(MappingModifier, 0, 0, client);
WriteReplyToClient(client, sizeof(xSetModifierMappingReply), &rep);
-
- return(client->noClientException);
+ return client->noClientException;
}
int
@@ -1274,40 +1264,80 @@ ProcChangeKeyboardMapping(ClientPtr client)
REQUEST(xChangeKeyboardMappingReq);
unsigned len;
KeySymsRec keysyms;
- register KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms;
+ KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms;
+ DeviceIntPtr pDev = NULL;
REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
len = client->req_len - (sizeof(xChangeKeyboardMappingReq) >> 2);
if (len != (stuff->keyCodes * stuff->keySymsPerKeyCode))
return BadLength;
+
if ((stuff->firstKeyCode < curKeySyms->minKeyCode) ||
- (stuff->firstKeyCode > curKeySyms->maxKeyCode))
- {
+ (stuff->firstKeyCode > curKeySyms->maxKeyCode)) {
client->errorValue = stuff->firstKeyCode;
return BadValue;
+
}
- if ( ((unsigned)(stuff->firstKeyCode + stuff->keyCodes - 1) >
- curKeySyms->maxKeyCode) ||
- (stuff->keySymsPerKeyCode == 0))
- {
+ if (((unsigned)(stuff->firstKeyCode + stuff->keyCodes - 1) >
+ curKeySyms->maxKeyCode) || (stuff->keySymsPerKeyCode == 0)) {
client->errorValue = stuff->keySymsPerKeyCode;
return BadValue;
}
+
#ifdef XCSECURITY
- if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard,
- TRUE))
- return BadAccess;
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
+ if (!SecurityCheckDeviceAccess(client, pDev, TRUE))
+ return BadAccess;
+ }
+ }
#endif
+
keysyms.minKeyCode = stuff->firstKeyCode;
keysyms.maxKeyCode = stuff->firstKeyCode + stuff->keyCodes - 1;
keysyms.mapWidth = stuff->keySymsPerKeyCode;
keysyms.map = (KeySym *)&stuff[1];
- if (!SetKeySymsMap(curKeySyms, &keysyms))
- return BadAlloc;
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
+ if (!SetKeySymsMap(&pDev->key->curKeySyms, &keysyms))
+ return BadAlloc;
+ }
+ }
+
+ /* FIXME: Send mapping notifies for all the extended devices as well. */
SendMappingNotify(MappingKeyboard, stuff->firstKeyCode, stuff->keyCodes,
- client);
+ client);
return client->noClientException;
+}
+
+static int
+DoSetPointerMapping(DeviceIntPtr device, BYTE *map, int n)
+{
+ int i = 0;
+ DeviceIntPtr dev = NULL;
+
+ if (!device || !device->button)
+ return BadDevice;
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
+ for (i = 0; i < n; i++) {
+ if ((device->button->map[i + 1] != map[i]) &&
+ BitIsOn(device->button->down, i + 1)) {
+ return MappingBusy;
+ }
+ }
+ }
+ }
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
+ for (i = 0; i < n; i++)
+ dev->button->map[i + 1] = map[i];
+ }
+ }
+ return Success;
}
int
@@ -1315,9 +1345,9 @@ ProcSetPointerMapping(ClientPtr client)
{
REQUEST(xSetPointerMappingReq);
BYTE *map;
+ int ret;
xSetPointerMappingReply rep;
- register unsigned int i;
- DeviceIntPtr mouse = inputInfo.pointer;
+ unsigned int i;
REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq);
if (client->req_len != (sizeof(xSetPointerMappingReq)+stuff->nElts+3) >> 2)
@@ -1327,23 +1357,24 @@ ProcSetPointerMapping(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.success = MappingSuccess;
map = (BYTE *)&stuff[1];
- if (stuff->nElts != mouse->button->numButtons)
- {
+
+ /* So we're bounded here by the number of core buttons. This check
+ * probably wants disabling through XFixes. */
+ if (stuff->nElts != inputInfo.pointer->button->numButtons) {
client->errorValue = stuff->nElts;
return BadValue;
}
if (BadDeviceMap(&map[0], (int)stuff->nElts, 1, 255, &client->errorValue))
return BadValue;
- for (i=0; i < stuff->nElts; i++)
- if ((mouse->button->map[i + 1] != map[i]) &&
- BitIsOn(mouse->button->down, i + 1))
- {
- rep.success = MappingBusy;
- WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
- return Success;
- }
- for (i = 0; i < stuff->nElts; i++)
- mouse->button->map[i + 1] = map[i];
+
+ ret = DoSetPointerMapping(inputInfo.pointer, map, stuff->nElts);
+ if (ret != Success) {
+ rep.success = ret;
+ WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
+ return Success;
+ }
+
+ /* FIXME: Send mapping notifies for all the extended devices as well. */
SendMappingNotify(MappingPointer, 0, 0, client);
WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
return Success;
@@ -1359,14 +1390,12 @@ ProcGetKeyboardMapping(ClientPtr client)
REQUEST_SIZE_MATCH(xGetKeyboardMappingReq);
if ((stuff->firstKeyCode < curKeySyms->minKeyCode) ||
- (stuff->firstKeyCode > curKeySyms->maxKeyCode))
- {
+ (stuff->firstKeyCode > curKeySyms->maxKeyCode)) {
client->errorValue = stuff->firstKeyCode;
return BadValue;
}
if (stuff->firstKeyCode + stuff->count >
- (unsigned)(curKeySyms->maxKeyCode + 1))
- {
+ (unsigned)(curKeySyms->maxKeyCode + 1)) {
client->errorValue = stuff->count;
return BadValue;
}
@@ -1423,47 +1452,31 @@ Ones(unsigned long mask) /* HACKMEM 169 */
return (((y + (y >> 3)) & 030707070707) % 077);
}
-int
-ProcChangeKeyboardControl (ClientPtr client)
+static int
+DoChangeKeyboardControl (ClientPtr client, DeviceIntPtr keybd, XID *vlist,
+ BITS32 vmask)
{
#define DO_ALL (-1)
KeybdCtrl ctrl;
- DeviceIntPtr keybd = inputInfo.keyboard;
- XID *vlist;
int t;
int led = DO_ALL;
int key = DO_ALL;
- BITS32 vmask, index2;
- int mask, i;
- REQUEST(xChangeKeyboardControlReq);
-
- REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
+ BITS32 index2;
+ int mask = vmask, i;
+ DeviceIntPtr dev = NULL;
- if (!keybd->kbdfeed->CtrlProc)
- return BadDevice;
-
- vmask = stuff->mask;
- if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
- return BadLength;
-#ifdef XCSECURITY
- if (!SecurityCheckDeviceAccess(client, keybd, TRUE))
- return BadAccess;
-#endif
- vlist = (XID *)&stuff[1]; /* first word of values */
ctrl = keybd->kbdfeed->ctrl;
- while (vmask)
- {
+ while (vmask) {
index2 = (BITS32) lowbit (vmask);
vmask &= ~index2;
- switch (index2)
- {
+ switch (index2) {
case KBKeyClickPercent:
t = (INT8)*vlist;
vlist++;
- if (t == -1)
+ if (t == -1) {
t = defaultKeyboardControl.click;
- else if (t < 0 || t > 100)
- {
+ }
+ else if (t < 0 || t > 100) {
client->errorValue = t;
return BadValue;
}
@@ -1472,10 +1485,10 @@ ProcChangeKeyboardControl (ClientPtr client)
case KBBellPercent:
t = (INT8)*vlist;
vlist++;
- if (t == -1)
+ if (t == -1) {
t = defaultKeyboardControl.bell;
- else if (t < 0 || t > 100)
- {
+ }
+ else if (t < 0 || t > 100) {
client->errorValue = t;
return BadValue;
}
@@ -1484,10 +1497,10 @@ ProcChangeKeyboardControl (ClientPtr client)
case KBBellPitch:
t = (INT16)*vlist;
vlist++;
- if (t == -1)
+ if (t == -1) {
t = defaultKeyboardControl.bell_pitch;
- else if (t < 0)
- {
+ }
+ else if (t < 0) {
client->errorValue = t;
return BadValue;
}
@@ -1498,8 +1511,7 @@ ProcChangeKeyboardControl (ClientPtr client)
vlist++;
if (t == -1)
t = defaultKeyboardControl.bell_duration;
- else if (t < 0)
- {
+ else if (t < 0) {
client->errorValue = t;
return BadValue;
}
@@ -1508,56 +1520,51 @@ ProcChangeKeyboardControl (ClientPtr client)
case KBLed:
led = (CARD8)*vlist;
vlist++;
- if (led < 1 || led > 32)
- {
+ if (led < 1 || led > 32) {
client->errorValue = led;
return BadValue;
}
- if (!(stuff->mask & KBLedMode))
+ if (!(mask & KBLedMode))
return BadMatch;
break;
case KBLedMode:
t = (CARD8)*vlist;
vlist++;
- if (t == LedModeOff)
- {
+ if (t == LedModeOff) {
if (led == DO_ALL)
ctrl.leds = 0x0;
else
ctrl.leds &= ~(((Leds)(1)) << (led - 1));
}
- else if (t == LedModeOn)
- {
+ else if (t == LedModeOn) {
if (led == DO_ALL)
ctrl.leds = ~0L;
else
ctrl.leds |= (((Leds)(1)) << (led - 1));
}
- else
- {
+ else {
client->errorValue = t;
return BadValue;
}
#ifdef XKB
- if (!noXkbExtension) {
- XkbEventCauseRec cause;
- XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client);
- XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))),
+ if (!noXkbExtension) {
+ XkbEventCauseRec cause;
+ XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client);
+ XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))),
ctrl.leds, &cause);
- ctrl.leds = keybd->kbdfeed->ctrl.leds;
- }
+ ctrl.leds = keybd->kbdfeed->ctrl.leds;
+ }
#endif
break;
case KBKey:
key = (KeyCode)*vlist;
vlist++;
if ((KeyCode)key < inputInfo.keyboard->key->curKeySyms.minKeyCode ||
- (KeyCode)key > inputInfo.keyboard->key->curKeySyms.maxKeyCode)
- {
+ (KeyCode)key > inputInfo.keyboard->key->curKeySyms.maxKeyCode) {
client->errorValue = key;
return BadValue;
}
- if (!(stuff->mask & KBAutoRepeatMode))
+ if (!(mask & KBAutoRepeatMode))
return BadMatch;
break;
case KBAutoRepeatMode:
@@ -1566,25 +1573,22 @@ ProcChangeKeyboardControl (ClientPtr client)
t = (CARD8)*vlist;
vlist++;
#ifdef XKB
- if (!noXkbExtension && key != DO_ALL)
- XkbDisableComputedAutoRepeats(keybd,key);
+ if (!noXkbExtension && key != DO_ALL)
+ XkbDisableComputedAutoRepeats(keybd,key);
#endif
- if (t == AutoRepeatModeOff)
- {
+ if (t == AutoRepeatModeOff) {
if (key == DO_ALL)
ctrl.autoRepeat = FALSE;
else
ctrl.autoRepeats[i] &= ~mask;
}
- else if (t == AutoRepeatModeOn)
- {
+ else if (t == AutoRepeatModeOn) {
if (key == DO_ALL)
ctrl.autoRepeat = TRUE;
else
ctrl.autoRepeats[i] |= mask;
}
- else if (t == AutoRepeatModeDefault)
- {
+ else if (t == AutoRepeatModeDefault) {
if (key == DO_ALL)
ctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
else
@@ -1592,32 +1596,72 @@ ProcChangeKeyboardControl (ClientPtr client)
(ctrl.autoRepeats[i] & ~mask) |
(defaultKeyboardControl.autoRepeats[i] & mask);
}
- else
- {
+ else {
client->errorValue = t;
return BadValue;
}
break;
default:
- client->errorValue = stuff->mask;
+ client->errorValue = mask;
return BadValue;
}
}
keybd->kbdfeed->ctrl = ctrl;
+
#ifdef XKB
/* The XKB RepeatKeys control and core protocol global autorepeat */
/* value are linked */
- if (!noXkbExtension) {
- XkbSetRepeatKeys(keybd,key,keybd->kbdfeed->ctrl.autoRepeat);
- }
+ if (!noXkbExtension)
+ XkbSetRepeatKeys(keybd, key, keybd->kbdfeed->ctrl.autoRepeat);
else
#endif
- (*keybd->kbdfeed->CtrlProc)(keybd, &keybd->kbdfeed->ctrl);
+ (*keybd->kbdfeed->CtrlProc)(keybd, &keybd->kbdfeed->ctrl);
+
return Success;
+
#undef DO_ALL
}
int
+ProcChangeKeyboardControl (ClientPtr client)
+{
+ XID *vlist;
+ BITS32 vmask;
+ int ret = Success, error = Success;
+ DeviceIntPtr pDev = NULL;
+ REQUEST(xChangeKeyboardControlReq);
+
+ REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
+
+ vmask = stuff->mask;
+ vlist = (XID *)&stuff[1];
+
+ if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
+ return BadLength;
+
+#ifdef XCSECURITY
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) &&
+ pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
+ if (!SecurityCheckDeviceAccess(client, pDev, TRUE))
+ return BadAccess;
+ }
+ }
+#endif
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) &&
+ pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
+ ret = DoChangeKeyboardControl(client, pDev, vlist, vmask);
+ if (ret != Success)
+ error = ret;
+ }
+ }
+
+ return error;
+}
+
+int
ProcGetKeyboardControl (ClientPtr client)
{
int i;
@@ -1652,24 +1696,31 @@ ProcBell(ClientPtr client)
if (!keybd->kbdfeed->BellProc)
return BadDevice;
- if (stuff->percent < -100 || stuff->percent > 100)
- {
+ if (stuff->percent < -100 || stuff->percent > 100) {
client->errorValue = stuff->percent;
return BadValue;
}
+
newpercent = (base * stuff->percent) / 100;
if (stuff->percent < 0)
newpercent = base + newpercent;
else
newpercent = base - newpercent + stuff->percent;
+
+ for (keybd = inputInfo.devices; keybd; keybd = keybd->next) {
+ if ((keybd->coreEvents || keybd == inputInfo.keyboard) &&
+ keybd->kbdfeed && keybd->kbdfeed->BellProc) {
#ifdef XKB
- if (!noXkbExtension)
- XkbHandleBell(FALSE,FALSE, keybd, newpercent, &keybd->kbdfeed->ctrl, 0,
- None, NULL, client);
- else
+ if (!noXkbExtension)
+ XkbHandleBell(FALSE, FALSE, keybd, newpercent,
+ &keybd->kbdfeed->ctrl, 0, None, NULL, client);
+ else
#endif
- (*keybd->kbdfeed->BellProc)(newpercent, keybd,
- (pointer) &keybd->kbdfeed->ctrl, 0);
+ (*keybd->kbdfeed->BellProc)(newpercent, keybd,
+ &keybd->kbdfeed->ctrl, 0);
+ }
+ }
+
return Success;
}
@@ -1686,48 +1737,59 @@ ProcChangePointerControl(ClientPtr client)
return BadDevice;
ctrl = mouse->ptrfeed->ctrl;
- if ((stuff->doAccel != xTrue) && (stuff->doAccel != xFalse))
- {
+ if ((stuff->doAccel != xTrue) && (stuff->doAccel != xFalse)) {
client->errorValue = stuff->doAccel;
return(BadValue);
}
- if ((stuff->doThresh != xTrue) && (stuff->doThresh != xFalse))
- {
+ if ((stuff->doThresh != xTrue) && (stuff->doThresh != xFalse)) {
client->errorValue = stuff->doThresh;
return(BadValue);
}
- if (stuff->doAccel)
- {
- if (stuff->accelNum == -1)
+ if (stuff->doAccel) {
+ if (stuff->accelNum == -1) {
ctrl.num = defaultPointerControl.num;
- else if (stuff->accelNum < 0)
- {
+ }
+ else if (stuff->accelNum < 0) {
client->errorValue = stuff->accelNum;
return BadValue;
}
- else ctrl.num = stuff->accelNum;
- if (stuff->accelDenum == -1)
+ else {
+ ctrl.num = stuff->accelNum;
+ }
+
+ if (stuff->accelDenum == -1) {
ctrl.den = defaultPointerControl.den;
- else if (stuff->accelDenum <= 0)
- {
+ }
+ else if (stuff->accelDenum <= 0) {
client->errorValue = stuff->accelDenum;
return BadValue;
}
- else ctrl.den = stuff->accelDenum;
+ else {
+ ctrl.den = stuff->accelDenum;
+ }
}
- if (stuff->doThresh)
- {
- if (stuff->threshold == -1)
+ if (stuff->doThresh) {
+ if (stuff->threshold == -1) {
ctrl.threshold = defaultPointerControl.threshold;
- else if (stuff->threshold < 0)
- {
+ }
+ else if (stuff->threshold < 0) {
client->errorValue = stuff->threshold;
return BadValue;
}
- else ctrl.threshold = stuff->threshold;
+ else {
+ ctrl.threshold = stuff->threshold;
+ }
}
- mouse->ptrfeed->ctrl = ctrl;
- (*mouse->ptrfeed->CtrlProc)(mouse, &mouse->ptrfeed->ctrl);
+
+
+ for (mouse = inputInfo.devices; mouse; mouse = mouse->next) {
+ if ((mouse->coreEvents || mouse == inputInfo.pointer) &&
+ mouse->ptrfeed && mouse->ptrfeed->CtrlProc) {
+ mouse->ptrfeed->ctrl = ctrl;
+ (*mouse->ptrfeed->CtrlProc)(mouse, &mouse->ptrfeed->ctrl);
+ }
+ }
+
return Success;
}
diff --git a/hw/darwin/darwinKeyboard.c b/hw/darwin/darwinKeyboard.c
index c148d96ce..1cc49fe8e 100644
--- a/hw/darwin/darwinKeyboard.c
+++ b/hw/darwin/darwinKeyboard.c
@@ -1020,7 +1020,7 @@ int DarwinModifierStringToNXKey(const char *str)
* This allows the ddx layer to prevent some keys from being remapped
* as modifier keys.
*/
-Bool LegalModifier(unsigned int key, DevicePtr pDev)
+Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return 1;
}
diff --git a/hw/dmx/dmxinput.c b/hw/dmx/dmxinput.c
index 7c376dee4..37f458356 100644
--- a/hw/dmx/dmxinput.c
+++ b/hw/dmx/dmxinput.c
@@ -53,7 +53,7 @@
/** Returns TRUE if the key is a valid modifier. For PC-class
* keyboards, all keys can be used as modifiers, so return TRUE
* always. */
-Bool LegalModifier(unsigned int key, DevicePtr pDev)
+Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index a41fddb83..3915436f8 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -516,7 +516,7 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
}
Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index 773c45420..17e023a57 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -43,7 +43,7 @@ from The Open Group.
#include <X11/keysym.h>
Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 45a50d82b..ff3840cf9 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -164,7 +164,7 @@ static IHPtr InputHandlers = NULL;
Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
diff --git a/hw/xgl/egl/module/xeglmodule.c b/hw/xgl/egl/module/xeglmodule.c
index ff695f614..abd0d0d75 100644
--- a/hw/xgl/egl/module/xeglmodule.c
+++ b/hw/xgl/egl/module/xeglmodule.c
@@ -52,7 +52,7 @@ InitOutput (ScreenInfo *pScreenInfo,
Bool
LegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return xeglLegalModifier (key, pDev);
}
diff --git a/hw/xgl/egl/xegl.c b/hw/xgl/egl/xegl.c
index 70db7c083..c671dbe7c 100644
--- a/hw/xgl/egl/xegl.c
+++ b/hw/xgl/egl/xegl.c
@@ -252,7 +252,7 @@ xeglInitInput (int argc,
Bool
xeglLegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return KdLegalModifier (key, pDev);
}
diff --git a/hw/xgl/egl/xegl.h b/hw/xgl/egl/xegl.h
index cf21fca95..be9b48c9c 100644
--- a/hw/xgl/egl/xegl.h
+++ b/hw/xgl/egl/xegl.h
@@ -173,7 +173,7 @@ KdWakeupHandler (pointer data,
Bool
KdLegalModifier (unsigned int key,
- DevicePtr pDev);
+ DeviceIntPtr pDev);
void
KdProcessInputEvents (void);
diff --git a/hw/xgl/egl/xeglinit.c b/hw/xgl/egl/xeglinit.c
index 51100a4d1..c28d946ac 100644
--- a/hw/xgl/egl/xeglinit.c
+++ b/hw/xgl/egl/xeglinit.c
@@ -58,7 +58,7 @@ InitOutput (ScreenInfo *pScreenInfo,
Bool
LegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return xeglLegalModifier (key, pDev);
}
diff --git a/hw/xgl/glx/module/xglxmodule.c b/hw/xgl/glx/module/xglxmodule.c
index 066cb8082..40af8907d 100644
--- a/hw/xgl/glx/module/xglxmodule.c
+++ b/hw/xgl/glx/module/xglxmodule.c
@@ -52,7 +52,7 @@ InitOutput (ScreenInfo *pScreenInfo,
Bool
LegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return xglxLegalModifier (key, pDev);
}
diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c
index 1ded3e304..57cb84702 100644
--- a/hw/xgl/glx/xglx.c
+++ b/hw/xgl/glx/xglx.c
@@ -1243,7 +1243,7 @@ xglxKeybdProc (DeviceIntPtr pDevice,
Bool
xglxLegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return TRUE;
}
diff --git a/hw/xgl/glx/xglx.h b/hw/xgl/glx/xglx.h
index b0c5d3d70..a8c894661 100644
--- a/hw/xgl/glx/xglx.h
+++ b/hw/xgl/glx/xglx.h
@@ -91,7 +91,7 @@ xglxInitOutput (ScreenInfo *pScreenInfo,
Bool
xglxLegalModifier (unsigned int key,
- DevicePtr pDev);
+ DeviceIntPtr pDev);
void
xglxProcessInputEvents (void);
diff --git a/hw/xgl/glx/xglxinit.c b/hw/xgl/glx/xglxinit.c
index 50bbca52b..b87e5d682 100644
--- a/hw/xgl/glx/xglxinit.c
+++ b/hw/xgl/glx/xglxinit.c
@@ -81,7 +81,7 @@ InitOutput (ScreenInfo *pScreenInfo,
Bool
LegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return xglxLegalModifier (key, pDev);
}
diff --git a/hw/xgl/xglinit.c b/hw/xgl/xglinit.c
index 3d93c46cc..e0c9e7ded 100644
--- a/hw/xgl/xglinit.c
+++ b/hw/xgl/xglinit.c
@@ -192,7 +192,7 @@ InitOutput (ScreenInfo *pScreenInfo,
Bool
LegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return (*__ddxFunc.legalModifier) (key, pDev);
}
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index f18cc9760..26a5ed3fb 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -253,7 +253,7 @@ XkbError:
}
Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
diff --git a/hw/xprint/ddxInit.c b/hw/xprint/ddxInit.c
index 6cd3cfd3c..77b532fd5 100644
--- a/hw/xprint/ddxInit.c
+++ b/hw/xprint/ddxInit.c
@@ -189,7 +189,7 @@ InitInput(
Bool
LegalModifier(
unsigned int key,
- DevicePtr dev)
+ DeviceIntPtr dev)
{
return TRUE;
}
diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c
index f4796e079..52f837ede 100644
--- a/hw/xwin/InitInput.c
+++ b/hw/xwin/InitInput.c
@@ -79,7 +79,7 @@ extern winDispatchProcPtr winProcQueryTreeOrig;
*/
Bool
-LegalModifier (unsigned int uiKey, DevicePtr pDevice)
+LegalModifier (unsigned int uiKey, DeviceIntPtr pDevice)
{
return TRUE;
}
diff --git a/include/input.h b/include/input.h
index 6573a1fca..66d03d0fb 100644
--- a/include/input.h
+++ b/include/input.h
@@ -371,7 +371,7 @@ extern void CoreProcessKeyboardEvent(
extern Bool LegalModifier(
unsigned int /*key*/,
- DevicePtr /*pDev*/);
+ DeviceIntPtr /*pDev*/);
extern void ProcessInputEvents(void);