tools: some minor changes to xkbcli
authorRan Benita <ran@unusedvar.com>
Sat, 25 Jul 2020 08:17:11 +0000 (11:17 +0300)
committerRan Benita <ran@unusedvar.com>
Sat, 25 Jul 2020 12:06:12 +0000 (15:06 +0300)
Signed-off-by: Ran Benita <ran@unusedvar.com>
meson.build
meson_options.txt
tools/interactive-evdev.c
tools/xkbcli-compile-keymap.1
tools/xkbcli-how-to-type.1
tools/xkbcli-interactive-evdev.1
tools/xkbcli-interactive-wayland.1
tools/xkbcli-interactive-x11.1
tools/xkbcli-list.1
tools/xkbcli.1
tools/xkbcli.c

index 268925d..a62e97b 100644 (file)
@@ -297,6 +297,9 @@ You can disable X11 support with -Denable-x11=false.''')
         'xkbcommon/xkbcommon-x11.h',
         subdir: 'xkbcommon',
     )
+    libxkbcommon_x11_dep = declare_dependency(
+        link_with: libxkbcommon_x11,
+    )
     pkgconfig.generate(
         libxkbcommon_x11,
         name: 'xkbcommon-x11',
@@ -308,8 +311,6 @@ You can disable X11 support with -Denable-x11=false.''')
     )
 endif
 
-man_pages = []
-
 # libxkbregistry
 if get_option('enable-xkbregistry')
     dep_libxml = dependency('libxml-2.0')
@@ -553,7 +554,7 @@ if build_tools
                install: true,
                install_dir: dir_libexec)
     install_man('tools/xkbcli-compile-keymap.1')
-    # The same tool again, but with access to some private APIS
+    # The same tool again, but with access to some private APIs.
     executable('compile-keymap',
                'tools/compile-keymap.c',
                libxkbcommon_sources,
@@ -579,7 +580,7 @@ if build_tools
     endif
     if get_option('enable-x11')
         x11_tools_dep = declare_dependency(
-            link_with: libxkbcommon_x11_internal,
+            link_with: libxkbcommon_x11,
             dependencies: [
                 tools_dep,
                 xcb_dep,
@@ -599,8 +600,8 @@ if build_tools
         wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.12', required: false)
         wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
         if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()
-            error('''The Wayland demo programs require wayland-client >= 1.2.0, wayland-protocols >= 1.7 which were not found.
-    You can disable the Wayland demo programs with -Denable-wayland=false.''')
+            error('''The Wayland xkbcli programs require wayland-client >= 1.2.0, wayland-protocols >= 1.7 which were not found.
+You can disable the Wayland xkbcli programs with -Denable-wayland=false.''')
         endif
 
         wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'))
index 95c5a10..5eaa081 100644 (file)
@@ -62,9 +62,3 @@ option(
     value: true,
     description: 'Enable building libxkbregistry',
 )
-option(
-    'enable-manpages',
-    type: 'boolean',
-    value: true,
-    description: 'Enable building man pages',
-)
index 0868b4f..36e7a14 100644 (file)
@@ -372,15 +372,17 @@ sigintr_handler(int signum)
 static void
 usage(FILE *fp, char *progname)
 {
-        fprintf(fp, "Usage: %s [--rules <rules>] [--model <model>] "
-                "[--layout <layout>] [--variant <variant>] [--options <options>]\n",
+        fprintf(fp, "Usage: %s [--rules=<rules>] [--model=<model>] "
+                "[--layout=<layout>] [--variant=<variant>] [--options=<options>]\n",
                 progname);
         fprintf(fp, "      or: %s --keymap <path to keymap file>\n",
                 progname);
         fprintf(fp, "For both:\n"
                         "          --report-state-changes (report changes to the state)\n"
-                        "          --enable-compose (enable compose)\n"
-                        "          --consumed-mode={gtk|xkb} (select the consumed mode)\n");
+                        "          --enable-compose (enable Compose)\n"
+                        "          --consumed-mode={xkb|gtk} (select the consumed modifiers mode, default: xkb)\n"
+                        "          --evdev-offset=NUM (default: 8)\n"
+        );
 }
 
 int
@@ -406,6 +408,7 @@ main(int argc, char *argv[])
         OPT_VARIANT,
         OPT_OPTION,
         OPT_KEYMAP,
+        OPT_EVDEV_OFFSET,
         OPT_CONSUMED_MODE,
         OPT_COMPOSE,
         OPT_REPORT_STATE,
@@ -418,6 +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},
         {"consumed-mode",        required_argument,      0, OPT_CONSUMED_MODE},
         {"enable-compose",       no_argument,            0, OPT_COMPOSE},
         {"report-state-changes", no_argument,            0, OPT_REPORT_STATE},
@@ -453,6 +457,15 @@ 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;
+            }
+            break;
         case OPT_REPORT_STATE:
             report_state_changes = true;
             break;
@@ -465,6 +478,7 @@ main(int argc, char *argv[])
             } else if (strcmp(optarg, "xkb") == 0) {
                 consumed_mode = XKB_CONSUMED_MODE_XKB;
             } else {
+                fprintf(stderr, "error: invalid --consumed-mode \"%s\"\n", optarg);
                 usage(stderr, argv[0]);
                 return EXIT_INVALID_USAGE;
             }
