giant rollup commit fixing all xkb issues

tickets #1799, #2082


SVN revision: 83531
devs/asdfuser/comp-sounds
Mike Blumenkrantz 10 years ago
parent a4d35ff86c
commit 57933c9d02
  1. 1
      ChangeLog
  2. 3
      NEWS
  3. 7
      src/bin/e_actions.c
  4. 58
      src/bin/e_config.c
  5. 9
      src/bin/e_config.h
  6. 14
      src/bin/e_desklock.c
  7. 89
      src/bin/e_xkb.c
  8. 8
      src/bin/e_xkb.h
  9. 2
      src/modules/wizard/page_011.c
  10. 73
      src/modules/xkbswitch/e_mod_main.c

@ -3,6 +3,7 @@
* fixed window autoraise triggering from pointer slide
* fixed opening of links in filemanager in some cases
* filemanager now ignores changes to .part files
* fixed a number of bugs where keyboard layouts could not be applied or selected
2013-01-29 Brian Miculcy

@ -19,6 +19,7 @@ Additions:
* Added D-Bus menu support
* Added e_comp namespace and E_EVENT_COMP events
* Added API for fetching module .desktop files
* e_config_xkb functions
Config:
* Added option for disabling icons in menus
* Added option for disabling pointer warping when performing directional focus changes using winlist
@ -35,6 +36,7 @@ Changes:
API:
* e_menu_category_callback create callback parameter order has been changed
* e_manager_comp_set() is no longer accessible by modules
* e_xkb_layout API now deals directly with E_Config_XKB_Layout structs
Deprecations:
*
@ -127,3 +129,4 @@ Fixes:
* fixed window autoraise triggering from pointer slide
* fixed opening of links in filemanager in some cases
* filemanager now ignores changes to .part files
* fixed bugs where keyboard layouts could not be applied or selected

@ -2872,8 +2872,13 @@ ACT_FN_GO(backlight_adjust, )
ACT_FN_GO(kbd_layout, )
{
unsigned int x;
if (!params) return;
e_xkb_layout_set(params);
errno = 0;
x = strtoul(params, NULL, 10);
if (errno || (x > eina_list_count(e_config->xkb.used_layouts) - 1)) return;
e_xkb_layout_set(eina_list_nth(e_config->xkb.used_layouts, x));
}
ACT_FN_GO(kbd_layout_next, __UNUSED__)

