summaryrefslogtreecommitdiff
path: root/action.c
diff options
context:
space:
mode:
authorAndreas Wettstein <wettstein509@solnet.ch>2014-02-15 17:34:41 +0100
committerAlan Coopersmith <alan.coopersmith@oracle.com>2019-06-08 17:57:41 -0700
commitff0e59084d6b9f2e7085fc88ba68916150085afb (patch)
tree40b978779573ecd13c5993f3f0e344d5f6513b08 /action.c
parent9edd61b91a02bda31fc6edd2c32c553e872b6ea2 (diff)
downloadxorg-app-xkbcomp-ff0e59084d6b9f2e7085fc88ba68916150085afb.tar.gz
xkbcomp Fix missing support for "affect" and incorrect modifier handling for ISOLock
Add missing support for "affect" flag to selectively affect locking or unlocking for for modifier locking, control locking, and ISOLock. Fix some incorrect masking and modifier handling for ISOLock. Signed-off-by: Andreas Wettstein <wettstein509@solnet.ch> Reviewed-By: Ran Benita <ran234@gmail.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'action.c')
-rw-r--r--action.c52
1 files changed, 37 insertions, 15 deletions
diff --git a/action.c b/action.c
index 6efe65b..292f2ea 100644
--- a/action.c
+++ b/action.c
@@ -436,6 +436,14 @@ HandleSetLatchMods(XkbDescPtr xkb,
return ReportIllegal(action->type, field);
}
+static LookupEntry lockWhich[] = {
+ {"both", 0},
+ {"lock", XkbSA_LockNoUnlock},
+ {"neither", (XkbSA_LockNoLock | XkbSA_LockNoUnlock)},
+ {"unlock", XkbSA_LockNoLock},
+ {NULL, 0}
+};
+
static Bool
HandleLockMods(XkbDescPtr xkb,
XkbAnyAction * action,
@@ -443,12 +451,19 @@ HandleLockMods(XkbDescPtr xkb,
{
XkbModAction *act;
unsigned t1, t2;
+ ExprResult rtrn;
act = (XkbModAction *) action;
- if ((array_ndx != NULL) && (field == F_Modifiers))
+ if ((array_ndx != NULL) && (field == F_Modifiers || field == F_Affect))
return ReportActionNotArray(action->type, field);
switch (field)
{
+ case F_Affect:
+ if (!ExprResolveEnum(value, &rtrn, lockWhich))
+ return ReportMismatch(action->type, field, "lock or unlock");
+ act->flags &= ~(XkbSA_LockNoLock | XkbSA_LockNoUnlock);
+ act->flags |= rtrn.uval;
+ return True;
case F_Modifiers:
t1 = act->flags;
if (CheckModifierField(xkb, action->type, value, &t1, &t2))
@@ -642,14 +657,6 @@ static LookupEntry btnNames[] = {
{NULL, 0}
};
-static LookupEntry lockWhich[] = {
- {"both", 0},
- {"lock", XkbSA_LockNoUnlock},
- {"neither", (XkbSA_LockNoLock | XkbSA_LockNoUnlock)},
- {"unlock", XkbSA_LockNoLock},
- {NULL, 0}
-};
-
static Bool
HandlePtrBtn(XkbDescPtr xkb,
XkbAnyAction * action,
@@ -683,7 +690,7 @@ HandlePtrBtn(XkbDescPtr xkb,
if (!ExprResolveEnum(value, &rtrn, lockWhich))
return ReportMismatch(action->type, field, "lock or unlock");
act->flags &= ~(XkbSA_LockNoLock | XkbSA_LockNoUnlock);
- act->flags |= rtrn.ival;
+ act->flags |= rtrn.uval;
return True;
}
else if (field == F_Count)
@@ -780,8 +787,12 @@ static LookupEntry isoNames[] = {
{"pointer", XkbSA_ISONoAffectPtr},
{"ctrls", XkbSA_ISONoAffectCtrls},
{"controls", XkbSA_ISONoAffectCtrls},
- {"all", ~((unsigned) 0)},
+ {"all", XkbSA_ISOAffectMask},
{"none", 0},
+ {"both", 0},
+ {"lock", XkbSA_LockNoUnlock},
+ {"neither", (XkbSA_LockNoLock | XkbSA_LockNoUnlock)},
+ {"unlock", XkbSA_LockNoLock},
{NULL, 0},
};
@@ -805,8 +816,8 @@ HandleISOLock(XkbDescPtr xkb,
if (CheckModifierField(xkb, action->type, value, &flags, &mods))
{
act->flags = flags & (~XkbSA_ISODfltIsGroup);
- act->real_mods = mods & 0xff;
- mods = (mods >> 8) & 0xff;
+ act->real_mods = act->mask = (mods & 0xff);
+ mods = (mods >> 8) & 0xffff;
XkbSetModActionVMods(act, mods);
return True;
}
@@ -828,6 +839,8 @@ HandleISOLock(XkbDescPtr xkb,
if (!ExprResolveMask(value, &rtrn, SimpleLookup, (XPointer) isoNames))
return ReportMismatch(action->type, field, "keyboard component");
act->affect = (~rtrn.uval) & XkbSA_ISOAffectMask;
+ act->flags &= ~(XkbSA_LockNoLock | XkbSA_LockNoUnlock);
+ act->flags |= rtrn.uval & (XkbSA_LockNoLock | XkbSA_LockNoUnlock);
return True;
}
return ReportIllegal(action->type, field);
@@ -944,6 +957,15 @@ HandleSetLockControls(XkbDescPtr xkb,
XkbActionSetCtrls(act, rtrn.uval);
return True;
}
+ else if (field == F_Affect && action->type == XkbSA_LockControls) {
+ if (array_ndx != NULL)
+ return ReportActionNotArray(action->type, field);
+ if (!ExprResolveEnum(value, &rtrn, lockWhich))
+ return ReportMismatch(action->type, field, "lock or unlock");
+ act->flags &= ~(XkbSA_LockNoLock | XkbSA_LockNoUnlock);
+ act->flags |= rtrn.uval;
+ return True;
+ }
return ReportIllegal(action->type, field);
}
@@ -1123,7 +1145,7 @@ HandleDeviceBtn(XkbDescPtr xkb,
if (!ExprResolveEnum(value, &rtrn, lockWhich))
return ReportMismatch(action->type, field, "lock or unlock");
act->flags &= ~(XkbSA_LockNoLock | XkbSA_LockNoUnlock);
- act->flags |= rtrn.ival;
+ act->flags |= rtrn.uval;
return True;
}
else if (field == F_Count)
@@ -1290,7 +1312,7 @@ ApplyActionFactoryDefaults(XkbAction * action)
}
else if (action->type == XkbSA_ISOLock)
{
- action->iso.real_mods = LockMask;
+ action->iso.real_mods = action->iso.mask = LockMask;
}
return;
}