index 64c4263..98498f7 100644 (file)
@@ -7,7 +7,7 @@
 \fBxkbcli\fR compile\-keymap [\-\-help] [OPTIONS]
 .
 .SH "DESCRIPTION"
-\fBxkbcli compile\-keymap\fR compiles and prints a keymap based on the given options\.
+\fBxkbcli compile\-keymap\fR compiles and prints a keymap based on the given options.
 .
 .SH "OPTIONS"
 .
 Print help and exit
 .
 .TP
-\fB\-\-verbose\fR
+.B \-\-verbose
 Enable verbose debugging output
 .
 .TP
-\fB\-\-rmlvo\fR
+.B \-\-rmlvo
 Print the full RMLVO with the defaults filled in for missing elements
 .
 .TP
-\fB\-\-from\-xkb\fR
-Load the XKB file from stdin, ignore RMLVO options\. This option must not be used with \fB\-\-kccgst\fR\.
+.B \-\-from\-xkb
+Load the XKB file from stdin, ignore RMLVO options.
+This option must not be used with \fB\-\-kccgst\fR.
 .
 .TP
-\fB\-\-include\fR
-Add the given path to the include path list\. This option is order\-dependent, include paths given first are searched first\. If an include path is given, the default include path list is not used\. Use \fB\-\-include\-defaults\fR to add the default include paths
+.B \-\-include=PATH
+Add the given path to the include path list.
+This option is order\-dependent, include paths given first are searched first.
+If an include path is given, the default include path list is not used.
+Use \fB\-\-include\-defaults\fR to add the default include paths.
 .
 .TP
-\fB\-\-include\-defaults\fR
-Add the default set of include directories\. This option is order\-dependent, include paths given first are searched first\.
+.B \-\-include\-defaults
+Add the default set of include directories.
+This option is order-dependent, include paths given first are searched first.
 .
 .TP
-\fB\-\-rules <rules>\fR
+.B \-\-rules=<rules>
 The XKB ruleset
 .
 .TP
-\fB\-\-model <model>\fR
+.B \-\-model=<model>
 The XKB model
 .
 .TP
-\fB\-\-layout <layout>\fR:
-.
-.IP
+.B \-\-layout=<layout>
 The XKB layout
 .
 .TP
-\fB\-\-variant <variant>\fR:
-.
-.IP
+.B \-\-variant=<variant>
 The XKB layout variant
 .
 .TP
-\fB\-\-options <options>\fR
+.B \-\-options=<options>
 The XKB options
 .
 .SH "SEE ALSO"
 \fBxkbcli\fR(1)
 .
 .P
-The libxkbcommon online documentation at \fIhttps://xkbcommon\.org\fR
+The
+.UR https://xkbcommon.org
+libxkbcommon online documentation
+.UE
index 60d42ff..aca5280 100644 (file)
@@ -7,35 +7,38 @@
 \fBxkbcli\fR how\-to\-type [OPTIONS] <codepoint>
 .
 .SH "DESCRIPTION"
-\fBxkbcli how\-to\-type\fR prints key sequences to type the given Unicode codepoint\.
+\fBxkbcli how\-to\-type\fR prints key sequences to type the given Unicode codepoint.
 .
 .P
-Pipe into \fBcolumn \-ts $\'\e\et\'\fR for nicely aligned output\.
+Pipe into \fBcolumn \-ts $\'\e\et\'\fR for nicely aligned output.
 .
 .SH "OPTIONS"
 .
 .TP
-\fB\-\-rules <rules>\fR
+.B \-\-rules=<rules>
 The XKB ruleset
 .
 .TP
