XKB: Sanitise vmods in actions
Turn vmods from two unsigned chars into one int. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
4f3078df2a
commit
61c508fa78
|
@ -123,14 +123,8 @@ typedef struct _XkbModAction {
|
|||
unsigned char flags;
|
||||
unsigned char mask;
|
||||
unsigned char real_mods;
|
||||
/* FIXME: Make this an int. */
|
||||
unsigned char vmods1;
|
||||
unsigned char vmods2;
|
||||
unsigned int vmods;
|
||||
} XkbModAction;
|
||||
#define XkbModActionVMods(a) ((short) (((a)->vmods1 << 8) | (a)->vmods2))
|
||||
#define XkbSetModActionVMods(a,v) \
|
||||
((a)->vmods1 = (((v) >> 8) & 0xff), \
|
||||
(a)->vmods2 = (v) & 0xff)
|
||||
|
||||
typedef struct _XkbGroupAction {
|
||||
unsigned char type;
|
||||
|
@ -149,8 +143,7 @@ typedef struct _XkbISOAction {
|
|||
/* FIXME: Make this an int. */
|
||||
char group_XXX;
|
||||
unsigned char affect;
|
||||
unsigned char vmods1;
|
||||
unsigned char vmods2;
|
||||
unsigned int vmods;
|
||||
} XkbISOAction;
|
||||
|
||||
typedef struct _XkbPtrAction {
|
||||
|
|
|
@ -343,7 +343,7 @@ unsigned tmp;
|
|||
case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
|
||||
if (act->mods.flags&XkbSA_UseModMapMods)
|
||||
act->mods.real_mods= act->mods.mask= mods;
|
||||
if ((tmp= XkbModActionVMods(&act->mods))!=0) {
|
||||
if ((tmp= act->mods.vmods)!=0) {
|
||||
XkbVirtualModsToReal(xkb,tmp,&tmp);
|
||||
act->mods.mask|= tmp;
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ unsigned tmp;
|
|||
case XkbSA_ISOLock:
|
||||
if (act->iso.flags&XkbSA_UseModMapMods)
|
||||
act->iso.real_mods= act->iso.mask= mods;
|
||||
if ((tmp= XkbModActionVMods(&act->iso))!=0) {
|
||||
if ((tmp= act->iso.vmods)!=0) {
|
||||
XkbVirtualModsToReal(xkb,tmp,&tmp);
|
||||
act->iso.mask|= tmp;
|
||||
}
|
||||
|
@ -666,7 +666,7 @@ unsigned int tmp;
|
|||
|
||||
switch (act->type) {
|
||||
case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
|
||||
if (((tmp= XkbModActionVMods(&act->mods))&changed)!=0) {
|
||||
if (((tmp= act->mods.vmods)&changed)!=0) {
|
||||
XkbVirtualModsToReal(xkb,tmp,&tmp);
|
||||
act->mods.mask= act->mods.real_mods;
|
||||
act->mods.mask|= tmp;
|
||||
|
@ -674,7 +674,7 @@ unsigned int tmp;
|
|||
}
|
||||
break;
|
||||
case XkbSA_ISOLock:
|
||||
if ((((tmp= XkbModActionVMods(&act->iso))!=0)&changed)!=0) {
|
||||
if ((((tmp= act->iso.vmods)!=0)&changed)!=0) {
|
||||
XkbVirtualModsToReal(xkb,tmp,&tmp);
|
||||
act->iso.mask= act->iso.real_mods;
|
||||
act->iso.mask|= tmp;
|
||||
|
|
|
@ -183,13 +183,13 @@ register unsigned tmp;
|
|||
case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
|
||||
if (act->mods.flags&XkbSA_UseModMapMods)
|
||||
act->mods.real_mods= act->mods.mask= mods;
|
||||
if ((tmp= XkbModActionVMods(&act->mods))!=0)
|
||||
if ((tmp= act->mods.vmods)!=0)
|
||||
act->mods.mask|= XkbMaskForVMask(xkb,tmp);
|
||||
break;
|
||||
case XkbSA_ISOLock:
|
||||
if (act->iso.flags&XkbSA_UseModMapMods)
|
||||
act->iso.real_mods= act->iso.mask= mods;
|
||||
if ((tmp= XkbModActionVMods(&act->iso))!=0)
|
||||
if ((tmp= act->iso.vmods)!=0)
|
||||
act->iso.mask|= XkbMaskForVMask(xkb,tmp);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -678,7 +678,7 @@ XkbModAction * act;
|
|||
unsigned tmp;
|
||||
|
||||
act= &action->mods;
|
||||
tmp= XkbModActionVMods(act);
|
||||
tmp= act->vmods;
|
||||
TryCopyStr(buf,"modifiers=",sz);
|
||||
if (act->flags&XkbSA_UseModMapMods)
|
||||
TryCopyStr(buf,"modMapMods",sz);
|
||||
|
@ -818,7 +818,7 @@ char tbuf[64];
|
|||
}
|
||||
else {
|
||||
unsigned tmp;
|
||||
tmp= XkbModActionVMods(act);
|
||||
tmp= act->vmods;
|
||||
TryCopyStr(buf,"modifiers=",sz);
|
||||
if (act->flags&XkbSA_UseModMapMods)
|
||||
TryCopyStr(buf,"modMapMods",sz);
|
||||
|
|
|
@ -457,8 +457,7 @@ XkbAction *act;
|
|||
act->mods.flags = wire.actionData[0];
|
||||
act->mods.mask = wire.actionData[1];
|
||||
act->mods.real_mods = wire.actionData[2];
|
||||
act->mods.vmods1 = wire.actionData[3];
|
||||
act->mods.vmods2 = wire.actionData[4];
|
||||
act->mods.vmods = (wire.actionData[3] << 8) | wire.actionData[4];
|
||||
break;
|
||||
case XkbSA_SetGroup:
|
||||
case XkbSA_LatchGroup:
|
||||
|
@ -497,8 +496,7 @@ XkbAction *act;
|
|||
act->iso.real_mods = wire.actionData[2];
|
||||
act->iso.group_XXX = wire.actionData[3];
|
||||
act->iso.affect = wire.actionData[4];
|
||||
act->iso.vmods1 = wire.actionData[5];
|
||||
act->iso.vmods2 = wire.actionData[6];
|
||||
act->iso.vmods = (wire.actionData[5] << 8) | wire.actionData[6];
|
||||
break;
|
||||
case XkbSA_SwitchScreen:
|
||||
act->screen.flags = wire.actionData[0];
|
||||
|
|
Loading…
Reference in New Issue
Block a user