bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/enlightenment.git/commit/?id=19db5f256ccdd60a19a0bae9d2fa22573db4006c
commit 19db5f256ccdd60a19a0bae9d2fa22573db4006c Author: Marcel Hollerbach <marcel-hollerb...@t-online.de> Date: Thu Mar 24 20:36:26 2016 +0100 e_xkb: init before e_comp_wl init for the case e_xkb gets initialized, we need to init it before ecore_drm is called, otherwise ecore_drm will create his own context and keymap, which will be overriden a few moment later when e_xkb is initializied. So by calling e_comp_wl_input_keymap_set before ecore_drm_init the correct context and keymap is set and no useless elements are created. The mainproblem is that the comp_type is set when the compositor is already running, so we have to pass the type at the init to the e_xkb to tell for which kind of compositor we are running. --- src/bin/e_comp.c | 7 ++++++- src/bin/e_main.c | 7 ------- src/bin/e_xkb.c | 20 +++++++++++++------- src/bin/e_xkb.h | 2 +- src/modules/xkbswitch/e_mod_config.c | 2 -- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index 0f9fbf1..fdb5b50 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -1100,6 +1100,7 @@ e_comp_init(void) char buf[128]; snprintf(buf, sizeof(buf), "wl_%s", eng); + e_xkb_init(E_PIXMAP_TYPE_WL); if (e_module_enable(e_module_new(buf))) { e_comp->comp_type = E_PIXMAP_TYPE_WL; @@ -1110,7 +1111,10 @@ e_comp_init(void) #ifndef HAVE_WAYLAND_ONLY if (e_comp_x_init()) - e_comp->comp_type = E_PIXMAP_TYPE_X; + { + e_comp->comp_type = E_PIXMAP_TYPE_X; + e_xkb_init(E_PIXMAP_TYPE_X); + } else #endif { @@ -1132,6 +1136,7 @@ e_comp_init(void) NULL }; + e_xkb_init(E_PIXMAP_TYPE_WL); e_util_env_set("HYBRIS_EGLPLATFORM", "wayland"); for (test = eng; *test; test++) { diff --git a/src/bin/e_main.c b/src/bin/e_main.c index f70e506..7993aa4 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -1615,13 +1615,6 @@ _e_main_screens_init(void) e_error_message_show(_("Enlightenment cannot create a compositor.\n")); _e_main_shutdown(-1); } - TS("E_Xkb Init"); - if (!e_xkb_init()) - { - e_error_message_show(_("Enlightenment cannot setup XKB Keyboard layouts.\n")); - _e_main_shutdown(-1); - } - TS("E_Xkb Init Done"); _e_main_desk_restore(); diff --git a/src/bin/e_xkb.c b/src/bin/e_xkb.c index 36a7ac9..3f88152 100644 --- a/src/bin/e_xkb.c +++ b/src/bin/e_xkb.c @@ -1,7 +1,7 @@ #include "e.h" static void _e_xkb_update_event(int); - +static void _e_xkb_type_update(E_Pixmap_Type comp_type, int cur_group); static int _e_xkb_cur_group = -1; static Ecore_Event_Handler *xkb_state_handler = NULL; static int _e_xkb_skip_events = 0; @@ -67,16 +67,16 @@ _xkb_changed_state(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) /* externally accessible functions */ E_API int -e_xkb_init(void) +e_xkb_init(E_Pixmap_Type comp_type) { if (!E_EVENT_XKB_CHANGED) E_EVENT_XKB_CHANGED = ecore_event_type_new(); #ifndef HAVE_WAYLAND_ONLY - if (e_comp->comp_type == E_PIXMAP_TYPE_X) + if (comp_type == E_PIXMAP_TYPE_X) xkb_state_handler = ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, _xkb_changed_state, NULL); #endif if (e_config->xkb.dont_touch_my_damn_keyboard) return 1; - e_xkb_update(-1); + _e_xkb_type_update(comp_type, -1); if (e_config->xkb.cur_layout) ecore_timer_add(1.5, _e_xkb_init_timer, e_config->xkb.current_layout); else if (e_config->xkb.selected_layout) @@ -280,16 +280,22 @@ _e_wl_xkb_update(int cur_group) #endif } -E_API void -e_xkb_update(int cur_group) +static void +_e_xkb_type_update(E_Pixmap_Type comp_type, int cur_group) { - if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + if (comp_type == E_PIXMAP_TYPE_WL) _e_wl_xkb_update(cur_group); else _e_x_xkb_update(cur_group); } E_API void +e_xkb_update(int cur_group) +{ + _e_xkb_type_update(e_comp->comp_type, cur_group); +} + +E_API void e_xkb_layout_next(void) { Eina_List *l; diff --git a/src/bin/e_xkb.h b/src/bin/e_xkb.h index 02b0d40..9520e46 100644 --- a/src/bin/e_xkb.h +++ b/src/bin/e_xkb.h @@ -3,7 +3,7 @@ #ifndef E_XKB_H #define E_XKB_H -E_API int e_xkb_init(void); +E_API int e_xkb_init(E_Pixmap_Type comp_type); E_API int e_xkb_shutdown(void); E_API void e_xkb_update(int); E_API void e_xkb_layout_next(void); diff --git a/src/modules/xkbswitch/e_mod_config.c b/src/modules/xkbswitch/e_mod_config.c index f0f0a4d..64f54ad 100644 --- a/src/modules/xkbswitch/e_mod_config.c +++ b/src/modules/xkbswitch/e_mod_config.c @@ -295,8 +295,6 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata) e_config->xkb.used_options = eina_list_append(e_config->xkb.used_options, oc); } - e_xkb_init(); - e_config_save_queue(); return 1; } --