add option for disabling all keyboard layout changes

SVN revision: 83674
This commit is contained in:
Mike Blumenkrantz 2013-02-06 10:51:54 +00:00
parent 7846f013c9
commit 893b867070
7 changed files with 23 additions and 7 deletions

View File

@ -2,6 +2,7 @@
* added api to automatically disable widgets when checkboxes are checked or unchecked
* added e_widget_on_disable_hook_set
* added option for preventing all keyboard layout changes
2013-02-05 Mike Blumenkrantz

1
NEWS
View File

@ -35,6 +35,7 @@ Additions:
* split comp window match settings into separate dialog
* edge bindings can now be set to "drag only"
* new option for disabling all pointer warps
* added option for preventing all keyboard layout changes
Changes:
Modules:

View File

@ -833,6 +833,7 @@ _e_config_edd_init(Eina_Bool old)
E_CONFIG_LIST(D, T, xkb.used_layouts, _e_config_xkb_layout_edd);
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.dont_touch_my_damn_keyboard, UCHAR);
E_CONFIG_VAL(D, T, xkb.default_model, STR);
if (old)

View File

@ -419,6 +419,7 @@ struct _E_Config
E_Config_XKB_Layout *current_layout;
E_Config_XKB_Layout *sel_layout;
E_Config_XKB_Layout *lock_layout;
Eina_Bool dont_touch_my_damn_keyboard;
/* NO LONGER USED BECAUSE I SUCK
* -zmike, 31 January 2013

View File

@ -32,6 +32,7 @@ EAPI int
e_xkb_init(void)
{
E_EVENT_XKB_CHANGED = ecore_event_type_new();
if (e_config->xkb.dont_touch_my_damn_keyboard) return 1;
e_xkb_update(-1);
if (e_config->xkb.cur_layout)
ecore_timer_add(1.5, _e_xkb_init_timer, e_config->xkb.current_layout);
@ -56,6 +57,7 @@ e_xkb_update(int cur_group)
Eina_List *l;
Eina_Strbuf *buf;
if (e_config->xkb.dont_touch_my_damn_keyboard) return;
if ((!e_config->xkb.used_layouts) && (!e_config->xkb.used_options) && (!e_config->xkb.default_model)) return;
if (cur_group != -1)
{
@ -153,6 +155,7 @@ e_xkb_layout_next(void)
Eina_List *l;
E_Config_XKB_Layout *cl;
if (e_config->xkb.dont_touch_my_damn_keyboard) return;
l = eina_list_nth_list(e_config->xkb.used_layouts, e_config->xkb.cur_group);
l = eina_list_next(l);
if (!l) l = e_config->xkb.used_layouts;
@ -173,6 +176,7 @@ e_xkb_layout_prev(void)
Eina_List *l;
E_Config_XKB_Layout *cl;
if (e_config->xkb.dont_touch_my_damn_keyboard) return;
l = eina_list_nth_list(e_config->xkb.used_layouts, e_config->xkb.cur_group);
l = eina_list_prev(l);
if (!l) l = eina_list_last(e_config->xkb.used_layouts);
@ -196,6 +200,7 @@ e_xkb_layout_get(void)
{
unsigned int n = 0;
if (e_config->xkb.dont_touch_my_damn_keyboard) return NULL;
if (e_config->xkb.current_layout) return e_config->xkb.current_layout;
if (_e_xkb_cur_group >= 0)
n = _e_xkb_cur_group;
@ -210,6 +215,7 @@ e_xkb_layout_set(const E_Config_XKB_Layout *cl)
int cur_group = -1;
EINA_SAFETY_ON_NULL_RETURN(cl);
if (e_config->xkb.dont_touch_my_damn_keyboard) return;
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);

View File

@ -16,6 +16,7 @@ struct _E_Config_Dialog_Data
const char *default_model;
int only_label;
int dont_touch_my_damn_keyboard;
E_Dialog *dlg_add_new;
};
@ -109,6 +110,7 @@ _create_data(E_Config_Dialog *cfd __UNUSED__)
/* Initialize options */
cfdata->only_label = e_config->xkb.only_label;
cfdata->dont_touch_my_damn_keyboard = e_config->xkb.dont_touch_my_damn_keyboard;
cfdata->cfg_options = NULL;
lll = e_config->xkb.used_options;
@ -191,6 +193,7 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
/* Save options */
e_config->xkb.only_label = cfdata->only_label;
e_config->xkb.dont_touch_my_damn_keyboard = cfdata->dont_touch_my_damn_keyboard;
EINA_LIST_FREE(e_config->xkb.used_options, oc)
{
@ -218,7 +221,7 @@ static Evas_Object *
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *mainn, *layoutss, *modelss, *options, *configs, *buttons,
*general, *scroller, *only_label;
*general, *scroller, *only_label, *dont_touch_my_damn_keyboard;
E_XKB_Option *option;
E_XKB_Option_Group *group;
Eina_List *l, *ll, *lll;
@ -270,8 +273,11 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
/* Holds the options */
options = e_widget_list_add(evas, 0, 0);
general = e_widget_framelist_add(evas, _("Gadgets"), 0);
only_label = e_widget_check_add(evas, _("Label only"), &(cfdata->only_label));
general = e_widget_framelist_add(evas, _("General"), 0);
dont_touch_my_damn_keyboard = e_widget_check_add(evas, _("Do not apply any keyboard settings ever"), &(cfdata->dont_touch_my_damn_keyboard));
e_widget_framelist_object_append(general, dont_touch_my_damn_keyboard);
only_label = e_widget_check_add(evas, _("Label only in gadgets"), &(cfdata->only_label));
e_widget_check_widget_disable_on_checked_add(dont_touch_my_damn_keyboard, only_label);
e_widget_framelist_object_append(general, only_label);
e_widget_list_object_append(options, general, 1, 1, 0.0);
@ -290,6 +296,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
chk = e_widget_check_add(evas, option->description,
&(((E_XKB_Dialog_Option *)
eina_list_data_get(lll))->enabled));
e_widget_check_widget_disable_on_checked_add(dont_touch_my_damn_keyboard, chk);
e_widget_framelist_object_append(grp, chk);
lll = eina_list_next(lll);
}

View File

@ -195,7 +195,7 @@ _gc_init(E_Gadcon *gc, const char *gcname, const char *id, const char *style)
/* The gadget */
inst->o_xkbswitch = edje_object_add(gc->evas);
inst->layout = e_xkb_layout_get();
if (e_config->xkb.only_label)
if (e_config->xkb.only_label || (!inst->layout))
e_theme_edje_object_set(inst->o_xkbswitch,
"base/theme/modules/xkbswitch",
"e/modules/xkbswitch/noflag");
@ -204,12 +204,12 @@ _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(inst->layout->name));
inst->layout ? 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;
/* The flag icon */
if (!e_config->xkb.only_label)
if (inst->layout && (!e_config->xkb.only_label))
{
inst->o_xkbflag = e_icon_add(gc->evas);
e_xkb_e_icon_flag_setup(inst->o_xkbflag, inst->layout->name);
@ -513,6 +513,5 @@ _e_xkb_cb_lmenu_set(void *data, E_Menu *mn __UNUSED__, E_Menu_Item *mi __UNUSED_
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);
}