diff options
author | Daniel Stone <daniel@fooishbar.org> | 2009-01-04 16:40:46 +1100 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2009-01-20 15:32:19 +1100 |
commit | 27ea1a7e4e7eca394e052791c64bc6be515e075e (patch) | |
tree | 7479045e44a52812d388137651707518bfcf77d1 /xkb | |
parent | 2762cafc321166ac48f80146720709b1011e6894 (diff) |
XKB: Only Xi events are processed
Core events aren't run through these functions, so don't bother testing
for them.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/xkbAccessX.c | 19 | ||||
-rw-r--r-- | xkb/xkbPrKeyEv.c | 62 |
2 files changed, 28 insertions, 53 deletions
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c index f9b4b850f..85d409650 100644 --- a/xkb/xkbAccessX.c +++ b/xkb/xkbAccessX.c @@ -33,6 +33,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/X.h> #include <X11/Xproto.h> #include <X11/keysym.h> +#include "exglobals.h" +#include <X11/extensions/XIproto.h> #include "inputstr.h" #include <xkbsrv.h> #if !defined(WIN32) @@ -691,15 +693,16 @@ XkbSrvInfoPtr xkbi = dev->key->xkbInfo; unsigned changed = 0; ProcessInputProc backupproc; xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse); +deviceKeyButtonPointer *kbp = xE; xkbi->shiftKeyCount = 0; - xkbi->lastPtrEventTime= xE->u.keyButtonPointer.time; + xkbi->lastPtrEventTime= kbp->time; - if (xE->u.u.type==ButtonPress) { + if (xE->u.u.type==DeviceButtonPress) { changed |= XkbPointerButtonMask; } - else if (xE->u.u.type==ButtonRelease) { - xkbi->lockedPtrButtons&= ~(1<<(xE->u.u.detail&0x7)); + else if (xE->u.u.type==DeviceButtonRelease) { + xkbi->lockedPtrButtons&= ~(1<<(kbp->detail&0x7)); changed |= XkbPointerButtonMask; } @@ -726,7 +729,7 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse); xkbi->state.ptr_buttons = mouse->button->state; /* clear any latched modifiers */ - if ( xkbi->state.latched_mods && (xE->u.u.type==ButtonRelease) ) { + if ( xkbi->state.latched_mods && (kbp->type==DeviceButtonRelease) ) { unsigned changed_leds; XkbStateRec oldState; XkbSrvLedInfoPtr sli; @@ -741,7 +744,7 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse); changed_leds= XkbIndicatorsToUpdate(dev,changed,False); if (changed_leds) { XkbEventCauseRec cause; - XkbSetCauseKey(&cause,(xE->u.u.detail&0x7),xE->u.u.type); + XkbSetCauseKey(&cause,(kbp->detail&0x7),kbp->type); XkbUpdateIndicators(dev,changed_leds,True,NULL,&cause); } } @@ -750,8 +753,8 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse); if (((xkbi->flags&_XkbStateNotifyInProgress)==0)&&(changed!=0)) { xkbStateNotify sn; - sn.keycode= xE->u.u.detail; - sn.eventType= xE->u.u.type; + sn.keycode= kbp->detail; + sn.eventType= kbp->type; sn.requestMajor = sn.requestMinor = 0; sn.changed= changed; XkbSendStateNotify(dev,&sn); diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c index 6feb9be6a..badfb14a2 100644 --- a/xkb/xkbPrKeyEv.c +++ b/xkb/xkbPrKeyEv.c @@ -49,16 +49,14 @@ XkbSrvInfoPtr xkbi; int key; XkbBehavior behavior; unsigned ndx; -int xiEvent; xkbi= keyc->xkbInfo; key= xE->u.u.detail; - xiEvent= (xE->u.u.type & EXTENSION_EVENT_BASE); if (xkbDebugFlags&0x8) { - DebugF("[xkb] XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up")); + DebugF("[xkb] XkbPKE: Key %d %s\n",key,(xE->u.u.type==DeviceKeyPress?"down":"up")); } - if ( (xkbi->repeatKey==key) && (xE->u.u.type==KeyRelease) && + if ( (xkbi->repeatKey==key) && (xE->u.u.type==DeviceKeyRelease) && ((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) { AccessXCancelRepeatKey(xkbi,key); } @@ -72,55 +70,37 @@ int xiEvent; if ((behavior.type&XkbKB_Permanent)==0) { switch (behavior.type) { case XkbKB_Default: - if (( xE->u.u.type == KeyPress || - xE->u.u.type == DeviceKeyPress) && + if (xE->u.u.type == DeviceKeyPress && (keyc->down[key>>3] & (1<<(key&7)))) { XkbLastRepeatEvent= (pointer)xE; - if (xiEvent) - xE->u.u.type = DeviceKeyRelease; - else - xE->u.u.type = KeyRelease; + xE->u.u.type = DeviceKeyRelease; XkbHandleActions(keybd,keybd,xE,count); - if (xiEvent) - xE->u.u.type = DeviceKeyPress; - else - xE->u.u.type = KeyPress; + xE->u.u.type = DeviceKeyPress; XkbHandleActions(keybd,keybd,xE,count); XkbLastRepeatEvent= NULL; return; } - else if ((xE->u.u.type==KeyRelease || - xE->u.u.type == DeviceKeyRelease) && + else if (xE->u.u.type==DeviceKeyRelease && (!(keyc->down[key>>3]&(1<<(key&7))))) { XkbLastRepeatEvent= (pointer)&xE; - if (xiEvent) - xE->u.u.type = DeviceKeyPress; - else - xE->u.u.type = KeyPress; + xE->u.u.type = DeviceKeyPress; XkbHandleActions(keybd,keybd,xE,count); - if (xiEvent) - xE->u.u.type = DeviceKeyRelease; - else - xE->u.u.type = KeyRelease; + xE->u.u.type = DeviceKeyRelease; XkbHandleActions(keybd,keybd,xE,count); XkbLastRepeatEvent= NULL; return; } break; case XkbKB_Lock: - if ( xE->u.u.type == KeyRelease || - xE->u.u.type == DeviceKeyRelease) { + if (xE->u.u.type == DeviceKeyRelease) { return; } else { int bit= 1<<(key&7); if ( keyc->down[key>>3]&bit ) { - if (xiEvent) - xE->u.u.type = DeviceKeyRelease; - else - xE->u.u.type= KeyRelease; + xE->u.u.type = DeviceKeyRelease; } } break; @@ -129,14 +109,13 @@ int xiEvent; if ( ndx<xkbi->nRadioGroups ) { XkbRadioGroupPtr rg; - if ( xE->u.u.type == KeyRelease || - xE->u.u.type == DeviceKeyRelease) + if (xE->u.u.type == DeviceKeyRelease) return; rg = &xkbi->radioGroups[ndx]; if ( rg->currentDown == xE->u.u.detail ) { if (behavior.data&XkbKB_RGAllowNone) { - xE->u.u.type = KeyRelease; + xE->u.u.type = DeviceKeyRelease; XkbHandleActions(keybd,keybd,xE,count); rg->currentDown= 0; } @@ -144,16 +123,10 @@ int xiEvent; } if ( rg->currentDown!=0 ) { int key = xE->u.u.detail; - if (xiEvent) - xE->u.u.type = DeviceKeyRelease; - else - xE->u.u.type= KeyRelease; + xE->u.u.type = DeviceKeyRelease; xE->u.u.detail= rg->currentDown; XkbHandleActions(keybd,keybd,xE,count); - if (xiEvent) - xE->u.u.type = DeviceKeyPress; - else - xE->u.u.type= KeyPress; + xE->u.u.type = DeviceKeyPress; xE->u.u.detail= key; } rg->currentDown= key; @@ -194,9 +167,8 @@ ProcessKeyboardEvent(xEvent *xE,DeviceIntPtr keybd,int count) XkbSrvInfoPtr xkbi = NULL; ProcessInputProc backup_proc; xkbDeviceInfoPtr xkb_priv = XKBDEVICEINFO(keybd); - int is_press = (xE->u.u.type == KeyPress || xE->u.u.type == DeviceKeyPress); - int is_release = (xE->u.u.type == KeyRelease || - xE->u.u.type == DeviceKeyRelease); + int is_press = (xE->u.u.type == DeviceKeyPress); + int is_release = (xE->u.u.type == DeviceKeyRelease); if (keyc) xkbi = keyc->xkbInfo; @@ -225,6 +197,6 @@ ProcessKeyboardEvent(xEvent *xE,DeviceIntPtr keybd,int count) } else { XkbProcessKeyboardEvent(xE, keybd, count); } - + return; } |