diff options
author | Ran Benita <ran@unusedvar.com> | 2020-06-28 09:50:47 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-06-28 09:50:47 +0300 |
commit | 878cc7a57495fa0bc1fbcb7cc666ad75cb6cdb65 (patch) | |
tree | d997835a8125a79d5d8b74267e98ff0241383f62 | |
parent | 8b8a464576789b13e2d48d4ede662acac3141263 (diff) | |
download | xorg-lib-libxkbcommon-878cc7a57495fa0bc1fbcb7cc666ad75cb6cdb65.tar.gz |
tools: don't depend on src/utils.h
The idea is to make the tools/demos as standalone as possible so that
they may serve as examples as well.
Signed-off-by: Ran Benita <ran@unusedvar.com>
-rw-r--r-- | tools/interactive-evdev.c | 10 | ||||
-rw-r--r-- | tools/interactive-wayland.c | 7 | ||||
-rw-r--r-- | tools/interactive-x11.c | 2 | ||||
-rw-r--r-- | tools/print-compiled-keymap.c | 5 | ||||
-rw-r--r-- | tools/tools-common.h | 1 |
5 files changed, 16 insertions, 9 deletions
diff --git a/tools/interactive-evdev.c b/tools/interactive-evdev.c index e09da6a..e8afb5e 100644 --- a/tools/interactive-evdev.c +++ b/tools/interactive-evdev.c @@ -459,11 +459,11 @@ main(int argc, char *argv[]) } else { struct xkb_rule_names rmlvo = { - .rules = isempty(rules) ? NULL : rules, - .model = isempty(model) ? NULL : model, - .layout = isempty(layout) ? NULL : layout, - .variant = isempty(variant) ? NULL : variant, - .options = isempty(options) ? NULL : options + .rules = (rules == NULL || rules[0] == '\0') ? NULL : rules, + .model = (model == NULL || model[0] == '\0') ? NULL : model, + .layout = (layout == NULL || layout[0] == '\0') ? NULL : layout, + .variant = (variant == NULL || variant[0] == '\0') ? NULL : variant, + .options = (options == NULL || options[0] == '\0') ? NULL : options }; if (!rules && !model && !layout && !variant && !options) diff --git a/tools/interactive-wayland.c b/tools/interactive-wayland.c index 0ffccd0..8cc41de 100644 --- a/tools/interactive-wayland.c +++ b/tools/interactive-wayland.c @@ -28,9 +28,12 @@ #include <errno.h> #include <fcntl.h> #include <locale.h> +#include <stdbool.h> #include <stdint.h> -#include <unistd.h> +#include <stdlib.h> +#include <string.h> #include <sys/mman.h> +#include <unistd.h> #include "xkbcommon/xkbcommon.h" #include "tools-common.h" @@ -39,6 +42,8 @@ #include "xdg-shell-client-protocol.h" #include <wayland-util.h> +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + struct interactive_dpy { struct wl_display *dpy; struct wl_compositor *compositor; diff --git a/tools/interactive-x11.c b/tools/interactive-x11.c index 4cc24d8..d98433e 100644 --- a/tools/interactive-x11.c +++ b/tools/interactive-x11.c @@ -24,6 +24,8 @@ #include "config.h" #include <locale.h> +#include <stdbool.h> +#include <stdlib.h> #include <xcb/xkb.h> diff --git a/tools/print-compiled-keymap.c b/tools/print-compiled-keymap.c index 04d98ba..1ba648b 100644 --- a/tools/print-compiled-keymap.c +++ b/tools/print-compiled-keymap.c @@ -23,11 +23,12 @@ #include "config.h" +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> -#include "utils.h" #include "xkbcommon/xkbcommon.h" int @@ -63,7 +64,7 @@ main(int argc, char *argv[]) goto out; } - if (streq(keymap_path, "-")) { + if (strcmp(keymap_path, "-") == 0) { FILE *tmp; tmp = tmpfile(); diff --git a/tools/tools-common.h b/tools/tools-common.h index e971af5..f0faa34 100644 --- a/tools/tools-common.h +++ b/tools/tools-common.h @@ -33,7 +33,6 @@ #define _XKBCOMMON_COMPAT_H #include "xkbcommon/xkbcommon.h" #include "xkbcommon/xkbcommon-compose.h" -#include "utils.h" void tools_print_keycode_state(struct xkb_state *state, |