From 35ae02a5243d786d602e8902897881800573d4a5 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Thu, 14 Jan 2016 17:07:45 +0100 Subject: [PATCH] e_xkb: implement keyboard setting on wayland. this splits e_xkb_update into a update function for wayland and x. The matching function to the compositor type is called. @feature --- src/bin/e_xkb.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/bin/e_xkb.c b/src/bin/e_xkb.c index 7c212216b..4c7c76e1d 100644 --- a/src/bin/e_xkb.c +++ b/src/bin/e_xkb.c @@ -51,8 +51,8 @@ e_xkb_shutdown(void) return 1; } -E_API void -e_xkb_update(int cur_group) +static void +_e_x_xkb_update(int cur_group) { E_Config_XKB_Layout *cl; E_Config_XKB_Option *op; @@ -155,6 +155,37 @@ e_xkb_update(int cur_group) eina_strbuf_free(buf); } +static void +_e_wl_xkb_update(int cur_group) +{ +#ifdef HAVE_WAYLAND + E_Config_XKB_Layout *cl; + Eina_List *l; + + if (cur_group == -1) { + cur_group = e_config->xkb.cur_group; + } + + l = eina_list_nth_list(e_config->xkb.used_layouts, cur_group); + if (!l) return; + cl = eina_list_data_get(l); + + e_comp_wl_input_keymap_set(NULL, cl->model, cl->name, NULL, NULL); + INF("Set wl keyboard to %s %s", cl->model, cl->name); +#else + (void) cur_group; +#endif +} + +E_API void +e_xkb_update(int cur_group) +{ + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + _e_wl_xkb_update(cur_group); + else + _e_x_xkb_update(cur_group); +} + E_API void e_xkb_layout_next(void) {