From fdd472879b61c3230fabe6f8f2e9da1cd52505b0 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 9 Aug 2019 09:50:33 +0100 Subject: [PATCH] xkb - make basic variant null now and handle in wl too the same as x now russian works for me. :) fixes T7979 @fix --- src/bin/e_xkb.c | 16 ++++++---- src/modules/xkbswitch/e_mod_config.c | 48 ++++++++++++++++++++-------- src/modules/xkbswitch/e_mod_parse.c | 2 +- 3 files changed, 46 insertions(+), 20 deletions(-) diff --git a/src/bin/e_xkb.c b/src/bin/e_xkb.c index 493610d36..e33b17606 100644 --- a/src/bin/e_xkb.c +++ b/src/bin/e_xkb.c @@ -308,23 +308,27 @@ _e_wl_xkb_reconfig(void) eina_strbuf_append(layouts, cl->name); eina_strbuf_append_char(layouts, ','); } + else + eina_strbuf_append_char(layouts, ','); - if (cl->variant) + if ((cl->variant) && (strcmp(cl->variant, "basic"))) { eina_strbuf_append(variants, cl->variant); eina_strbuf_append_char(variants, ','); } + else + eina_strbuf_append_char(variants, ','); } /* collect model to use */ /* set keymap to the compositor */ e_comp_wl_input_keymap_set(NULL, - e_config->xkb.default_model, - eina_strbuf_string_get(layouts), //pool of layouts to use - eina_strbuf_string_get(variants), //pool of variants to use - eina_strbuf_string_get(options) //list of options - ); + e_config->xkb.default_model, + eina_strbuf_string_get(layouts), //pool of layouts to use + eina_strbuf_string_get(variants), //pool of variants to use + eina_strbuf_string_get(options) //list of options + ); eina_strbuf_free(variants); eina_strbuf_free(layouts); diff --git a/src/modules/xkbswitch/e_mod_config.c b/src/modules/xkbswitch/e_mod_config.c index 24fb40efb..4e9a48e2c 100644 --- a/src/modules/xkbswitch/e_mod_config.c +++ b/src/modules/xkbswitch/e_mod_config.c @@ -521,8 +521,14 @@ _basic_create_fill(E_Config_Dialog_Data *cfdata) e_xkb_flag_file_get(buf, sizeof(buf), name); elm_image_file_set(ic, buf, NULL); - snprintf(buf, sizeof(buf), "%s (%s, %s)", - cl->name, cl->model, cl->variant); + snprintf(buf, sizeof(buf), "%s%s%s%s%s%s", + cl->name ? cl->name : _("No Name"), + cl->model || cl->variant ? " (" : "", + cl->model ? cl->model : "", + cl->model && cl->variant ? ", " : "", + cl->variant ? cl->variant : "", + cl->model || cl->variant ? ")" : "" + ); evas_object_show(ic); it = elm_list_item_append(cfdata->used_list, buf, ic, NULL, NULL, cl); @@ -1451,7 +1457,7 @@ _dlg_add_cb_ok(void *data, E_Dialog *dlg) E_XKB_Model *m; E_XKB_Variant *v; E_Config_XKB_Layout *cl; - char buf[PATH_MAX], icon_buf[PATH_MAX]; + char buf[512], icon_buf[PATH_MAX]; Evas_Object *ic; Elm_Object_Item *it; /* Configuration information */ @@ -1480,8 +1486,14 @@ _dlg_add_cb_ok(void *data, E_Dialog *dlg) ic = elm_icon_add(cfdata->used_list); e_xkb_flag_file_get(icon_buf, sizeof(icon_buf), cl->name); elm_image_file_set(ic, icon_buf, NULL); - snprintf(buf, sizeof(buf), "%s (%s, %s)", - cl->name, cl->model, cl->variant); + snprintf(buf, sizeof(buf), "%s%s%s%s%s%s", + cl->name ? cl->name : _("No Name"), + cl->model || cl->variant ? " (" : "", + cl->model ? cl->model : "", + cl->model && cl->variant ? ", " : "", + cl->variant ? cl->variant : "", + cl->model || cl->variant ? ")" : "" + ); elm_list_item_append(cfdata->used_list, buf, ic, NULL, NULL, cl); elm_list_go(cfdata->used_list); @@ -1499,9 +1511,13 @@ static char * _layout_gl_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED) { E_XKB_Layout *layout = data; - char buf[PATH_MAX]; + char buf[512]; - snprintf(buf, sizeof(buf), "%s (%s)", layout->description, layout->name); + snprintf(buf, sizeof(buf), "%s%s%s%s", + layout->description ? layout->description : _("No Description"), + layout->name ? " (" : "", + layout->name ? layout->name : "", + layout->name ? ")" : ""); return strdup(buf); } @@ -1580,10 +1596,13 @@ static char * _model_gl_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED) { E_XKB_Model *model = data; - char buf[PATH_MAX]; - - snprintf(buf, sizeof(buf), "%s (%s)", model->description, model->name); + char buf[512]; + snprintf(buf, sizeof(buf), "%s%s%s%s", + model->description ? model->description : _("No Description"), + model->name ? " (" : "", + model->name ? model->name : "", + model->name ? ")" : ""); return strdup(buf); } @@ -1591,10 +1610,13 @@ static char * _variant_gl_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED) { E_XKB_Variant *variant = data; - char buf[PATH_MAX]; - - snprintf(buf, sizeof(buf), "%s (%s)", variant->name, variant->description); + char buf[512]; + snprintf(buf, sizeof(buf), "%s%s%s%s", + variant->name ? variant->name : _("No Name"), + variant->description ? " (" : "", + variant->description ? variant->description : "", + variant->description ? ")" : ""); return strdup(buf); } diff --git a/src/modules/xkbswitch/e_mod_parse.c b/src/modules/xkbswitch/e_mod_parse.c index 9b0894bf5..0de697e5e 100644 --- a/src/modules/xkbswitch/e_mod_parse.c +++ b/src/modules/xkbswitch/e_mod_parse.c @@ -193,7 +193,7 @@ parse_rules(void) ++p; variant = E_NEW(E_XKB_Variant, 1); - variant->name = eina_stringshare_add("basic"); + variant->name = NULL; // used to be "basic" but now NULL will do variant->description = eina_stringshare_add("Default layout variant"); txt = evas_textblock_text_markup_to_utf8(NULL, p);