xkb - use new feature to ignore just xmodmap changes

this avoids e re-setting kbd layouts on just "xmomdmap" changes. needs
new feature in efl slated for efl 1.27
This commit is contained in:
Carsten Haitzler 2022-03-24 17:54:30 +00:00
parent 5d430a3fa6
commit f81387470f
2 changed files with 16 additions and 0 deletions

View File

@ -2510,6 +2510,7 @@ _e_comp_x_mapping_change(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_E
E_Client *ec;
if (_e_comp_x_mapping_change_disabled) return ECORE_CALLBACK_RENEW;
printf("COMPX: _e_comp_x_mapping_change\n");
e_comp_canvas_keys_ungrab();
EINA_LIST_FOREACH(e_comp->clients, l, ec)
{

View File

@ -77,15 +77,21 @@ _e_xkb_save_group(void *data)
static Eina_Bool
_xkb_new_keyboard(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
Ecore_X_Event_Xkb *ev = event;
if (skip_new_keyboard > 0)
{
skip_new_keyboard --;
return ECORE_CALLBACK_PASS_ON;
}
// skip just "xmodmap" changes
if ((ev) && (ev->map_notify)) return ECORE_CALLBACK_PASS_ON;
printf("XKB: EV: _xkb_new_keyboard\n");
//we have to restore our settings here
e_xkb_reconfig();
e_xkb_update(e_config->xkb.cur_group);
e_deskenv_xmodmap_run();
return ECORE_CALLBACK_PASS_ON;
}
@ -104,6 +110,7 @@ _xkb_new_state(void* data EINA_UNUSED, int type EINA_UNUSED, void *event)
static Eina_Bool
_xkb_keymap(void* data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
printf("XKB: EV: _xkb_keymap\n");
return ECORE_CALLBACK_PASS_ON;
}
#endif
@ -134,6 +141,7 @@ e_xkb_init(E_Pixmap_Type comp_type)
}
#endif
if (e_config->xkb.dont_touch_my_damn_keyboard) return 1;
printf("XKB: e_xkb_init\n");
_e_xkb_type_reconfig(comp_type);
@ -173,6 +181,7 @@ _e_x_xkb_reconfig(void)
Eina_Strbuf *buf;
if (e_config->xkb.dont_touch_my_damn_keyboard) return;
printf("XKB: _e_x_xkb_reconfig\n");
if ((!e_config->xkb.used_layouts) && (!e_config->xkb.used_options) && (!e_config->xkb.default_model)) return;
if (!getenv("DISPLAY")) return;
@ -256,6 +265,7 @@ static void
_e_x_xkb_update(int cur_group)
{
if (e_config->xkb.dont_touch_my_damn_keyboard) return;
printf("XKB: _e_x_xkb_update\n");
if ((!e_config->xkb.used_layouts) && (!e_config->xkb.used_options) && (!e_config->xkb.default_model)) return;
if (!getenv("DISPLAY")) return;
if (cur_group != _e_xkb_cur_group)
@ -354,6 +364,7 @@ _e_wl_xkb_reconfig(void)
static void
_e_xkb_type_reconfig(E_Pixmap_Type comp_type)
{
printf("XKB: _e_xkb_type_reconfig\n");
if (comp_type == E_PIXMAP_TYPE_X)
_e_x_xkb_reconfig();
else if (comp_type == E_PIXMAP_TYPE_WL)
@ -391,6 +402,7 @@ e_xkb_layout_next(void)
E_Config_XKB_Layout *cl;
if (e_config->xkb.dont_touch_my_damn_keyboard) return;
printf("XKB: e_xkb_layout_next\n");
if (!e_config->xkb.used_layouts) return;
l = eina_list_nth_list(e_config->xkb.used_layouts, e_config->xkb.cur_group);
l = eina_list_next(l);
@ -413,6 +425,7 @@ e_xkb_layout_prev(void)
E_Config_XKB_Layout *cl;
if (e_config->xkb.dont_touch_my_damn_keyboard) return;
printf("XKB: e_xkb_layout_prev\n");
if (!e_config->xkb.used_layouts) return;
l = eina_list_nth_list(e_config->xkb.used_layouts, e_config->xkb.cur_group);
l = eina_list_prev(l);
@ -438,6 +451,7 @@ e_xkb_layout_get(void)
unsigned int n = 0;
if (e_config->xkb.dont_touch_my_damn_keyboard) return NULL;
printf("XKB: e_xkb_layout_get\n");
if (e_config->xkb.current_layout) return e_config->xkb.current_layout;
if (_e_xkb_cur_group >= 0)
n = _e_xkb_cur_group;
@ -453,6 +467,7 @@ e_xkb_layout_set(const E_Config_XKB_Layout *cl)
EINA_SAFETY_ON_NULL_RETURN(cl);
if (e_config->xkb.dont_touch_my_damn_keyboard) return;
printf("XKB: e_xkb_layout_set\n");
if (e_config_xkb_layout_eq(e_config->xkb.current_layout, cl)) return;
cl2 = e_config_xkb_layout_dup(e_config->xkb.current_layout);
e_config_xkb_layout_free(e_config->xkb.current_layout);