diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-09-06 18:49:57 +0930 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2007-10-28 16:04:43 +0200 |
commit | 99e826e867c1c5520153c539ba07a884aec88d0c (patch) | |
tree | 40049000cd725637605bf1a7e483ef28b49f1af6 /xkb/xkbActions.c | |
parent | 91077bfc50d54be37c217e377c55b6bf886a2fab (diff) |
xkb: enable XI event processing for xkb.
XI events can now take the same processing paths as core events, and should do
the correct state changes etc.
There's some cases where XKB will use KeyPress as type for an event to be
delivered to the client. Stuck warnings in, not sure what the correct solution
is yet.
(cherry picked from commit 6334d4e7be18de5f237c12a6dc20f75aa23477d0 with some
additional compile fixes and non-MPX adaptations)
Diffstat (limited to 'xkb/xkbActions.c')
-rw-r--r-- | xkb/xkbActions.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 2c7c2cd6f..c62910f6b 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -39,11 +39,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <xkbsrv.h> #include "xkb.h" #include <ctype.h> +#define EXTENSION_EVENT_BASE 64 static unsigned int _xkbServerGeneration; -static int xkbDevicePrivateIndex = -1; +int xkbDevicePrivateIndex = -1; -static void +void xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data) { @@ -83,13 +84,11 @@ XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc) proc,xkbUnwrapProc); } -#ifdef XINPUT extern void ProcessOtherEvent( xEvent * /* xE */, DeviceIntPtr /* dev */, int /* count */ ); -#endif /***====================================================================***/ @@ -673,6 +672,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, &old,xkbi->desc->ctrls, &cn,False)) { cn.keycode = keycode; + /* XXX: what about DeviceKeyPress? */ cn.eventType = KeyPress; cn.requestMajor = 0; cn.requestMinor = 0; @@ -737,6 +737,7 @@ XkbEventCauseRec cause; ctrls->enabled_ctrls|= change; if (XkbComputeControlsNotify(kbd,&old,ctrls,&cn,False)) { cn.keycode = keycode; + /* XXX: what about DeviceKeyPress? */ cn.eventType = KeyPress; cn.requestMajor = 0; cn.requestMinor = 0; @@ -878,6 +879,7 @@ ProcessInputProc backupproc; filter->filter = _XkbFilterRedirectKey; filter->upAction = *pAction; + /* XXX: what about DeviceKeyPress */ ev.u.u.type = KeyPress; ev.u.u.detail = pAction->redirect.new_key; @@ -905,6 +907,10 @@ ProcessInputProc backupproc; realMods = xkbi->device->key->modifierMap[ev.u.u.detail]; xkbi->device->key->modifierMap[ev.u.u.detail] = 0; + /* XXX: Bad! Since the switch to XI devices xkbi->device will be the + * XI device. Sending a core event through ProcessOtherEvent will + * cause trouble. Somebody should fix this. + */ UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc); xkbi->device->public.processInputProc(&ev,xkbi->device,1); COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, @@ -919,6 +925,7 @@ ProcessInputProc backupproc; } else if (filter->keycode==keycode) { + /* XXX: what about DeviceKeyRelease */ ev.u.u.type = KeyRelease; ev.u.u.detail = filter->upAction.redirect.new_key; @@ -946,6 +953,10 @@ ProcessInputProc backupproc; realMods = xkbi->device->key->modifierMap[ev.u.u.detail]; xkbi->device->key->modifierMap[ev.u.u.detail] = 0; + /* XXX: Bad! Since the switch to XI devices xkbi->device will be the + * XI device. Sending a core event through ProcessOtherEvent will + * cause trouble. Somebody should fix this. + */ UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc); xkbi->device->public.processInputProc(&ev,xkbi->device,1); COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, @@ -1009,7 +1020,6 @@ _XkbFilterXF86Private( XkbSrvInfoPtr xkbi, return 1; } -#ifdef XINPUT static int _XkbFilterDeviceBtn( XkbSrvInfoPtr xkbi, @@ -1081,7 +1091,6 @@ int button; } return 0; } -#endif static XkbFilterPtr _XkbNextFreeFilter( @@ -1139,9 +1148,7 @@ XkbAction act; XkbFilterPtr filter; Bool keyEvent; Bool pressEvent; -#ifdef XINPUT Bool xiEvent; -#endif ProcessInputProc backupproc; xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); @@ -1162,7 +1169,6 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); xkbi->groupChange = 0; sendEvent = 1; -#ifdef XINPUT keyEvent= ((xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress)|| (xE->u.u.type==KeyRelease)||(xE->u.u.type==DeviceKeyRelease)); pressEvent= (xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress)|| @@ -1170,10 +1176,6 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); xiEvent= (xE->u.u.type==DeviceKeyPress)||(xE->u.u.type==DeviceKeyRelease)|| (xE->u.u.type==DeviceButtonPress)|| (xE->u.u.type==DeviceButtonRelease); -#else - keyEvent= (xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease); - pressEvent= (xE->u.u.type==KeyPress)||(xE->u.u.type==ButtonPress); -#endif if (pressEvent) { if (keyEvent) @@ -1234,13 +1236,11 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); filter = _XkbNextFreeFilter(xkbi); sendEvent= _XkbFilterRedirectKey(xkbi,filter,key,&act); break; -#ifdef XINPUT case XkbSA_DeviceBtn: case XkbSA_LockDeviceBtn: filter = _XkbNextFreeFilter(xkbi); sendEvent= _XkbFilterDeviceBtn(xkbi,filter,key,&act); break; -#endif case XkbSA_XFree86Private: filter = _XkbNextFreeFilter(xkbi); sendEvent= _XkbFilterXF86Private(xkbi,filter,key,&act); @@ -1279,11 +1279,6 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); } if (sendEvent) { -#ifdef XINPUT - if (xiEvent) - ProcessOtherEvent(xE,dev,count); - else -#endif if (keyEvent) { realMods = keyc->modifierMap[key]; keyc->modifierMap[key] = 0; @@ -1293,7 +1288,14 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); backupproc,xkbUnwrapProc); keyc->modifierMap[key] = realMods; } - else CoreProcessPointerEvent(xE,dev,count); + else + { + if (xE->u.u.type & EXTENSION_EVENT_BASE) + ProcessOtherEvent(xE, dev, count); + else + CoreProcessPointerEvent(xE,dev,count); + + } } else if (keyEvent) FixKeyState(xE,dev); |