discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=4ef9d9e5189a9fbd18fe0ec3516f49109f06d4a8

commit 4ef9d9e5189a9fbd18fe0ec3516f49109f06d4a8
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Tue Sep 22 14:17:35 2015 -0400

    attempt to maintain currently-selected kbd layout when modifying kbd list
    
    the previous behavior would just set up the new layouts, resulting in
    the first layout in the list being applied. now it should be the case
    that if the current layout has not been deleted, it will continue to
    remain in effect; alternatively if the current layout has been modified,
    it's now more likely to be picked up and used
---
 src/modules/xkbswitch/e_mod_config.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/modules/xkbswitch/e_mod_config.c 
b/src/modules/xkbswitch/e_mod_config.c
index 28b00f1..4ac2eae 100644
--- a/src/modules/xkbswitch/e_mod_config.c
+++ b/src/modules/xkbswitch/e_mod_config.c
@@ -225,6 +225,7 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, 
E_Config_Dialog_Data *cfdata)
    E_Config_XKB_Layout *cl, *nl;
    E_Config_XKB_Option *oc;
    E_XKB_Dialog_Option *od;
+   Eina_Bool cur_ok = EINA_FALSE, sel_ok = EINA_FALSE;
 
    EINA_LIST_FREE(e_config->xkb.used_layouts, cl)
      {
@@ -243,6 +244,34 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, 
E_Config_Dialog_Data *cfdata)
 
         e_config->xkb.used_layouts =
           eina_list_append(e_config->xkb.used_layouts, nl);
+        if (e_config_xkb_layout_eq(e_config->xkb.current_layout, nl))
+          cur_ok = EINA_TRUE;
+        if (e_config_xkb_layout_eq(e_config->xkb.sel_layout, nl))
+          sel_ok = EINA_TRUE;
+     }
+   if (!cur_ok)
+     {
+        E_FREE_FUNC(e_config->xkb.current_layout, e_config_xkb_layout_free);
+        EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl)
+          if (e_config->xkb.cur_layout == cl->name)
+            {
+               e_config->xkb.current_layout = e_config_xkb_layout_dup(cl);
+               break;
+            }
+        if (!e_config->xkb.current_layout)
+          eina_stringshare_replace(&e_config->xkb.cur_layout, NULL);
+     }
+   if (!sel_ok)
+     {
+        E_FREE_FUNC(e_config->xkb.sel_layout, e_config_xkb_layout_free);
+        EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl)
+          if (e_config->xkb.selected_layout == cl->name)
+            {
+               e_config->xkb.sel_layout = e_config_xkb_layout_dup(cl);
+               break;
+            }
+        if (!e_config->xkb.sel_layout)
+          eina_stringshare_replace(&e_config->xkb.selected_layout, NULL);
      }
 
    eina_stringshare_replace(&e_config->xkb.default_model, 
cfdata->default_model);
@@ -266,8 +295,7 @@ _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_update(-1);
-   _xkb_update_icon(0);
+   e_xkb_init();
 
    e_config_save_queue();
    return 1;

-- 


Reply via email to