diff options
author | Daniel Stone <daniel@fooishbar.org> | 2008-04-25 19:54:29 +0300 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2009-01-22 15:08:57 +1100 |
commit | feb757f384382c7782ceac55f99d54c7caadbd9d (patch) | |
tree | 550c2383f9e2dd668d05495f20aea02b2e1ecaf8 | |
parent | b5f49382fe48f0a762d9a15fb10a7d7e1183fc8d (diff) |
XKB: Sanitise vmods for redirected keys
Turn two unsigned chars into one unsigned int for both vmods and the
vmod mask. As a bonus, remove broken unused accessor macro for setting
the vmods.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | include/xkbstr.h | 17 | ||||
-rw-r--r-- | xkb/xkbActions.c | 8 | ||||
-rw-r--r-- | xkb/xkbtext.c | 4 | ||||
-rw-r--r-- | xkb/xkmread.c | 8 |
4 files changed, 12 insertions, 25 deletions
diff --git a/include/xkbstr.h b/include/xkbstr.h index 0a49ee1c4..ec19b30c2 100644 --- a/include/xkbstr.h +++ b/include/xkbstr.h @@ -194,23 +194,10 @@ typedef struct _XkbRedirectKeyAction { unsigned char new_key; unsigned char mods_mask; unsigned char mods; - /* FIXME: Make this an int. */ - unsigned char vmods_mask0; - unsigned char vmods_mask1; - unsigned char vmods0; - unsigned char vmods1; + unsigned int vmods_mask; + unsigned int vmods; } XkbRedirectKeyAction; -#define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\ - ((unsigned int)(a)->vmods0)) -/* FIXME: This is blatantly not setting vmods. Yeesh. */ -#define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ - ((a)->vmods_mask0=((m)&0xff))) -#define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\ - ((unsigned int)(a)->vmods_mask0)) -#define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ - ((a)->vmods_mask0=((m)&0xff))) - typedef struct _XkbDeviceBtnAction { unsigned char type; unsigned char flags; diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 4eb6b0bf8..9a138b0be 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -833,8 +833,8 @@ ProcessInputProc backupproc; ev.u.u.type = KeyPress; ev.u.u.detail = pAction->redirect.new_key; - mask= XkbSARedirectVModsMask(&pAction->redirect); - mods= XkbSARedirectVMods(&pAction->redirect); + mask= pAction->redirect.vmods_mask; + mods= pAction->redirect.vmods; if (mask) XkbVirtualModsToReal(xkbi->desc,mask,&mask); if (mods) XkbVirtualModsToReal(xkbi->desc,mods,&mods); mask|= pAction->redirect.mods_mask; @@ -865,8 +865,8 @@ ProcessInputProc backupproc; ev.u.u.type = KeyRelease; ev.u.u.detail = filter->upAction.redirect.new_key; - mask= XkbSARedirectVModsMask(&filter->upAction.redirect); - mods= XkbSARedirectVMods(&filter->upAction.redirect); + mask= filter->upAction.redirect.vmods_mask; + mods= filter->upAction.redirect.vmods; if (mask) XkbVirtualModsToReal(xkbi->desc,mask,&mask); if (mods) XkbVirtualModsToReal(xkbi->desc,mods,&mods); mask|= filter->upAction.redirect.mods_mask; diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c index e91ab2e97..b9f16a8cc 100644 --- a/xkb/xkbtext.c +++ b/xkb/xkbtext.c @@ -1006,8 +1006,8 @@ unsigned vmods,vmods_mask; act= &action->redirect; kc= act->new_key; - vmods= XkbSARedirectVMods(act); - vmods_mask= XkbSARedirectVModsMask(act); + vmods= act->vmods; + vmods_mask= act->vmods_mask; if (xkb && xkb->names && xkb->names->keys && (kc<=xkb->max_key_code) && (xkb->names->keys[kc].name[0]!='\0')) { char *kn; diff --git a/xkb/xkmread.c b/xkb/xkmread.c index e4d3d4d9c..a6fdc6faf 100644 --- a/xkb/xkmread.c +++ b/xkb/xkmread.c @@ -512,10 +512,10 @@ XkbAction *act; act->redirect.new_key = wire.actionData[0]; act->redirect.mods_mask = wire.actionData[1]; act->redirect.mods = wire.actionData[2]; - act->redirect.vmods_mask0 = wire.actionData[3]; - act->redirect.vmods_mask1 = wire.actionData[4]; - act->redirect.vmods0 = wire.actionData[4]; - act->redirect.vmods1 = wire.actionData[5]; + act->redirect.vmods_mask = (wire.actionData[3] << 8) | \ + wire.actionData[4]; + act->redirect.vmods = (wire.actionData[5] << 8) | \ + wire.actionData[6]; break; case XkbSA_DeviceValuator: act->devval.device = wire.actionData[0]; |