From 878cc7a57495fa0bc1fbcb7cc666ad75cb6cdb65 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 28 Jun 2020 09:50:47 +0300 Subject: 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 --- tools/interactive-evdev.c | 10 +++++----- tools/interactive-wayland.c | 7 ++++++- tools/interactive-x11.c | 2 ++ tools/print-compiled-keymap.c | 5 +++-- tools/tools-common.h | 1 - 5 files changed, 16 insertions(+), 9 deletions(-) (limited to 'tools') 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 #include #include +#include #include -#include +#include +#include #include +#include #include "xkbcommon/xkbcommon.h" #include "tools-common.h" @@ -39,6 +42,8 @@ #include "xdg-shell-client-protocol.h" #include +#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 +#include +#include #include 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 #include #include +#include #include -#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, -- cgit v1.2.1