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>
This commit is contained in:
parent
b5f49382fe
commit
feb757f384
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue
Block a user