-\fB\-\-model <model>\fR
+.B \-\-model=<model>
 The XKB model
 .
 .TP
-\fB\-\-layout <layout>\fR
+.B \-\-layout=<layout>
 The XKB layout
 .
 .TP
-\fB\-\-variant <variant>\fR
+.B \-\-variant=<variant>
 The XKB layout variant
 .
 .TP
-\fB\-\-options <options>\fR
+.B \-\-options=<options>
 The XKB options
 .
 .SH "SEE ALSO"
 \fBxkbcli\fR(1)
 .
 .P
-The libxkbcommon online documentation at \fIhttps://xkbcommon\.org\fR
+The
+.UR https://xkbcommon.org
+libxkbcommon online documentation
+.UE
index 8b76dc7..1c0022c 100644 (file)
@@ -1,61 +1,73 @@
 .TH "XKBCLI\-INTERACTIVE\-EVDEV" "1" "" "" "libxkbcommon manual"
 .
 .SH "NAME"
-\fBxkbcli\-interactive\-evdev\fR \- interactive debugger for XKB maps
+\fBxkbcli\-interactive\-evdev\fR \- interactive debugger for XKB keymaps
 .
 .SH "SYNOPSIS"
 \fBxkbcli\fR interactive\-evdev [\-\-help] [OPTIONS]
 .
 .SH "DESCRIPTION"
-\fBxkbcli interactive\-evdev\fR is a commandline tool to interactively debug XKB maps by listening to \fB/dev/input/eventX\fR evdev devices\.
+\fBxkbcli interactive\-evdev\fR is a commandline tool to interactively debug XKB keymaps by listening to \fB/dev/input/eventX\fR evdev devices (Linux).
 .
 .P
-This is a debugging tool, its behavior or output is not guaranteed to be stable\.
+.B xkbcli interactive\-evdev
+requires permission to open the evdev device nodes.
+This usually requires being the \fBroot\fR user or belonging to the \fBinput\fR group.
+.
+.P
+Press the Escape key to exit.
+.
+.P
+This is a debugging tool, its behavior or output is not guaranteed to be stable.
 .
 .SH "OPTIONS"
 .
 .TP
-\fB\-\-help\fR
+.B \-\-help
 Print help and exit
 .
 .TP
-\fB\-\-rules <rules>\fR
+.B \-\-rules=<rules>
 The XKB ruleset
 .
 .TP
-\fB\-\-model <model>\fR
+.B \-\-model=<model>
 The XKB model
 .
 .TP
-\fB\-\-layout <layout>\fR
+.B \-\-layout=<layout>
 The XKB layout
 .
 .TP
-\fB\-\-variant <variant>\fR
+.B \-\-variant=<variant>
 The XKB layout variant
 .
 .TP
-\fB\-\-options <options>\fR
+.B \-\-options=<options>
 The XKB options
 .
 .TP
-\fB\-\-keymap\fR
-Specify a keymap path\. This option is mutually exclusive with the rmlvo options\.
+.B \-\-keymap=PATH
+Specify a keymap path.
+This option is mutually exclusive with the RMLVO options.
 .
 .TP
-\fB\-\-report\-state\-changes\fR
+.B \-\-report\-state\-changes
 Report changes to the keyboard state
 .
 .TP
-\fB\-\-enable\-compose\fR
-Enable compose functionality
+.B \-\-enable\-compose
+Enable Compose functionality
 .
 .TP
-\fB\-\-consumed\-mode={gtk|xkb}\fR
+.B \-\-consumed\-mode={xkb|gtk}
 Set the consumed modifiers mode (default: xkb)
 .
 .SH "SEE ALSO"
 \fBxkbcli\fR(1), \fBxkbcli\-interactive\-wayland\fR(1), \fBxkbcli\-interactive\-x11\fR(1)
 .
 .P
-The libxkbcommon online documentation at \fIhttps://xkbcommon\.org\fR
+The
+.UR https://xkbcommon.org
+libxkbcommon online documentation
+.UE
index 3d1aec3..4c534ad 100644 (file)
@@ -1,25 +1,34 @@
 .TH "XKBCLI\-INTERACTIVE\-WAYLAND" "1" "" "" "libxkbcommon manual"
 .
 .SH "NAME"
