summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2014-02-15 23:50:21 +0200
committerRan Benita <ran234@gmail.com>2014-02-15 23:50:21 +0200
commit8d3db622b804533214c8e78ac27a091552eb5227 (patch)
tree2d50fab23d8e74511d859606de5a28d3b7da729f /src
parent11a9f76bf220e6bf89174c7654f03fc3947be9d3 (diff)
downloadlibxkbcommon-8d3db622b804533214c8e78ac27a091552eb5227.tar.gz
libxkbcommon-8d3db622b804533214c8e78ac27a091552eb5227.tar.bz2
libxkbcommon-8d3db622b804533214c8e78ac27a091552eb5227.zip
keymap-dump: add missing support for NoLock and NoUnlock flags
Based on a libxkbfile patch by Andreas Wettstein. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/xkbcomp/keymap-dump.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/src/xkbcomp/keymap-dump.c b/src/xkbcomp/keymap-dump.c
index c014446..0163bef 100644
--- a/src/xkbcomp/keymap-dump.c
+++ b/src/xkbcomp/keymap-dump.c
@@ -273,6 +273,20 @@ write_led_map(struct xkb_keymap *keymap, struct buf *buf,
return true;
}
+static const char *
+affect_lock_text(enum xkb_action_flags flags)
+{
+ switch (flags & (ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK)) {
+ case ACTION_LOCK_NO_UNLOCK:
+ return ",affect=lock";
+ case ACTION_LOCK_NO_LOCK:
+ return ",affect=unlock";
+ case ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK:
+ return ",affect=neither";
+ }
+ return "";
+}
+
static bool
write_action(struct xkb_keymap *keymap, struct buf *buf,
const union xkb_action *action,
@@ -289,16 +303,17 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
type = ActionTypeText(action->type);
switch (action->type) {
+ case ACTION_TYPE_MOD_LOCK:
case ACTION_TYPE_MOD_SET:
case ACTION_TYPE_MOD_LATCH:
- case ACTION_TYPE_MOD_LOCK:
if (action->mods.flags & ACTION_MODS_LOOKUP_MODMAP)
args = "modMapMods";
else
args = ModMaskText(keymap, action->mods.mods.mods);
- write_buf(buf, "%s%s(modifiers=%s%s%s)%s", prefix, type, args,
+ write_buf(buf, "%s%s(modifiers=%s%s%s%s)%s", prefix, type, args,
(action->type != ACTION_TYPE_MOD_LOCK && (action->mods.flags & ACTION_LOCK_CLEAR)) ? ",clearLocks" : "",
(action->type != ACTION_TYPE_MOD_LOCK && (action->mods.flags & ACTION_LATCH_TO_LOCK)) ? ",latchToLock" : "",
+ (action->type == ACTION_TYPE_MOD_LOCK) ? affect_lock_text(action->mods.flags) : "",
suffix);
break;
@@ -330,18 +345,8 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
break;
case ACTION_TYPE_PTR_LOCK:
- switch (action->btn.flags &
- (ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK)) {
- case ACTION_LOCK_NO_UNLOCK:
- args = ",affect=lock";
- break;
- case ACTION_LOCK_NO_LOCK:
- args = ",affect=unlock";
- break;
- case ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK:
- args = ",affect=neither";
- break;
- }
+ args = affect_lock_text(action->btn.flags);
+ /* fallthrough */
case ACTION_TYPE_PTR_BUTTON:
write_buf(buf, "%s%s(button=", prefix, type);
if (action->btn.button > 0 && action->btn.button <= 5)
@@ -373,8 +378,10 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
case ACTION_TYPE_CTRL_SET:
case ACTION_TYPE_CTRL_LOCK:
- write_buf(buf, "%s%s(controls=%s)%s", prefix, type,
- ControlMaskText(keymap->ctx, action->ctrls.ctrls), suffix);
+ write_buf(buf, "%s%s(controls=%s%s)%s", prefix, type,
+ ControlMaskText(keymap->ctx, action->ctrls.ctrls),
+ (action->type == ACTION_TYPE_CTRL_LOCK) ? affect_lock_text(action->ctrls.flags) : "",
+ suffix);
break;
case ACTION_TYPE_NONE: