xkb no longer sets dummy default layouts and is smarter about applying configs without layouts
SVN revision: 79141
This commit is contained in:
parent
c3569031ff
commit
031624abd9
|
@ -21,6 +21,8 @@ e_xkb_init(void)
|
||||||
cl = eina_list_data_get(e_config->xkb.used_layouts);
|
cl = eina_list_data_get(e_config->xkb.used_layouts);
|
||||||
e_xkb_layout_set(cl->name);
|
e_xkb_layout_set(cl->name);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
e_xkb_update(-1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +40,7 @@ e_xkb_update(int cur_group)
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Eina_Strbuf *buf;
|
Eina_Strbuf *buf;
|
||||||
|
|
||||||
if (!e_config->xkb.used_layouts) return;
|
if ((!e_config->xkb.used_layouts) && (!e_config->xkb.used_options) && (!e_config->xkb.default_model)) return;
|
||||||
if (cur_group != -1)
|
if (cur_group != -1)
|
||||||
{
|
{
|
||||||
_e_xkb_cur_group = cur_group;
|
_e_xkb_cur_group = cur_group;
|
||||||
|
@ -51,39 +53,55 @@ e_xkb_update(int cur_group)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
buf = eina_strbuf_new();
|
buf = eina_strbuf_new();
|
||||||
eina_strbuf_append(buf, "setxkbmap -layout '");
|
eina_strbuf_append(buf, "setxkbmap ");
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl)
|
if (e_config->xkb.used_layouts)
|
||||||
{
|
{
|
||||||
if (cl->name)
|
eina_strbuf_append(buf, "-layout '");
|
||||||
|
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl)
|
||||||
{
|
{
|
||||||
eina_strbuf_append(buf, cl->name);
|
if (cl->name)
|
||||||
eina_strbuf_append(buf, ",");
|
{
|
||||||
|
eina_strbuf_append(buf, cl->name);
|
||||||
|
eina_strbuf_append(buf, ",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
eina_strbuf_append(buf, "' -variant '");
|
||||||
|
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl)
|
||||||
|
{
|
||||||
|
if (cl->variant)
|
||||||
|
{
|
||||||
|
if (!strcmp(cl->variant, "basic")) continue;
|
||||||
|
eina_strbuf_append(buf, cl->variant);
|
||||||
|
eina_strbuf_append(buf, ",");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
eina_strbuf_append(buf, ",");
|
||||||
|
}
|
||||||
|
eina_strbuf_append(buf, "'");
|
||||||
|
|
||||||
|
/* use first entry in used layouts */
|
||||||
|
cl = e_config->xkb.used_layouts->data;
|
||||||
|
|
||||||
|
if (cl->model)
|
||||||
|
{
|
||||||
|
eina_strbuf_append(buf, " -model '");
|
||||||
|
if (strcmp(cl->model, "default"))
|
||||||
|
eina_strbuf_append(buf, cl->model);
|
||||||
|
else if ((e_config->xkb.default_model) &&
|
||||||
|
(strcmp(e_config->xkb.default_model, "default")))
|
||||||
|
eina_strbuf_append(buf, e_config->xkb.default_model);
|
||||||
|
else
|
||||||
|
eina_strbuf_append(buf, "default");
|
||||||
|
eina_strbuf_append(buf, "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eina_strbuf_append(buf, "' -variant '");
|
else if (e_config->xkb.default_model)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl)
|
|
||||||
{
|
|
||||||
if (cl->variant)
|
|
||||||
{
|
|
||||||
if (!strcmp(cl->variant, "basic")) continue;
|
|
||||||
eina_strbuf_append(buf, cl->variant);
|
|
||||||
eina_strbuf_append(buf, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
eina_strbuf_append(buf, ",");
|
|
||||||
}
|
|
||||||
eina_strbuf_append(buf, "'");
|
|
||||||
|
|
||||||
/* use first entry in used layouts */
|
|
||||||
cl = e_config->xkb.used_layouts->data;
|
|
||||||
|
|
||||||
if (cl->model)
|
|
||||||
{
|
{
|
||||||
eina_strbuf_append(buf, " -model '");
|
eina_strbuf_append(buf, " -model '");
|
||||||
if (strcmp(cl->model, "default"))
|
if (strcmp(e_config->xkb.default_model, "default"))
|
||||||
eina_strbuf_append(buf, cl->model);
|
eina_strbuf_append(buf, e_config->xkb.default_model);
|
||||||
else if ((e_config->xkb.default_model) &&
|
else if ((e_config->xkb.default_model) &&
|
||||||
(strcmp(e_config->xkb.default_model, "default")))
|
(strcmp(e_config->xkb.default_model, "default")))
|
||||||
eina_strbuf_append(buf, e_config->xkb.default_model);
|
eina_strbuf_append(buf, e_config->xkb.default_model);
|
||||||
|
@ -92,17 +110,20 @@ e_xkb_update(int cur_group)
|
||||||
eina_strbuf_append(buf, "'");
|
eina_strbuf_append(buf, "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear options */
|
if (e_config->xkb.used_options)
|
||||||
eina_strbuf_append(buf, " -option ");
|
|
||||||
|
|
||||||
/* add in selected options */
|
|
||||||
EINA_LIST_FOREACH(e_config->xkb.used_options, l, op)
|
|
||||||
{
|
{
|
||||||
if (op->name)
|
/* clear options */
|
||||||
|
eina_strbuf_append(buf, " -option ");
|
||||||
|
|
||||||
|
/* add in selected options */
|
||||||
|
EINA_LIST_FOREACH(e_config->xkb.used_options, l, op)
|
||||||
{
|
{
|
||||||
eina_strbuf_append(buf, " -option '");
|
if (op->name)
|
||||||
eina_strbuf_append(buf, op->name);
|
{
|
||||||
eina_strbuf_append(buf, "'");
|
eina_strbuf_append(buf, " -option '");
|
||||||
|
eina_strbuf_append(buf, op->name);
|
||||||
|
eina_strbuf_append(buf, "'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
INF("SET XKB RUN: %s", eina_strbuf_string_get(buf));
|
INF("SET XKB RUN: %s", eina_strbuf_string_get(buf));
|
||||||
|
|
|
@ -60,22 +60,6 @@ EAPI E_Module_Api e_modapi =
|
||||||
"XKB Switcher"
|
"XKB Switcher"
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
|
||||||
_e_xkb_default_add(void)
|
|
||||||
{
|
|
||||||
E_Config_XKB_Layout *nl;
|
|
||||||
|
|
||||||
CRI("No kbd layouts found! Probably hit super-annoying-xkb-module bug!");
|
|
||||||
|
|
||||||
nl = E_NEW(E_Config_XKB_Layout, 1);
|
|
||||||
nl->name = eina_stringshare_add("default");
|
|
||||||
nl->model = eina_stringshare_add("default");
|
|
||||||
nl->variant = eina_stringshare_add("basic");
|
|
||||||
|
|
||||||
e_config->xkb.used_layouts =
|
|
||||||
eina_list_append(e_config->xkb.used_layouts, nl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Module initializer
|
/* Module initializer
|
||||||
* Initializes the configuration file, checks its versions, populates
|
* Initializes the configuration file, checks its versions, populates
|
||||||
* menus, finds the rules file, initializes gadget icon.
|
* menus, finds the rules file, initializes gadget icon.
|
||||||
|
@ -92,8 +76,6 @@ e_modapi_init(E_Module *m)
|
||||||
_xkb_cfg_dialog);
|
_xkb_cfg_dialog);
|
||||||
_xkb.module = m;
|
_xkb.module = m;
|
||||||
ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, _xkb_changed_state, NULL);
|
ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, _xkb_changed_state, NULL);
|
||||||
if (!e_config->xkb.default_model) e_config->xkb.default_model = eina_stringshare_add("default");
|
|
||||||
if (!e_config->xkb.used_layouts) _e_xkb_default_add();
|
|
||||||
/* Gadcon */
|
/* Gadcon */
|
||||||
e_gadcon_provider_register(&_gc_class);
|
e_gadcon_provider_register(&_gc_class);
|
||||||
return m;
|
return m;
|
||||||
|
|
Loading…
Reference in New Issue