diff options
author | marha <marha@users.sourceforge.net> | 2009-09-06 18:48:27 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-06 18:48:27 +0000 |
commit | a915739887477b28d924ecc8417ee107d125bd6c (patch) | |
tree | c02f315476b61892d1fd89182e18943dce8d6277 /xorg-server/xkb/xkbActions.c | |
parent | 6f25a23db1df27e992c34f6fd4c82e83c44fc2e2 (diff) | |
download | vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.gz vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.bz2 vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.zip |
Switched to xorg-server-1.6.99.900.tar.gz
Diffstat (limited to 'xorg-server/xkb/xkbActions.c')
-rw-r--r-- | xorg-server/xkb/xkbActions.c | 135 |
1 files changed, 31 insertions, 104 deletions
diff --git a/xorg-server/xkb/xkbActions.c b/xorg-server/xkb/xkbActions.c index aea479cd1..9c3184a83 100644 --- a/xorg-server/xkb/xkbActions.c +++ b/xorg-server/xkb/xkbActions.c @@ -30,13 +30,13 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <stdio.h> #include <math.h> -#define NEED_EVENTS 1 #include <X11/X.h> #include <X11/Xproto.h> #include <X11/keysym.h> #include "misc.h" #include "inputstr.h" #include "exevents.h" +#include "eventstr.h" #include <xkbsrv.h> #include "xkb.h" #include <ctype.h> @@ -75,12 +75,6 @@ XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc) WRAP_PROCESS_INPUT_PROC(device, xkbPrivPtr, proc, xkbUnwrapProc); } -extern void ProcessOtherEvent( - xEvent * /* xE */, - DeviceIntPtr /* dev */, - int /* count */ -); - /***====================================================================***/ static XkbAction @@ -92,41 +86,6 @@ static XkbAction fake; fake.type = XkbSA_NoAction; return fake; } - if (XkbDisableLockActions) { - switch (act->type) { - case XkbSA_LockMods: - fake.mods.type = XkbSA_SetMods; - fake.mods.flags = 0; - fake.mods.mask = act->mods.mask; - return fake; - case XkbSA_LatchMods: - fake.mods.type = XkbSA_SetMods; - fake.mods.flags = 0; - fake.mods.mask = act->mods.mask; - return fake; - case XkbSA_ISOLock: - if (act->iso.flags&XkbSA_ISODfltIsGroup) { - fake.group.type = XkbSA_SetGroup; - fake.group.flags = act->iso.flags&XkbSA_GroupAbsolute; - XkbSASetGroup(&fake.group,XkbSAGroup(&act->iso)); - } - else { - fake.mods.type = XkbSA_SetMods; - fake.mods.flags = 0; - fake.mods.mask = act->iso.mask; - } - return fake; - case XkbSA_LockGroup: - case XkbSA_LatchGroup: - /* We want everything from the latch/lock action except the - * type should be changed to set. - */ - fake = *act; - fake.group.type = XkbSA_SetGroup; - return fake; - } - } - else if (xkb->ctrls->enabled_ctrls&XkbStickyKeysMask) { if (act->any.type==XkbSA_SetMods) { fake.mods.type = XkbSA_LatchMods; @@ -840,11 +799,10 @@ _XkbFilterRedirectKey( XkbSrvInfoPtr xkbi, unsigned keycode, XkbAction * pAction) { -unsigned realMods = 0; -xEvent ev; +DeviceEvent ev; int x,y; XkbStateRec old; -unsigned mods,mask,oldCoreState = 0,oldCorePrevState = 0; +unsigned mods,mask; xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(xkbi->device); ProcessInputProc backupproc; @@ -855,10 +813,12 @@ ProcessInputProc backupproc; if ((filter->keycode!=0)&&(filter->keycode!=keycode)) return 1; - GetSpritePosition(inputInfo.pointer, &x,&y); - ev.u.keyButtonPointer.time = GetTimeInMillis(); - ev.u.keyButtonPointer.rootX = x; - ev.u.keyButtonPointer.rootY = y; + GetSpritePosition(xkbi->device, &x,&y); + ev.header = ET_Internal; + ev.length = sizeof(DeviceEvent); + ev.time = GetTimeInMillis(); + ev.root_x = x; + ev.root_y = y; if (filter->keycode==0) { /* initial press */ if ((pAction->redirect.new_key<xkbi->desc->min_key_code)|| @@ -872,9 +832,8 @@ 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; + ev.type = ET_KeyPress; + ev.detail.key = pAction->redirect.new_key; mask= XkbSARedirectVModsMask(&pAction->redirect); mods= XkbSARedirectVMods(&pAction->redirect); @@ -885,8 +844,6 @@ ProcessInputProc backupproc; if ( mask || mods ) { old= xkbi->state; - oldCoreState= xkbi->device->key->state; - oldCorePrevState= xkbi->device->key->prev_state; xkbi->state.base_mods&= ~mask; xkbi->state.base_mods|= (mods&mask); xkbi->state.latched_mods&= ~mask; @@ -894,29 +851,20 @@ ProcessInputProc backupproc; xkbi->state.locked_mods&= ~mask; xkbi->state.locked_mods|= (mods&mask); XkbComputeDerivedState(xkbi); - xkbi->device->key->state= xkbi->device->key->prev_state= - xkbi->state.mods; } - 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); - xkbi->device->public.processInputProc(&ev,xkbi->device,1); + xkbi->device->public.processInputProc((InternalEvent*)&ev, xkbi->device); COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, backupproc,xkbUnwrapProc); - xkbi->device->key->modifierMap[ev.u.u.detail] = realMods; - if ( mask || mods ) { - xkbi->device->key->state= oldCoreState; - xkbi->device->key->prev_state= oldCorePrevState; + if ( mask || mods ) xkbi->state= old; - } } else if (filter->keycode==keycode) { - /* XXX: what about DeviceKeyRelease */ - ev.u.u.type = KeyRelease; - ev.u.u.detail = filter->upAction.redirect.new_key; + ev.type = ET_KeyRelease; + ev.detail.key = filter->upAction.redirect.new_key; mask= XkbSARedirectVModsMask(&filter->upAction.redirect); mods= XkbSARedirectVMods(&filter->upAction.redirect); @@ -927,8 +875,6 @@ ProcessInputProc backupproc; if ( mask || mods ) { old= xkbi->state; - oldCoreState= xkbi->device->key->state; - oldCorePrevState= xkbi->device->key->prev_state; xkbi->state.base_mods&= ~mask; xkbi->state.base_mods|= (mods&mask); xkbi->state.latched_mods&= ~mask; @@ -936,23 +882,15 @@ ProcessInputProc backupproc; xkbi->state.locked_mods&= ~mask; xkbi->state.locked_mods|= (mods&mask); XkbComputeDerivedState(xkbi); - xkbi->device->key->state= xkbi->device->key->prev_state= - xkbi->state.mods; } - 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); - xkbi->device->public.processInputProc(&ev,xkbi->device,1); + xkbi->device->public.processInputProc((InternalEvent*)&ev, xkbi->device); COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, backupproc,xkbUnwrapProc); - xkbi->device->key->modifierMap[ev.u.u.detail] = realMods; - if ( mask || mods ) { - xkbi->device->key->state= oldCoreState; - xkbi->device->key->prev_state= oldCorePrevState; + if ( mask || mods ) xkbi->state= old; - } filter->keycode= 0; filter->active= 0; @@ -1027,7 +965,7 @@ int button; if (filter->keycode==0) { /* initial press */ _XkbLookupButtonDevice(&dev, pAction->devbtn.device, serverClient, DixUnknownAccess, &button); - if (!dev || !dev->public.on || dev == inputInfo.pointer) + if (!dev || !dev->public.on) return 1; button= pAction->devbtn.button; @@ -1068,7 +1006,7 @@ int button; filter->active= 0; _XkbLookupButtonDevice(&dev, filter->upAction.devbtn.device, serverClient, DixUnknownAccess, &button); - if (!dev || !dev->public.on || dev == inputInfo.pointer) + if (!dev || !dev->public.on) return 1; button= filter->upAction.btn.button; @@ -1131,15 +1069,13 @@ register int i,send; } void -XkbHandleActions(DeviceIntPtr dev,DeviceIntPtr kbd,xEvent *xE,int count) +XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent* event) { int key,bit,i; -CARD8 realMods = 0; XkbSrvInfoPtr xkbi; KeyClassPtr keyc; int changed,sendEvent; Bool genStateNotify; -XkbStateRec oldState; XkbAction act; XkbFilterPtr filter; Bool keyEvent; @@ -1150,11 +1086,11 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); keyc= kbd->key; xkbi= keyc->xkbInfo; - key= xE->u.u.detail; + key= event->detail.key; /* The state may change, so if we're not in the middle of sending a state * notify, prepare for it */ if ((xkbi->flags&_XkbStateNotifyInProgress)==0) { - oldState= xkbi->state; + xkbi->prev_state = xkbi->state; xkbi->flags|= _XkbStateNotifyInProgress; genStateNotify= True; } @@ -1164,10 +1100,8 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); xkbi->groupChange = 0; sendEvent = 1; - 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)|| - (xE->u.u.type==ButtonPress)||(xE->u.u.type==DeviceButtonPress); + keyEvent= ((event->type == ET_KeyPress) || (event->type == ET_KeyRelease)); + pressEvent= ((event->type == ET_KeyPress)|| (event->type == ET_ButtonPress)); if (pressEvent) { if (keyEvent) @@ -1272,34 +1206,27 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); if (sendEvent) { DeviceIntPtr tmpdev; - if (keyEvent) { - realMods = keyc->modifierMap[key]; - keyc->modifierMap[key] = 0; + if (keyEvent) tmpdev = dev; - } else + else tmpdev = GetPairedDevice(dev); UNWRAP_PROCESS_INPUT_PROC(tmpdev,xkbPrivPtr, backupproc); - dev->public.processInputProc(xE,tmpdev,count); + dev->public.processInputProc((InternalEvent*)event, tmpdev); COND_WRAP_PROCESS_INPUT_PROC(tmpdev, xkbPrivPtr, backupproc,xkbUnwrapProc); - if (keyEvent) - keyc->modifierMap[key] = realMods; } else if (keyEvent) { - FixKeyState(xE,dev); + FixKeyState(event, dev); } - xkbi->prev_state= oldState; XkbComputeDerivedState(xkbi); - keyc->prev_state= keyc->state; - keyc->state= XkbStateFieldFromRec(&xkbi->state); - changed = XkbStateChangedFlags(&oldState,&xkbi->state); + changed = XkbStateChangedFlags(&xkbi->prev_state,&xkbi->state); if (genStateNotify) { if (changed) { xkbStateNotify sn; sn.keycode= key; - sn.eventType= xE->u.u.type; + sn.eventType= event->type; sn.requestMajor = sn.requestMinor = 0; sn.changed= changed; XkbSendStateNotify(dev,&sn); @@ -1309,7 +1236,7 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev); changed= XkbIndicatorsToUpdate(dev,changed,False); if (changed) { XkbEventCauseRec cause; - XkbSetCauseKey(&cause,key,xE->u.u.type); + XkbSetCauseKey(&cause, key, event->type); XkbUpdateIndicators(dev,changed,False,NULL,&cause); } return; |