@ -955,6 +955,10 @@ e_config_init(void)
E_CONFIG_LIST(D, T, xkb.used_options, _e_config_xkb_option_edd);
E_CONFIG_VAL(D, T, xkb.only_label, INT);
E_CONFIG_VAL(D, T, xkb.default_model, STR);
E_CONFIG_SUB(D, T, xkb.current_layout, _e_config_xkb_option_edd);
E_CONFIG_SUB(D, T, xkb.sel_layout, _e_config_xkb_option_edd);
E_CONFIG_SUB(D, T, xkb.lock_layout, _e_config_xkb_option_edd);
E_CONFIG_VAL(D, T, xkb.selected_layout, STR);
E_CONFIG_VAL(D, T, xkb.cur_layout, STR);
E_CONFIG_VAL(D, T, xkb.desklock_layout, STR);
@ -1006,7 +1010,6 @@ e_config_shutdown(void)
EAPI void
e_config_load(void)
{
E_Config *tcfg = NULL;
int reload = 0;
e_config = e_config_domain_load("e", _e_config_edd);
@ -1062,27 +1065,27 @@ e_config_load(void)
}
if (e_config->config_version < E_CONFIG_FILE_VERSION)
{
/* we need an upgrade of some sort */
tcfg = e_config_domain_system_load("e", _e_config_edd);
if (!tcfg)
{
const char *pprofile;
pprofile = e_config_profile_get();
if (pprofile) pprofile = eina_stringshare_add(pprofile);
e_config_profile_set("standard");
tcfg = e_config_domain_system_load("e", _e_config_edd);
e_config_profile_set(pprofile);
if (pprofile) eina_stringshare_del(pprofile);
}
/* can't find your profile or standard or default - try default after
* a wipe */
if (!tcfg)
if (e_config->config_version - (E_CONFIG_FILE_EPOCH * 1000000) == 4)
{
e_config_profile_set("default");
e_config_profile_del(e_config_profile_get());
e_config_save_block_set(1);
e_sys_action_do(E_SYS_RESTART, NULL);
E_Config_XKB_Layout *cl;
Eina_List *l;
if (e_config->xkb.cur_layout || e_config->xkb.selected_layout || e_config->xkb.desklock_layout)
{
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl)
{
if (cl->name == e_config->xkb.cur_layout)
e_config->xkb.current_layout = e_config_xkb_layout_dup(cl);
if (cl->name == e_config->xkb.selected_layout)
e_config->xkb.sel_layout = e_config_xkb_layout_dup(cl);
if (cl->name == e_config->xkb.desklock_layout)
e_config->xkb.lock_layout = e_config_xkb_layout_dup(cl);
if (((!!e_config->xkb.current_layout) == (!!e_config->xkb.cur_layout)) &&
((!!e_config->xkb.sel_layout) == (!!e_config->xkb.selected_layout)) &&
((!!e_config->xkb.lock_layout) == (!!e_config->xkb.desklock_layout)))
break;
}
}
}
}
if (!e_config->remember_internal_fm_windows)
@ -1835,7 +1838,6 @@ _e_config_free(E_Config *ecf)
E_Path_Dir *epd;
E_Remember *rem;
E_Config_Env_Var *evr;
E_Config_XKB_Layout *cl;
E_Config_XKB_Option *op;
E_Config_Desktop_Window_Profile *wp;
@ -1849,14 +1851,7 @@ _e_config_free(E_Config *ecf)
eina_stringshare_del(ecf->xkb.default_model);
EINA_LIST_FREE(ecf->xkb.used_layouts, cl)
{
eina_stringshare_del(cl->name);
eina_stringshare_del(cl->model);
eina_stringshare_del(cl->variant);
E_FREE(cl);
}
E_FREE_LIST(ecf->xkb.used_layouts, e_config_xkb_layout_free);
EINA_LIST_FREE(ecf->xkb.used_options, op)
{
eina_stringshare_del(op->name);
@ -1993,6 +1988,9 @@ _e_config_free(E_Config *ecf)
eina_stringshare_del(ecf->xkb.selected_layout);
eina_stringshare_del(ecf->xkb.cur_layout);
eina_stringshare_del(ecf->xkb.desklock_layout);
e_config_xkb_layout_free(ecf->xkb.current_layout);
e_config_xkb_layout_free(ecf->xkb.sel_layout);
e_config_xkb_layout_free(ecf->xkb.lock_layout);
if (ecf->transition_start) eina_stringshare_del(ecf->transition_start);
if (ecf->transition_desk) eina_stringshare_del(ecf->transition_desk);
if (ecf->transition_change) eina_stringshare_del(ecf->transition_change);

@ -38,7 +38,7 @@ typedef struct _E_Event_Config_Icon_Theme E_Event_Config_Icon_Theme;
/* increment this whenever a new set of config values are added but the users
* config doesn't need to be wiped - simply new values need to be put in
*/
#define E_CONFIG_FILE_GENERATION 4
#define E_CONFIG_FILE_GENERATION 5
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION)
struct _E_Config
@ -398,6 +398,13 @@ struct _E_Config
int only_label;
const char *default_model;
int cur_group;
E_Config_XKB_Layout *current_layout;
E_Config_XKB_Layout *sel_layout;
E_Config_XKB_Layout *lock_layout;
/* NO LONGER USED BECAUSE I SUCK
* -zmike, 31 January 2013
*/
const char *cur_layout; // whatever the current layout is
const char *selected_layout; // whatever teh current layout that the user has selected is
const char *desklock_layout;

