From 237f294497dc54db1b42882ca90cad0f742a0e62 Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Tue, 23 Apr 2019 13:42:48 +0900 Subject: [PATCH] headless input: add pepper-xkb to send a keymap to client(s) : FIXME Change-Id: Icfe859e5f20436cd164c9973285cc4a95ee9b538 Signed-off-by: Sung-Jin Park --- configure.ac | 2 ++ src/bin/headless/input.c | 25 ++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 86491f1..2044aa3 100644 --- a/configure.ac +++ b/configure.ac @@ -310,8 +310,10 @@ AC_SUBST(SAMPLES_LIBS) HEADLESS_SERVER_REQUIRES="wayland-server capi-system-peripheral-io xdg-shell-unstable-v6-server tizen-extension-server" PKG_CHECK_MODULES(HEADLESS_SERVER, $[HEADLESS_SERVER_REQUIRES]) HEADLESS_SERVER_CFLAGS="$PEPPER_DIR $PEPPER_KEYROUTER_DIR $PEPPER_EVDEV_DIR $HEADLESS_SERVER_CFLAGS" +HEADLESS_SERVER_CFLAGS="$PEPPER_XKB_DIR $HEADLESS_SERVER_CFLAGS" HEADLESS_SERVER_LIBS="$PEPPER_LIB $PEPPER_LIBS $PEPPER_EVDEV_LIB $PEPPER_EVDEV_LIBS $HEADLESS_SERVER_LIBS" HEADLESS_SERVER_LIBS="$PEPPER_KEYROUTER_LIB $PEPPER_KEYROUTER_LIBS $HEADLESS_SERVER_LIBS" +HEADLESS_SERVER_LIBS="$PEPPER_XKB_LIB $PEPPER_XKB_LIBS $HEADLESS_SERVER_LIBS" AC_SUBST(HEADLESS_SERVER_CFLAGS) AC_SUBST(HEADLESS_SERVER_LIBS) diff --git a/src/bin/headless/input.c b/src/bin/headless/input.c index f12daf5..b791fbc 100644 --- a/src/bin/headless/input.c +++ b/src/bin/headless/input.c @@ -23,6 +23,7 @@ #include #include #include +#include typedef struct { @@ -35,6 +36,7 @@ typedef struct pepper_view_t *top_view; pepper_keyrouter_t *keyrouter; + pepper_xkb_t *xkb; pepper_event_listener_t *listener_seat_keyboard_key; pepper_event_listener_t *listener_seat_keyboard_add; @@ -80,7 +82,9 @@ _cb_handle_seat_keyboard_add(pepper_event_listener_t *listener, pepper_object_t PEPPER_TRACE("[%s] keyboard added\n", __FUNCTION__); - pepper_keyboard_set_keymap_info(keyboard, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP, -1, 0); + /* FIXME: without a keymap, ecore wl2 based client must work properly. */ + //pepper_keyboard_set_keymap_info(keyboard, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP, -1, 0); + pepper_xkb_keyboard_set_keymap(hi->xkb, keyboard, NULL); h = pepper_object_add_event_listener((pepper_object_t *)keyboard, PEPPER_EVENT_KEYBOARD_KEY, 0, _cb_handle_keyboard_key, hi); @@ -293,9 +297,16 @@ static void headless_input_init_modules(headless_input_t *hi) { pepper_keyrouter_t *keyrouter = NULL; + pepper_xkb_t *xkb = NULL; PEPPER_TRACE("[%s] ... begin\n", __FUNCTION__); + /* create pepper xkb */ + xkb = pepper_xkb_create(); + PEPPER_CHECK(xkb, goto end, "Failed to create pepper_xkb !\n"); + + hi->xkb = xkb; + /* create pepper keyrouter */ keyrouter = pepper_keyrouter_create(hi->compositor); PEPPER_CHECK(keyrouter, goto end, "Failed to create keyrouter !\n"); @@ -306,16 +317,24 @@ headless_input_init_modules(headless_input_t *hi) return; end: - if (keyrouter) - pepper_keyrouter_destroy(keyrouter); + if (hi->xkb) + pepper_xkb_destroy(hi->xkb); + if (hi->keyrouter) + pepper_keyrouter_destroy(hi->keyrouter); + + hi->xkb = NULL; + hi->keyrouter = NULL; } static void headless_input_deinit_modules(headless_input_t *hi) { + if (hi->xkb) + pepper_xkb_destroy(hi->xkb); if (hi->keyrouter) pepper_keyrouter_destroy(hi->keyrouter); + hi->xkb = NULL; hi->keyrouter = NULL; } -- 2.34.1