test: untangle interactive-x11 from the test headers Use the new tools headers and create a custom internal lib for the x11 tool. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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
diff --git a/meson.build b/meson.build
index 8021e9c..1f9fb78 100644
--- a/meson.build
+++ b/meson.build
@@ -465,7 +465,15 @@ if cc.has_header('linux/input.h')
executable('interactive-evdev', 'test/interactive-evdev.c', dependencies: tools_dep)
endif
if get_option('enable-x11')
- executable('interactive-x11', 'test/interactive-x11.c', dependencies: x11_test_dep)
+ x11_tools_dep = declare_dependency(
+ link_with: libxkbcommon_x11_internal,
+ dependencies: [
+ tools_dep,
+ xcb_dep,
+ xcb_xkb_dep,
+ ],
+ )
+ executable('interactive-x11', 'test/interactive-x11.c', dependencies: x11_tools_dep)
endif
if get_option('enable-wayland')
wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: false)
diff --git a/test/interactive-x11.c b/test/interactive-x11.c
index a2369ff..8d312b7 100644
--- a/test/interactive-x11.c
+++ b/test/interactive-x11.c
@@ -28,7 +28,7 @@
#include <xcb/xkb.h>
#include "xkbcommon/xkbcommon-x11.h"
-#include "test.h"
+#include "tools-common.h"
/*
* Note: This program only handles the core keyboard device for now.
@@ -239,8 +239,8 @@ process_event(xcb_generic_event_t *gevent, struct keyboard *kbd)
xcb_key_press_event_t *event = (xcb_key_press_event_t *) gevent;
xkb_keycode_t keycode = event->detail;
- test_print_keycode_state(kbd->state, NULL, keycode,
- XKB_CONSUMED_MODE_XKB);
+ tools_print_keycode_state(kbd->state, NULL, keycode,
+ XKB_CONSUMED_MODE_XKB);
/* Exit on ESC. */
if (keycode == 9)
@@ -354,7 +354,7 @@ main(int argc, char *argv[])
goto err_conn;
}
- ctx = test_get_context(0);
+ ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
if (!ctx) {
ret = -1;
fprintf(stderr, "Couldn't create xkb context\n");
@@ -380,9 +380,9 @@ main(int argc, char *argv[])
goto err_core_kbd;
}
- test_disable_stdin_echo();
+ tools_disable_stdin_echo();
ret = loop(conn, &core_kbd);
- test_enable_stdin_echo();
+ tools_enable_stdin_echo();
err_core_kbd:
deinit_kbd(&core_kbd);