-\fBxkbcli\-interactive\-wayland\fR \- interactive debugger for XKB maps
+\fBxkbcli\-interactive\-wayland\fR \- interactive debugger for XKB keymaps
 .
 .SH "SYNOPSIS"
 \fBxkbcli\fR interactive\-wayland [\-\-help] [OPTIONS]
 .
 .SH "DESCRIPTION"
-\fBxkbcli interactive\-wayland\fR is a commandline tool to interactively debug XKB maps by listening to wayland events\. This requires a Wayland compositor to be running\.
+\fBxkbcli interactive\-wayland\fR is a commandline tool to interactively debug XKB keymaps by listening to wayland events.
 .
 .P
-This is a debugging tool, its behavior or output is not guaranteed to be stable\.
+This requires a Wayland compositor to be running.
+.
+.P
+Press the Escape key to exit.
+.
+.P
+This is a debugging tool, its behavior or output is not guaranteed to be stable.
 .
 .SH "OPTIONS"
 .
 .TP
-\fB\-\-help\fR
+.B \-\-help
 Print help and exit
 .
 .SH "SEE ALSO"
 \fBxkbcli\fR(1), \fBxkbcli\-interactive\-evdev\fR(1), \fBxkbcli\-interactive\-x11\fR(1)
 .
 .P
-The libxkbcommon online documentation at \fIhttps://xkbcommon\.org\fR
+The
+.UR https://xkbcommon.org
+libxkbcommon online documentation
+.UE
index 36e58e1..72007c0 100644 (file)
@@ -1,25 +1,34 @@
 .TH "XKBCLI\-INTERACTIVE\-X11" "1" "" "" "libxkbcommon manual"
 .
 .SH "NAME"
-\fBxkbcli\-interactive\-x11\fR \- interactive debugger for XKB maps
+\fBxkbcli\-interactive\-x11\fR \- interactive debugger for XKB keymaps
 .
 .SH "SYNOPSIS"
 \fBxkbcli\fR interactive\-x11 [\-\-help] [OPTIONS]
 .
 .SH "DESCRIPTION"
-\fBxkbcli interactive\-x11\fR is a commandline tool to interactively debug XKB maps by listening to X11 events\. This requires an X server to be running\.
+\fBxkbcli interactive\-x11\fR is a commandline tool to interactively debug XKB keymaps by listening to X11 events.
 .
 .P
-This is a debugging tool, its behavior or output is not guaranteed to be stable\.
+This requires an X server to be running.
+.
+.P
+Press the Escape key to exit.
+.
+.P
+This is a debugging tool, its behavior or output is not guaranteed to be stable.
 .
 .SH "OPTIONS"
 .
 .TP
-\fB\-\-help\fR
+.B \-\-help
 Print help and exit
 .
 .SH "SEE ALSO"
 \fBxkbcli\fR(1), \fBxkbcli\-interactive\-evdev\fR(1), \fBxkbcli\-interactive\-wayland\fR(1)
 .
 .P
-The libxkbcommon online documentation at \fIhttps://xkbcommon\.org\fR
+The
+.UR https://xkbcommon.org
+libxkbcommon online documentation
+.UE
index 3211efb..6f20cc1 100644 (file)
@@ -1,41 +1,44 @@
 .TH "XKBCLI\-LIST" "1" "" "" "libxkbcommon manual"
 .
 .SH "NAME"
-\fBxkbcli\-list\fR \- list available XKB rules, models, layouts, variants and options
+\fBxkbcli\-list\fR \- list available XKB models, layouts, variants and options
 .
 .SH "SYNOPSIS"
-\fBxkbcli\fR list [\-\-help] [/path/to/xkbbase [/path/to/xkbbase] \.\.\.]
+\fBxkbcli\fR list [\-\-help] [/path/to/xkbbase [/path/to/xkbbase] ...]
 .
 .SH "DESCRIPTION"
-\fBxkbcli list\fR is a commandline tool to list available model, layout, variant and option (MLVO) values from the XKB registry\.
+\fBxkbcli list\fR is a commandline tool to list available model, layout, variant and option (MLVO) values from the XKB registry.
 .
 .P
-Arguments provided on the commandline are treated as XKB base directory installations\.
+Arguments provided on the commandline are treated as XKB base directory installations.
 .
 .SH "OPTIONS"
 .
 .TP
-\fB\-\-help\fR
+.B \-\-help
 Print help and exit
 .
 .TP
-\fB\-v, \-\-verbose\fR
+.B \-v, \-\-verbose
 Increase verbosity, use multiple times for debugging output
 .
 .TP
