Input: Ignore modifiers in core input processing

Modifiers get cleared by the XKB code when we drop down into core input
processing, so just delete the dead code path to simplify things a bit.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Daniel Stone 2008-03-30 17:25:39 +03:00
parent 6727ee9408
commit cf6a2fc2bd
3 changed files with 2 additions and 36 deletions

View File

@ -763,8 +763,6 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
ValuatorClassPtr v = NULL; ValuatorClassPtr v = NULL;
deviceValuator *xV = (deviceValuator *) xE; deviceValuator *xV = (deviceValuator *) xE;
BYTE *kptr = NULL; BYTE *kptr = NULL;
CARD16 modifiers = 0,
mask = 0;
/* This event is always the first we get, before the actual events with /* This event is always the first we get, before the actual events with
* the data. However, the way how the DDX is set up, "device" will * the data. However, the way how the DDX is set up, "device" will
@ -855,7 +853,6 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
if (!k) if (!k)
return DONT_PROCESS; return DONT_PROCESS;
modifiers = k->modifierMap[key];
kptr = &k->down[key >> 3]; kptr = &k->down[key >> 3];
if (*kptr & bit) { /* allow ddx to generate multiple downs */ if (*kptr & bit) { /* allow ddx to generate multiple downs */
return IS_REPEAT; return IS_REPEAT;
@ -863,13 +860,6 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
if (device->valuator) if (device->valuator)
device->valuator->motionHintWindow = NullWindow; device->valuator->motionHintWindow = NullWindow;
*kptr |= bit; *kptr |= bit;
for (i = 0, mask = 1; modifiers; i++, mask <<= 1) {
if (mask & modifiers) {
/* This key affects modifier "i" */
k->modifierKeyCount[i]++;
modifiers &= ~mask;
}
}
} else if (xE->u.u.type == DeviceKeyRelease) { } else if (xE->u.u.type == DeviceKeyRelease) {
if (!k) if (!k)
return DONT_PROCESS; return DONT_PROCESS;
@ -877,19 +867,9 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
kptr = &k->down[key >> 3]; kptr = &k->down[key >> 3];
if (!(*kptr & bit)) /* guard against duplicates */ if (!(*kptr & bit)) /* guard against duplicates */
return DONT_PROCESS; return DONT_PROCESS;
modifiers = k->modifierMap[key];
if (device->valuator) if (device->valuator)
device->valuator->motionHintWindow = NullWindow; device->valuator->motionHintWindow = NullWindow;
*kptr &= ~bit; *kptr &= ~bit;
for (i = 0, mask = 1; modifiers; i++, mask <<= 1) {
if (mask & modifiers) {
/* This key affects modifier "i" */
if (--k->modifierKeyCount[i] <= 0) {
k->modifierKeyCount[i] = 0;
}
modifiers &= ~mask;
}
}
} else if (xE->u.u.type == DeviceButtonPress) { } else if (xE->u.u.type == DeviceButtonPress) {
if (!b) if (!b)
return DONT_PROCESS; return DONT_PROCESS;

View File

@ -3663,7 +3663,6 @@ CoreProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count)
{ {
int key, bit; int key, bit;
BYTE *kptr; BYTE *kptr;
CARD8 modifiers;
GrabPtr grab; GrabPtr grab;
GrabInfoPtr grabinfo; GrabInfoPtr grabinfo;
Bool deactivateGrab = FALSE; Bool deactivateGrab = FALSE;
@ -3694,7 +3693,6 @@ CoreProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count)
key = xE->u.u.detail; key = xE->u.u.detail;
kptr = &keyc->down[key >> 3]; kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7); bit = 1 << (key & 7);
modifiers = keyc->modifierMap[key];
switch (xE->u.u.type) switch (xE->u.u.type)
{ {

View File

@ -798,7 +798,6 @@ _XkbFilterRedirectKey( XkbSrvInfoPtr xkbi,
unsigned keycode, unsigned keycode,
XkbAction * pAction) XkbAction * pAction)
{ {
unsigned realMods = 0;
xEvent ev; xEvent ev;
int x,y; int x,y;
XkbStateRec old; XkbStateRec old;
@ -852,13 +851,10 @@ ProcessInputProc backupproc;
XkbComputeDerivedState(xkbi); XkbComputeDerivedState(xkbi);
} }
realMods = xkbi->device->key->modifierMap[ev.u.u.detail];
xkbi->device->key->modifierMap[ev.u.u.detail] = 0;
UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc); UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc);
xkbi->device->public.processInputProc(&ev,xkbi->device,1); xkbi->device->public.processInputProc(&ev,xkbi->device,1);
COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
backupproc,xkbUnwrapProc); backupproc,xkbUnwrapProc);
xkbi->device->key->modifierMap[ev.u.u.detail] = realMods;
if ( mask || mods ) if ( mask || mods )
xkbi->state= old; xkbi->state= old;
@ -887,13 +883,10 @@ ProcessInputProc backupproc;
XkbComputeDerivedState(xkbi); XkbComputeDerivedState(xkbi);
} }
realMods = xkbi->device->key->modifierMap[ev.u.u.detail];
xkbi->device->key->modifierMap[ev.u.u.detail] = 0;
UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc); UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc);
xkbi->device->public.processInputProc(&ev,xkbi->device,1); xkbi->device->public.processInputProc(&ev,xkbi->device,1);
COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
backupproc,xkbUnwrapProc); backupproc,xkbUnwrapProc);
xkbi->device->key->modifierMap[ev.u.u.detail] = realMods;
if ( mask || mods ) if ( mask || mods )
xkbi->state= old; xkbi->state= old;
@ -1078,7 +1071,6 @@ void
XkbHandleActions(DeviceIntPtr dev,DeviceIntPtr kbd,xEvent *xE,int count) XkbHandleActions(DeviceIntPtr dev,DeviceIntPtr kbd,xEvent *xE,int count)
{ {
int key,bit,i; int key,bit,i;
CARD8 realMods = 0;
XkbSrvInfoPtr xkbi; XkbSrvInfoPtr xkbi;
KeyClassPtr keyc; KeyClassPtr keyc;
int changed,sendEvent; int changed,sendEvent;
@ -1216,19 +1208,15 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
if (sendEvent) { if (sendEvent) {
DeviceIntPtr tmpdev; DeviceIntPtr tmpdev;
if (keyEvent) { if (keyEvent)
realMods = keyc->modifierMap[key];
keyc->modifierMap[key] = 0;
tmpdev = dev; tmpdev = dev;
} else else
tmpdev = GetPairedDevice(dev); tmpdev = GetPairedDevice(dev);
UNWRAP_PROCESS_INPUT_PROC(tmpdev,xkbPrivPtr, backupproc); UNWRAP_PROCESS_INPUT_PROC(tmpdev,xkbPrivPtr, backupproc);
dev->public.processInputProc(xE,tmpdev,count); dev->public.processInputProc(xE,tmpdev,count);
COND_WRAP_PROCESS_INPUT_PROC(tmpdev, xkbPrivPtr, COND_WRAP_PROCESS_INPUT_PROC(tmpdev, xkbPrivPtr,
backupproc,xkbUnwrapProc); backupproc,xkbUnwrapProc);
if (keyEvent)
keyc->modifierMap[key] = realMods;
} }
else if (keyEvent) { else if (keyEvent) {
FixKeyState(xE,dev); FixKeyState(xE,dev);