@ -224,8 +224,8 @@ e_desklock_show(Eina_Bool suspend)
if (e_config->desklock_language)
e_intl_language_set(e_config->desklock_language);
if (e_config->xkb.desklock_layout)
e_xkb_layout_set(e_config->xkb.desklock_layout);
if (e_config->xkb.lock_layout)
e_xkb_layout_set(e_config->xkb.lock_layout);
_e_custom_desklock_exe =
ecore_exe_run(e_config->desklock_custom_desklock_cmd, NULL);
_e_desklock_state = EINA_TRUE;
@ -311,8 +311,8 @@ works:
if (e_config->desklock_language)
e_intl_language_set(e_config->desklock_language);
if (e_config->xkb.desklock_layout)
e_xkb_layout_set(e_config->xkb.desklock_layout);
if (e_config->xkb.lock_layout)
e_xkb_layout_set(e_config->xkb.lock_layout);
total_zone_num = _e_desklock_zone_num_get();
EINA_LIST_FOREACH(managers, l, man)
@ -383,10 +383,10 @@ e_desklock_hide(void)
if (e_config->desklock_language)
e_intl_language_set(e_config->language);
if (e_config->xkb.cur_layout == e_config->xkb.desklock_layout)
if (e_config_xkb_layout_eq(e_config->xkb.current_layout, e_config->xkb.lock_layout))
{
if (e_config->xkb.selected_layout)
e_xkb_layout_set(e_config->xkb.selected_layout);
if (e_config->xkb.sel_layout)
e_xkb_layout_set(e_config->xkb.sel_layout);
}
_e_desklock_state = EINA_FALSE;