-\fB\-\-ruleset <name>\fR
+.B \-\-ruleset=<name>
 Load the ruleset with the given name
 .
 .TP
-\fB\-\-skip\-default\-paths\fR
+.B \-\-skip\-default\-paths
 Do not load the default XKB include paths
 .
 .TP
-\fB\-\-load\-exotic\fR
+.B \-\-load\-exotic
 Load exotic (extra) layouts
 .
 .SH "SEE ALSO"
 \fBxkbcli\fR(1)
 .
 .P
-The libxkbcommon online documentation at \fIhttps://xkbcommon\.org\fR
+The
+.UR https://xkbcommon.org
+libxkbcommon online documentation
+.UE
index 6cfe4a4..6250291 100644 (file)
@@ -7,42 +7,42 @@
 \fBxkbcli\fR [\-\-help|\-\-version] <command> [\fIargs\fR]
 .
 .SH "DESCRIPTION"
-\fBxkbcli\fR is a commandline tool to query, compile and test XKB keymaps, layouts and other elements\.
+\fBxkbcli\fR is a commandline tool to query, compile and test XKB keymaps, layouts and other elements.
 .
 .SH "OPTIONS"
 .
 .TP
-\fB\-\-help\fR
+.B \-\-help
 Print help and exit
 .
 .TP
-\fB\-\-version\fR
+.B \-\-version
 Print the version and exit
 .
 .SH "COMMANDS"
 .
 .TP
-\fBhow\-to\-type\fR
-Show how to type a given unicode codepoint, see \fBxkbcli\-how\-to\-type\fR(1)
+.B how\-to\-type
+Show how to type a given Unicode codepoint, see \fBxkbcli\-how\-to\-type\fR(1)
 .
 .TP
-\fBinteractive\-x11\fR
-Interactive debugger for XKB maps for X11, see \fBxbkcli\-interactive\-x11\fR(1)
+.B interactive\-x11
+Interactive debugger for XKB keymaps for X11, see \fBxbkcli\-interactive\-x11\fR(1)
 .
 .TP
-\fBinteractive\-wayland\fR
-Interactive debugger for XKB maps for Wayland, see \fBxkbcli\-interactive\-wayland\fR(1)
+.B interactive\-wayland
+Interactive debugger for XKB keymaps for Wayland, see \fBxkbcli\-interactive\-wayland\fR(1)
 .
 .TP
-\fBinteractive\-evdev\fR
-Interactive debugger for XKB maps for evdev, see \fBxkbcli\-interactive\-evdev\fR
+.B interactive\-evdev
+Interactive debugger for XKB keymaps for evdev (Linux), see \fBxkbcli\-interactive\-evdev\fR
 .
 .TP
-\fBlist\fR
+.B list
 List available layouts and more, see \fBxkbcli\-list\fR(1)
 .
 .P
-Note that not all tools may be available on your system\.
+Note that not all tools may be available on your system.
 .
 .SH "EXIT STATUS"
 .
@@ -59,4 +59,7 @@ an error occured
 program was called with invalid arguments
 .
 .SH "SEE ALSO"
-The libxkbcommon online documentation at \fIhttps://xkbcommon\.org\fR
+The
+.UR https://xkbcommon.org
+libxkbcommon online documentation
+.UE
index 78a9aa5..ecab655 100644 (file)
@@ -45,22 +45,22 @@ usage(void)
 #endif
 #if HAVE_XKBCLI_INTERACTIVE_WAYLAND
            "  interactive-wayland\n"
-           "    Interactive debugger for XKB maps for wayland\n"
+           "    Interactive debugger for XKB keymaps for Wayland\n"
            "\n"
 #endif
 #if HAVE_XKBCLI_INTERACTIVE_x11
            "  interactive-x11\n"
-           "    Interactive debugger for XKB maps for X11\n"
+           "    Interactive debugger for XKB keymaps for X11\n"
            "\n"
 #endif
 #if HAVE_XKBCLI_INTERACTIVE_EVDEV
            "  interactive-evdev\n"
-           "    Interactive debugger for XKB maps for evdev\n"
+           "    Interactive debugger for XKB keymaps for evdev (Linux)\n"
            "\n"
 #endif
 #if HAVE_XKBCLI_COMPILE_KEYMAP
            "  compile-keymap\n"
-           "    Compile n XKB keymap\n"
+           "    Compile an XKB keymap\n"
            "\n"
 #endif
 #if HAVE_XKBCLI_HOW_TO_TYPE