Commit 64bff65a6a548a36f8316a789660ffeab2a261b0

Ran Benita 2020-07-27T11:51:53

tools/interactive-evdev: change --evdev-offset to --without-x11-offset There is no reason to give full control rather than just enable/disable. Signed-off-by: Ran Benita <ran@unusedvar.com>

diff --git a/tools/interactive-evdev.c b/tools/interactive-evdev.c
index 36e7a14..8c14bd3 100644
--- a/tools/interactive-evdev.c
+++ b/tools/interactive-evdev.c
@@ -381,7 +381,7 @@ usage(FILE *fp, char *progname)
                         "          --report-state-changes (report changes to the state)\n"
                         "          --enable-compose (enable Compose)\n"
                         "          --consumed-mode={xkb|gtk} (select the consumed modifiers mode, default: xkb)\n"
-                        "          --evdev-offset=NUM (default: 8)\n"
+                        "          --without-x11-offset (don't add X11 keycode offset)\n"
         );
 }
 
@@ -408,7 +408,7 @@ main(int argc, char *argv[])
         OPT_VARIANT,
         OPT_OPTION,
         OPT_KEYMAP,
-        OPT_EVDEV_OFFSET,
+        OPT_WITHOUT_X11_OFFSET,
         OPT_CONSUMED_MODE,
         OPT_COMPOSE,
         OPT_REPORT_STATE,
@@ -421,7 +421,7 @@ main(int argc, char *argv[])
         {"variant",              required_argument,      0, OPT_VARIANT},
         {"options",              required_argument,      0, OPT_OPTION},
         {"keymap",               required_argument,      0, OPT_KEYMAP},
-        {"evdev-offset",         required_argument,      0, OPT_EVDEV_OFFSET},
+        {"without-x11-offset",   required_argument,      0, OPT_WITHOUT_X11_OFFSET},
         {"consumed-mode",        required_argument,      0, OPT_CONSUMED_MODE},
         {"enable-compose",       no_argument,            0, OPT_COMPOSE},
         {"report-state-changes", no_argument,            0, OPT_REPORT_STATE},
@@ -457,14 +457,8 @@ main(int argc, char *argv[])
         case OPT_KEYMAP:
             keymap_path = optarg;
             break;
-        case OPT_EVDEV_OFFSET:
-            errno = 0;
-            evdev_offset = strtol(optarg, NULL, 10);
-            if (errno) {
-                fprintf(stderr, "error: --evdev-offset option expects a number\n");
-                usage(stderr, argv[0]);
-                return EXIT_INVALID_USAGE;
-            }
+        case OPT_WITHOUT_X11_OFFSET:
+            evdev_offset = 0;
             break;
         case OPT_REPORT_STATE:
             report_state_changes = true;
diff --git a/tools/xkbcli-interactive-evdev.1 b/tools/xkbcli-interactive-evdev.1
index 1c0022c..ac315fa 100644
--- a/tools/xkbcli-interactive-evdev.1
+++ b/tools/xkbcli-interactive-evdev.1
@@ -63,6 +63,11 @@ Enable Compose functionality
 .B \-\-consumed\-mode={xkb|gtk}
 Set the consumed modifiers mode (default: xkb)
 .
+.TP
+.B \-\-without\-x11\-offset
+Don't add an offset of 8 when converting an evdev keycode to an XKB keycode.
+You probably don't want this option.
+.
 .SH "SEE ALSO"
 \fBxkbcli\fR(1), \fBxkbcli\-interactive\-wayland\fR(1), \fBxkbcli\-interactive\-x11\fR(1)
 .