Commit 1326d5add46278f2be98b25d8527eab62d41351d

Peter Hutterer 2020-06-23T16:23:24

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>

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);