keymap-dump: follow xkbcomp in printing affect=both in pointer actions It is equivalent to nothing but good to match up. Signed-off-by: Ran Benita <ran@unusedvar.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
diff --git a/src/xkbcomp/keymap-dump.c b/src/xkbcomp/keymap-dump.c
index e6b438a..b7828bf 100644
--- a/src/xkbcomp/keymap-dump.c
+++ b/src/xkbcomp/keymap-dump.c
@@ -277,9 +277,11 @@ write_led_map(struct xkb_keymap *keymap, struct buf *buf,
}
static const char *
-affect_lock_text(enum xkb_action_flags flags)
+affect_lock_text(enum xkb_action_flags flags, bool show_both)
{
switch (flags & (ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK)) {
+ case 0:
+ return show_both ? ",affect=both" : "";
case ACTION_LOCK_NO_UNLOCK:
return ",affect=lock";
case ACTION_LOCK_NO_LOCK:
@@ -317,7 +319,7 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
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) : "",
+ (action->type == ACTION_TYPE_MOD_LOCK) ? affect_lock_text(action->mods.flags, false) : "",
suffix);
break;
@@ -347,7 +349,7 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
break;
case ACTION_TYPE_PTR_LOCK:
- args = affect_lock_text(action->btn.flags);
+ args = affect_lock_text(action->btn.flags, true);
/* fallthrough */
case ACTION_TYPE_PTR_BUTTON:
write_buf(buf, "%s%s(button=", prefix, type);
@@ -382,7 +384,7 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
case ACTION_TYPE_CTRL_LOCK:
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) : "",
+ (action->type == ACTION_TYPE_CTRL_LOCK) ? affect_lock_text(action->ctrls.flags, false) : "",
suffix);
break;
diff --git a/test/data/keymaps/host.xkb b/test/data/keymaps/host.xkb
index 99ecd5b..dcaa677 100644
--- a/test/data/keymaps/host.xkb
+++ b/test/data/keymaps/host.xkb
@@ -887,16 +887,16 @@ xkb_compatibility "complete" {
action= PtrBtn(button=3,count=2);
};
interpret Pointer_Drag_Dflt+AnyOfOrNone(all) {
- action= LockPtrBtn(button=default);
+ action= LockPtrBtn(button=default,affect=both);
};
interpret Pointer_Drag1+AnyOfOrNone(all) {
- action= LockPtrBtn(button=1);
+ action= LockPtrBtn(button=1,affect=both);
};
interpret Pointer_Drag2+AnyOfOrNone(all) {
- action= LockPtrBtn(button=2);
+ action= LockPtrBtn(button=2,affect=both);
};
interpret Pointer_Drag3+AnyOfOrNone(all) {
- action= LockPtrBtn(button=3);
+ action= LockPtrBtn(button=3,affect=both);
};
interpret Pointer_EnableKeys+AnyOfOrNone(all) {
action= LockControls(controls=MouseKeys);
diff --git a/test/data/keymaps/stringcomp.data b/test/data/keymaps/stringcomp.data
index 2fd27df..bc9b6ab 100644
--- a/test/data/keymaps/stringcomp.data
+++ b/test/data/keymaps/stringcomp.data
@@ -880,16 +880,16 @@ xkb_compatibility "complete_caps(caps_lock)_4_misc(assign_shift_left_action)_4_l
action= PtrBtn(button=3,count=2);
};
interpret Pointer_Drag_Dflt+AnyOfOrNone(all) {
- action= LockPtrBtn(button=default);
+ action= LockPtrBtn(button=default,affect=both);
};
interpret Pointer_Drag1+AnyOfOrNone(all) {
- action= LockPtrBtn(button=1);
+ action= LockPtrBtn(button=1,affect=both);
};
interpret Pointer_Drag2+AnyOfOrNone(all) {
- action= LockPtrBtn(button=2);
+ action= LockPtrBtn(button=2,affect=both);
};
interpret Pointer_Drag3+AnyOfOrNone(all) {
- action= LockPtrBtn(button=3);
+ action= LockPtrBtn(button=3,affect=both);
};
interpret Pointer_EnableKeys+AnyOfOrNone(all) {
action= LockControls(controls=MouseKeys);