@ -9,7 +9,21 @@ EAPI int E_EVENT_XKB_CHANGED = 0;
static Eina_Bool
_e_xkb_init_timer(void *data)
{
e_xkb_layout_set(data);
Eina_List *l;
E_Config_XKB_Layout *cl2, *cl = data;
int cur_group = -1;
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl2)
{
cur_group++;
if (!cl->name) continue;
if (e_config_xkb_layout_eq(cl, cl2))
{
INF("Setting keyboard layout: %s|%s|%s", cl->name, cl->model, cl->variant);
e_xkb_update(cur_group);
break;
}
}
return EINA_FALSE;
}
@ -20,16 +34,11 @@ e_xkb_init(void)
E_EVENT_XKB_CHANGED = ecore_event_type_new();
e_xkb_update(-1);
if (e_config->xkb.cur_layout)
ecore_timer_add(1.5, _e_xkb_init_timer, 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)
ecore_timer_add(1.5, _e_xkb_init_timer, e_config->xkb.selected_layout);
ecore_timer_add(1.5, _e_xkb_init_timer, e_config->xkb.sel_layout);
else if (e_config->xkb.used_layouts)
{
E_Config_XKB_Layout *cl;
cl = eina_list_data_get(e_config->xkb.used_layouts);
ecore_timer_add(1.5, _e_xkb_init_timer, cl->name);
}
ecore_timer_add(1.5, _e_xkb_init_timer, eina_list_data_get(e_config->xkb.used_layouts));
return 1;
}
@ -133,7 +142,7 @@ e_xkb_update(int cur_group)
}
}
}
fprintf(stderr, "SET XKB RUN: %s\n", eina_strbuf_string_get(buf));
INF("SET XKB RUN: %s", eina_strbuf_string_get(buf));
ecore_exe_run(eina_strbuf_string_get(buf), NULL);
eina_strbuf_free(buf);
}
@ -152,7 +161,7 @@ e_xkb_layout_next(void)
cl = eina_list_data_get(l);
eina_stringshare_replace(&e_config->xkb.cur_layout, cl->name);
eina_stringshare_replace(&e_config->xkb.selected_layout, cl->name);
INF("Setting keyboard layout: %s", cl->name);
INF("Setting keyboard layout: %s|%s|%s", cl->name, cl->model, cl->variant);
e_xkb_update(e_config->xkb.cur_group);
_e_xkb_update_event(e_config->xkb.cur_group);
e_config_save_queue();
@ -173,7 +182,7 @@ e_xkb_layout_prev(void)
cl = eina_list_data_get(l);
eina_stringshare_replace(&e_config->xkb.cur_layout, cl->name);
eina_stringshare_replace(&e_config->xkb.selected_layout, cl->name);
INF("Setting keyboard layout: %s", cl->name);
INF("Setting keyboard layout: %s|%s|%s", cl->name, cl->model, cl->variant);
e_xkb_update(e_config->xkb.cur_group);
_e_xkb_update_event(e_config->xkb.cur_group);
e_config_save_queue();
@ -182,35 +191,35 @@ e_xkb_layout_prev(void)
/* always use this function to get the current layout's name
* to ensure the most accurate results!!!
*/
EAPI const char *
EAPI E_Config_XKB_Layout *
e_xkb_layout_get(void)
{
E_Config_XKB_Layout *cl;
unsigned int n = 0;
if (e_config->xkb.cur_layout) return e_config->xkb.cur_layout;
if (e_config->xkb.current_layout) return e_config->xkb.current_layout;
if (_e_xkb_cur_group >= 0)
n = _e_xkb_cur_group;
cl = eina_list_nth(e_config->xkb.used_layouts, n);
return cl ? cl->name : NULL;
return eina_list_nth(e_config->xkb.used_layouts, n);
}
EAPI void
e_xkb_layout_set(const char *name)
e_xkb_layout_set(const E_Config_XKB_Layout *cl)
{
Eina_List *l;
E_Config_XKB_Layout *cl;
E_Config_XKB_Layout *cl2;
int cur_group = -1;
if (!name) return;
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl)
EINA_SAFETY_ON_NULL_RETURN(cl);
if (e_config_xkb_layout_eq(e_config->xkb.current_layout, cl)) return;
e_config_xkb_layout_free(e_config->xkb.current_layout);
e_config->xkb.current_layout = e_config_xkb_layout_dup(cl);
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl2)
{
cur_group++;
if (!cl->name) continue;
if ((cl->name == name) || (!strcmp(cl->name, name)))
if (e_config_xkb_layout_eq(cl, cl2))
{
eina_stringshare_replace(&e_config->xkb.cur_layout, cl->name);
INF("Setting keyboard layout: %s", name);
INF("Setting keyboard layout: %s|%s|%s", cl->name, cl->model, cl->variant);
e_xkb_update(cur_group);
break;
}
@ -253,6 +262,38 @@ e_xkb_flag_file_get(char *buf, size_t bufsize, const char *name)
e_prefix_data_get());
}
EAPI Eina_Bool
e_config_xkb_layout_eq(const E_Config_XKB_Layout *a, const E_Config_XKB_Layout *b)
{
if (a == b) return EINA_TRUE;
if ((!a) || (!b)) return EINA_FALSE;
return ((a->name == b->name) && (a->model == b->model) && (a->variant == b->variant));
}
EAPI void
e_config_xkb_layout_free(E_Config_XKB_Layout *cl)
{
if (!cl) return;
eina_stringshare_del(cl->name);
eina_stringshare_del(cl->model);
eina_stringshare_del(cl->variant);
free(cl);
}
EAPI E_Config_XKB_Layout *
e_config_xkb_layout_dup(const E_Config_XKB_Layout *cl)
{
E_Config_XKB_Layout *cl2;
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
cl2 = E_NEW(E_Config_XKB_Layout, 1);
cl2->name = eina_stringshare_ref(cl->name);
cl2->model = eina_stringshare_ref(cl->model);
cl2->variant = eina_stringshare_ref(cl->variant);
return cl2;
}
static void
_e_xkb_update_event(int cur_group)
{

@ -8,12 +8,16 @@ EAPI int e_xkb_shutdown(void);
EAPI void e_xkb_update(int);
EAPI void e_xkb_layout_next(void);
EAPI void e_xkb_layout_prev(void);
EAPI const char *e_xkb_layout_get(void);
EAPI void e_xkb_layout_set(const char *name);
EAPI E_Config_XKB_Layout *e_xkb_layout_get(void);
EAPI void e_xkb_layout_set(const E_Config_XKB_Layout *cl);
EAPI const char *e_xkb_layout_name_reduce(const char *name);
EAPI void e_xkb_e_icon_flag_setup(Evas_Object *eicon, const char *name);
EAPI void e_xkb_flag_file_get(char *buf, size_t bufsize, const char *name);
EAPI Eina_Bool e_config_xkb_layout_eq(const E_Config_XKB_Layout *a, const E_Config_XKB_Layout *b);
EAPI void e_config_xkb_layout_free(E_Config_XKB_Layout *cl);
EAPI E_Config_XKB_Layout *e_config_xkb_layout_dup(const E_Config_XKB_Layout *cl);
extern EAPI int E_EVENT_XKB_CHANGED;
#endif

@ -117,7 +117,7 @@ implement_layout(void)
e_config->xkb.used_layouts = eina_list_prepend(e_config->xkb.used_layouts, nl);
e_xkb_update(-1);
}
e_xkb_layout_set(layout);
e_xkb_layout_set(nl);
}
EAPI int

