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.
This commit is contained in:
Marcel Hollerbach 2016-03-24 20:36:26 +01:00
parent 62440eb5fe
commit 19db5f256c
5 changed files with 20 additions and 18 deletions

View File

@ -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_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++)
{

View File

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

View File

@ -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,15 +280,21 @@ _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)
{

View File

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

View File

@ -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;
}