@ -29,7 +29,7 @@ typedef struct _Instance
Evas_Object *o_xkbswitch;
Evas_Object *o_xkbflag;
Eina_Stringshare *cur_layout;
E_Config_XKB_Layout *layout;
E_Menu *lmenu;
} Instance;
@ -131,52 +131,54 @@ _xkb_update_icon(int cur_group)
{
Instance *inst;
Eina_List *l;
E_Config_XKB_Layout *layout;
const char *name = NULL;
E_Config_XKB_Layout *cl;
EINA_SAFETY_ON_NULL_RETURN(e_config->xkb.used_layouts);
//INF("ui: %d", cur_group);
layout = eina_list_nth(e_config->xkb.used_layouts, cur_group);
if (layout) name = layout->name;
EINA_SAFETY_ON_NULL_RETURN(name);
if (strchr(name, '/')) name = strchr(name, '/') + 1;
if (e_config->xkb.cur_layout != name)
eina_stringshare_replace(&e_config->xkb.cur_layout, name);
cl = eina_list_nth(e_config->xkb.used_layouts, cur_group);
EINA_SAFETY_ON_NULL_RETURN(cl);
if (!e_config_xkb_layout_eq(cl, e_config->xkb.current_layout))
{
e_config_xkb_layout_free(e_config->xkb.current_layout);
e_config->xkb.current_layout = e_config_xkb_layout_dup(cl);
}
if (e_config->xkb.only_label)
{
EINA_LIST_FOREACH(instances, l, inst)
{
if (e_config->xkb.cur_layout == inst->cur_layout) continue;
eina_stringshare_replace(&inst->cur_layout, e_config->xkb.cur_layout);
if (inst->o_xkbflag)
if (!e_config_xkb_layout_eq(e_config->xkb.current_layout, inst->layout))
{
evas_object_del(inst->o_xkbflag);
inst->o_xkbflag = NULL;
e_config_xkb_layout_free(inst->layout);
inst->layout = e_config->xkb.current_layout;
}
E_FN_DEL(evas_object_del, inst->o_xkbflag);
e_theme_edje_object_set(inst->o_xkbswitch,
"base/theme/modules/xkbswitch",
"e/modules/xkbswitch/noflag");
edje_object_part_text_set(inst->o_xkbswitch,
"e.text.label", name);
"e.text.label", cl->name);
}
}
else
{
EINA_LIST_FOREACH(instances, l, inst)
{
if (e_config->xkb.cur_layout == inst->cur_layout) continue;
eina_stringshare_replace(&inst->cur_layout, e_config->xkb.cur_layout);
if (!e_config_xkb_layout_eq(e_config->xkb.current_layout, inst->layout))
{
e_config_xkb_layout_free(inst->layout);
inst->layout = e_config->xkb.current_layout;
}
if (!inst->o_xkbflag)
inst->o_xkbflag = e_icon_add(inst->gcc->gadcon->evas);
e_theme_edje_object_set(inst->o_xkbswitch,
"base/theme/modules/xkbswitch",
"e/modules/xkbswitch/main");
e_xkb_e_icon_flag_setup(inst->o_xkbflag, name);
e_xkb_e_icon_flag_setup(inst->o_xkbflag, cl->name);
edje_object_part_swallow(inst->o_xkbswitch, "e.swallow.flag",
inst->o_xkbflag);
edje_object_part_text_set(inst->o_xkbswitch, "e.text.label",
e_xkb_layout_name_reduce(name));
e_xkb_layout_name_reduce(cl->name));
}
}
}
@ -187,19 +189,12 @@ static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *gcname, const char *id, const char *style)
{
Instance *inst;
const char *name;
name = e_config->xkb.cur_layout;
if (!name) name = e_config->xkb.selected_layout;
if ((!name) && e_config->xkb.used_layouts)
name = ((E_Config_XKB_Layout *)
eina_list_data_get(e_config->xkb.used_layouts))->name;
/* The instance */
inst = E_NEW(Instance, 1);
/* The gadget */
inst->o_xkbswitch = edje_object_add(gc->evas);
inst->cur_layout = eina_stringshare_ref(name);
inst->layout = e_xkb_layout_get();
if (e_config->xkb.only_label)
e_theme_edje_object_set(inst->o_xkbswitch,
"base/theme/modules/xkbswitch",
@ -209,7 +204,7 @@ _gc_init(E_Gadcon *gc, const char *gcname, const char *id, const char *style)
"base/theme/modules/xkbswitch",
"e/modules/xkbswitch/main");
edje_object_part_text_set(inst->o_xkbswitch, "e.text.label",
e_xkb_layout_name_reduce(name));
e_xkb_layout_name_reduce(inst->layout->name));
/* The gadcon client */
inst->gcc = e_gadcon_client_new(gc, gcname, id, style, inst->o_xkbswitch);
inst->gcc->data = inst;
@ -217,7 +212,7 @@ _gc_init(E_Gadcon *gc, const char *gcname, const char *id, const char *style)
if (!e_config->xkb.only_label)
{
inst->o_xkbflag = e_icon_add(gc->evas);
e_xkb_e_icon_flag_setup(inst->o_xkbflag, name);
e_xkb_e_icon_flag_setup(inst->o_xkbflag, inst->layout->name);
/* The icon is part of the gadget. */
edje_object_part_swallow(inst->o_xkbswitch, "e.swallow.flag",
inst->o_xkbflag);
@ -255,7 +250,6 @@ _gc_shutdown(E_Gadcon_Client *gcc)
evas_object_del(inst->o_xkbswitch);
evas_object_del(inst->o_xkbflag);
}
eina_stringshare_del(inst->cur_layout);
E_FREE(inst);
}
@ -371,8 +365,7 @@ _e_xkb_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSE
if (inst->lmenu)
{
E_Config_XKB_Layout *cl;
const char *cur;
E_Config_XKB_Layout *cl, *cur;
E_Menu_Item *mi;
Eina_List *l;
int dir;
@ -397,7 +390,7 @@ _e_xkb_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSE
e_menu_item_radio_set(mi, 1);
e_menu_item_radio_group_set(mi, 1);
if (cur == name)
if (e_config_xkb_layout_eq(cur, cl))
e_menu_item_toggle_set(mi, 1);
e_xkb_flag_file_get(buf, sizeof(buf), name);
e_menu_item_icon_file_set(mi, buf);
@ -507,19 +500,19 @@ static void
_e_xkb_cb_lmenu_set(void *data, E_Menu *mn __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
Eina_List *l;
void *ndata;
int cur_group = -1, grp = -1;
E_Config_XKB_Layout *cl = data;
E_Config_XKB_Layout *cl2, *cl = data;
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, ndata)
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl2)
{
grp++;
if (ndata == data) cur_group = grp;
if (cl2 == cl) cur_group = grp;
}
if (cur_group == -1) return;
if (cl->name == e_xkb_layout_get()) return;
e_xkb_layout_set(cl->name);
eina_stringshare_replace(&e_config->xkb.selected_layout, cl->name);
if (e_config_xkb_layout_eq(cl, e_xkb_layout_get())) return;
e_xkb_layout_set(cl);
e_config_xkb_layout_free(e_config->xkb.sel_layout);
e_config->xkb.sel_layout = e_config_xkb_layout_dup(cl);
_xkb_update_icon(cur_group);
}

Loading…
Cancel
Save