forked from enlightenment/enlightenment
parent
b4e713d4b7
commit
27e182fb59
|
@ -4,54 +4,54 @@
|
|||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
Evas *evas, *dlg_evas;
|
||||
Evas *evas, *dlg_evas;
|
||||
Evas_Object *layout_list, *used_list;
|
||||
Evas_Object *dmodel_list, *model_list, *variant_list;
|
||||
Evas_Object *btn_add, *btn_del, *btn_up, *btn_down;
|
||||
Ecore_Timer *fill_delay;
|
||||
Ecore_Timer *dlg_fill_delay;
|
||||
|
||||
Eina_List *cfg_layouts;
|
||||
Eina_List *cfg_options;
|
||||
const char *default_model;
|
||||
Eina_List *cfg_layouts;
|
||||
Eina_List *cfg_options;
|
||||
const char *default_model;
|
||||
|
||||
int only_label;
|
||||
int only_label;
|
||||
|
||||
E_Dialog *dlg_add_new;
|
||||
E_Dialog *dlg_add_new;
|
||||
};
|
||||
|
||||
typedef struct _E_XKB_Dialog_Option
|
||||
{
|
||||
int enabled;
|
||||
int enabled;
|
||||
const char *name;
|
||||
} E_XKB_Dialog_Option;
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
|
||||
static void _cb_add(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_del(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_add(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_del(void *data, void *data2 __UNUSED__);
|
||||
|
||||
static void _cb_up(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_dn(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_up(void *data, void *data2 __UNUSED__);
|
||||
static void _cb_dn(void *data, void *data2 __UNUSED__);
|
||||
|
||||
static void _dlg_add_cb_ok(void *data, E_Dialog *dlg);
|
||||
static void _dlg_add_cb_cancel(void *data, E_Dialog *dlg);
|
||||
static void _dlg_add_cb_ok(void *data, E_Dialog *dlg);
|
||||
static void _dlg_add_cb_cancel(void *data, E_Dialog *dlg);
|
||||
|
||||
static E_Dialog *_dlg_add_new(E_Config_Dialog_Data *cfdata);
|
||||
static E_Dialog *_dlg_add_new(E_Config_Dialog_Data *cfdata);
|
||||
|
||||
static void _dlg_add_cb_del(void *obj);
|
||||
static void _dlg_add_cb_del(void *obj);
|
||||
|
||||
static Eina_Bool _cb_dlg_fill_delay(void *data);
|
||||
static Eina_Bool _cb_dlg_fill_delay(void *data);
|
||||
|
||||
static void _cb_layout_select(void *data);
|
||||
static void _cb_used_select (void *data);
|
||||
static void _cb_layout_select(void *data);
|
||||
static void _cb_used_select(void *data);
|
||||
|
||||
static Eina_Bool _cb_fill_delay(void *data);
|
||||
static Eina_Bool _cb_fill_delay(void *data);
|
||||
|
||||
/* Externals */
|
||||
|
||||
|
@ -65,10 +65,10 @@ _xkb_cfg_dialog(E_Container *con, const char *params __UNUSED__)
|
|||
return NULL;
|
||||
if (!(v = E_NEW(E_Config_Dialog_View, 1))) return NULL;
|
||||
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.create_widgets = _basic_create;
|
||||
v->basic.apply_cfdata = _basic_apply;
|
||||
v->basic.apply_cfdata = _basic_apply;
|
||||
|
||||
cfd = e_config_dialog_new(con, _("Keyboard Settings"), "E",
|
||||
"keyboard_and_mouse/xkbswitch",
|
||||
|
@ -99,9 +99,9 @@ _create_data(E_Config_Dialog *cfd __UNUSED__)
|
|||
cfdata->cfg_layouts = NULL;
|
||||
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl)
|
||||
{
|
||||
nl = E_NEW(E_Config_XKB_Layout, 1);
|
||||
nl->name = eina_stringshare_add(cl->name);
|
||||
nl->model = eina_stringshare_add(cl->model);
|
||||
nl = E_NEW(E_Config_XKB_Layout, 1);
|
||||
nl->name = eina_stringshare_add(cl->name);
|
||||
nl->model = eina_stringshare_add(cl->model);
|
||||
nl->variant = eina_stringshare_add(cl->variant);
|
||||
|
||||
cfdata->cfg_layouts = eina_list_append(cfdata->cfg_layouts, nl);
|
||||
|
@ -109,7 +109,7 @@ _create_data(E_Config_Dialog *cfd __UNUSED__)
|
|||
|
||||
/* Initialize options */
|
||||
|
||||
cfdata->only_label = e_config->xkb.only_label;
|
||||
cfdata->only_label = e_config->xkb.only_label;
|
||||
cfdata->cfg_options = NULL;
|
||||
|
||||
lll = e_config->xkb.used_options;
|
||||
|
@ -179,9 +179,9 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
|
||||
EINA_LIST_FOREACH(cfdata->cfg_layouts, l, cl)
|
||||
{
|
||||
nl = E_NEW(E_Config_XKB_Layout, 1);
|
||||
nl->name = eina_stringshare_add(cl->name);
|
||||
nl->model = eina_stringshare_add(cl->model);
|
||||
nl = E_NEW(E_Config_XKB_Layout, 1);
|
||||
nl->name = eina_stringshare_add(cl->name);
|
||||
nl->model = eina_stringshare_add(cl->model);
|
||||
nl->variant = eina_stringshare_add(cl->variant);
|
||||
|
||||
e_config->xkb.used_layouts =
|
||||
|
@ -209,7 +209,7 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
oc = E_NEW(E_Config_XKB_Option, 1);
|
||||
oc->name = eina_stringshare_add(od->name);
|
||||
e_config->xkb.used_options = eina_list_append(e_config->xkb.used_options, oc);
|
||||
}
|
||||
}
|
||||
|
||||
e_xkb_update(-1);
|
||||
_xkb_update_icon(0);
|
||||
|
@ -223,121 +223,121 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
{
|
||||
/* Holds the dialog contents, displays a toolbar on the top */
|
||||
Evas_Object *mainn = e_widget_toolbook_add(evas, 24, 24);
|
||||
{
|
||||
/* Holds the used layouts ilist and the button table */
|
||||
Evas_Object *layoutss;
|
||||
Evas_Object *modelss;
|
||||
Evas_Object *options;
|
||||
{
|
||||
/* Holds the used layouts ilist and the button table */
|
||||
Evas_Object *layoutss;
|
||||
Evas_Object *modelss;
|
||||
Evas_Object *options;
|
||||
|
||||
layoutss = e_widget_list_add(evas, 0, 0);
|
||||
{
|
||||
/* Holds the used layouts */
|
||||
Evas_Object *configs;
|
||||
Evas_Object *buttons;
|
||||
layoutss = e_widget_list_add(evas, 0, 0);
|
||||
{
|
||||
/* Holds the used layouts */
|
||||
Evas_Object *configs;
|
||||
Evas_Object *buttons;
|
||||
|
||||
configs = e_widget_ilist_add(evas, 32, 32, NULL);
|
||||
configs = e_widget_ilist_add(evas, 32, 32, NULL);
|
||||
|
||||
{
|
||||
e_widget_size_min_set(configs, 220, 160);
|
||||
e_widget_ilist_go(configs);
|
||||
{
|
||||
e_widget_size_min_set(configs, 220, 160);
|
||||
e_widget_ilist_go(configs);
|
||||
|
||||
e_widget_list_object_append(layoutss, configs, 1, 1, 0.5);
|
||||
cfdata->used_list = configs;
|
||||
}
|
||||
e_widget_list_object_append(layoutss, configs, 1, 1, 0.5);
|
||||
cfdata->used_list = configs;
|
||||
}
|
||||
|
||||
/* Holds the buttons */
|
||||
buttons = e_widget_table_add(evas, 1);
|
||||
{
|
||||
cfdata->btn_up = e_widget_button_add(evas, _("Up"), "go-up", _cb_up, cfdata, NULL);
|
||||
{
|
||||
e_widget_disabled_set(cfdata->btn_up, EINA_TRUE);
|
||||
e_widget_table_object_append(buttons, cfdata->btn_up, 0, 0, 1, 1, 1, 1, 1, 0);
|
||||
}
|
||||
/* Holds the buttons */
|
||||
buttons = e_widget_table_add(evas, 1);
|
||||
{
|
||||
cfdata->btn_up = e_widget_button_add(evas, _("Up"), "go-up", _cb_up, cfdata, NULL);
|
||||
{
|
||||
e_widget_disabled_set(cfdata->btn_up, EINA_TRUE);
|
||||
e_widget_table_object_append(buttons, cfdata->btn_up, 0, 0, 1, 1, 1, 1, 1, 0);
|
||||
}
|
||||
|
||||
cfdata->btn_down = e_widget_button_add(evas, _("Down"), "go-down", _cb_dn, cfdata, NULL);
|
||||
{
|
||||
e_widget_disabled_set(cfdata->btn_down, EINA_TRUE);
|
||||
e_widget_table_object_append(buttons, cfdata->btn_down, 1, 0, 1, 1, 1, 1, 1, 0);
|
||||
}
|
||||
cfdata->btn_down = e_widget_button_add(evas, _("Down"), "go-down", _cb_dn, cfdata, NULL);
|
||||
{
|
||||
e_widget_disabled_set(cfdata->btn_down, EINA_TRUE);
|
||||
e_widget_table_object_append(buttons, cfdata->btn_down, 1, 0, 1, 1, 1, 1, 1, 0);
|
||||
}
|
||||
|
||||
cfdata->btn_add = e_widget_button_add(evas, _("Add"), "list-add", _cb_add, cfdata, NULL);
|
||||
{
|
||||
e_widget_table_object_append(buttons, cfdata->btn_add, 0, 1, 1, 1, 1, 1, 1, 0);
|
||||
}
|
||||
cfdata->btn_add = e_widget_button_add(evas, _("Add"), "list-add", _cb_add, cfdata, NULL);
|
||||
{
|
||||
e_widget_table_object_append(buttons, cfdata->btn_add, 0, 1, 1, 1, 1, 1, 1, 0);
|
||||
}
|
||||
|
||||
cfdata->btn_del = e_widget_button_add(evas, _("Remove"), "list-remove", _cb_del, cfdata, NULL);
|
||||
{
|
||||
e_widget_disabled_set(cfdata->btn_del, EINA_TRUE);
|
||||
e_widget_table_object_append(buttons, cfdata->btn_del, 1, 1, 1, 1, 1, 1, 1, 0);
|
||||
}
|
||||
cfdata->btn_del = e_widget_button_add(evas, _("Remove"), "list-remove", _cb_del, cfdata, NULL);
|
||||
{
|
||||
e_widget_disabled_set(cfdata->btn_del, EINA_TRUE);
|
||||
e_widget_table_object_append(buttons, cfdata->btn_del, 1, 1, 1, 1, 1, 1, 1, 0);
|
||||
}
|
||||
|
||||
e_widget_list_object_append(layoutss, buttons, 1, 0, 1);
|
||||
}
|
||||
e_widget_list_object_append(layoutss, buttons, 1, 0, 1);
|
||||
}
|
||||
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Configurations"), layoutss, 1, 1, 1, 1, 0.5, 0.0);
|
||||
}
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Configurations"), layoutss, 1, 1, 1, 1, 0.5, 0.0);
|
||||
}
|
||||
|
||||
/* Holds the default models */
|
||||
modelss = e_widget_ilist_add(evas, 32, 32, &cfdata->default_model);
|
||||
{
|
||||
e_widget_size_min_set(modelss, 220, 160);
|
||||
cfdata->dmodel_list = modelss;
|
||||
/* Holds the default models */
|
||||
modelss = e_widget_ilist_add(evas, 32, 32, &cfdata->default_model);
|
||||
{
|
||||
e_widget_size_min_set(modelss, 220, 160);
|
||||
cfdata->dmodel_list = modelss;
|
||||
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Models"), modelss, 1, 1, 1, 1, 0.5, 0.0);
|
||||
}
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Models"), modelss, 1, 1, 1, 1, 0.5, 0.0);
|
||||
}
|
||||
|
||||
/* Holds the options */
|
||||
options = e_widget_list_add(evas, 0, 0);
|
||||
{
|
||||
E_XKB_Option *option;
|
||||
E_XKB_Option_Group *group;
|
||||
Eina_List *l, *ll, *lll;
|
||||
Evas_Coord mw, mh;
|
||||
Evas_Object *general;
|
||||
Evas_Object *scroller;
|
||||
/* Holds the options */
|
||||
options = e_widget_list_add(evas, 0, 0);
|
||||
{
|
||||
E_XKB_Option *option;
|
||||
E_XKB_Option_Group *group;
|
||||
Eina_List *l, *ll, *lll;
|
||||
Evas_Coord mw, mh;
|
||||
Evas_Object *general;
|
||||
Evas_Object *scroller;
|
||||
|
||||
general = e_widget_framelist_add(evas, _("Gadgets"), 0);
|
||||
{
|
||||
Evas_Object *only_label = e_widget_check_add(evas, _("Label only"), &(cfdata->only_label));
|
||||
{
|
||||
e_widget_framelist_object_append(general, only_label);
|
||||
}
|
||||
e_widget_list_object_append(options, general, 1, 1, 0.0);
|
||||
}
|
||||
general = e_widget_framelist_add(evas, _("Gadgets"), 0);
|
||||
{
|
||||
Evas_Object *only_label = e_widget_check_add(evas, _("Label only"), &(cfdata->only_label));
|
||||
{
|
||||
e_widget_framelist_object_append(general, only_label);
|
||||
}
|
||||
e_widget_list_object_append(options, general, 1, 1, 0.0);
|
||||
}
|
||||
|
||||
lll = cfdata->cfg_options;
|
||||
lll = cfdata->cfg_options;
|
||||
|
||||
EINA_LIST_FOREACH(optgroups, l, group)
|
||||
{
|
||||
Evas_Object *grp = e_widget_framelist_add(evas, group->description, 0);
|
||||
EINA_LIST_FOREACH(optgroups, l, group)
|
||||
{
|
||||
Evas_Object *grp = e_widget_framelist_add(evas, group->description, 0);
|
||||
|
||||
EINA_LIST_FOREACH(group->options, ll, option)
|
||||
{
|
||||
Evas_Object *chk = e_widget_check_add(evas, option->description,
|
||||
&(((E_XKB_Dialog_Option *)
|
||||
eina_list_data_get(lll))->enabled));
|
||||
e_widget_framelist_object_append(grp, chk);
|
||||
lll = eina_list_next(lll);
|
||||
}
|
||||
e_widget_list_object_append(options, grp, 1, 1, 0.0);
|
||||
}
|
||||
EINA_LIST_FOREACH(group->options, ll, option)
|
||||
{
|
||||
Evas_Object *chk = e_widget_check_add(evas, option->description,
|
||||
&(((E_XKB_Dialog_Option *)
|
||||
eina_list_data_get(lll))->enabled));
|
||||
e_widget_framelist_object_append(grp, chk);
|
||||
lll = eina_list_next(lll);
|
||||
}
|
||||
e_widget_list_object_append(options, grp, 1, 1, 0.0);
|
||||
}
|
||||
|
||||
e_widget_size_min_get(options, &mw, &mh);
|
||||
e_widget_size_min_get(options, &mw, &mh);
|
||||
|
||||
if (mw < 220) mw = 220;
|
||||
if (mh < 160) mh = 160;
|
||||
if (mw < 220) mw = 220;
|
||||
if (mh < 160) mh = 160;
|
||||
|
||||
evas_object_resize(options, mw, mh);
|
||||
evas_object_resize(options, mw, mh);
|
||||
|
||||
scroller = e_widget_scrollframe_simple_add(evas, options);
|
||||
e_widget_size_min_set(scroller, 220, 160);
|
||||
scroller = e_widget_scrollframe_simple_add(evas, options);
|
||||
e_widget_size_min_set(scroller, 220, 160);
|
||||
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Options"), scroller, 1, 1, 1, 1, 0.5, 0.0);
|
||||
}
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Options"), scroller, 1, 1, 1, 1, 0.5, 0.0);
|
||||
}
|
||||
|
||||
/* Display the first page by default */
|
||||
e_widget_toolbook_page_show(mainn, 0);
|
||||
}
|
||||
/* Display the first page by default */
|
||||
e_widget_toolbook_page_show(mainn, 0);
|
||||
}
|
||||
|
||||
/* The main evas */
|
||||
cfdata->evas = evas;
|
||||
|
@ -482,37 +482,37 @@ _dlg_add_new(E_Config_Dialog_Data *cfdata)
|
|||
|
||||
/* The main toolbook, holds the lists and tabs */
|
||||
mainn = e_widget_toolbook_add(evas, 24, 24);
|
||||
{
|
||||
/* Holds the available layouts */
|
||||
Evas_Object *available = e_widget_ilist_add(evas, 32, 32, NULL);
|
||||
Evas_Object *modelss;
|
||||
Evas_Object *variants;
|
||||
{
|
||||
/* Holds the available layouts */
|
||||
Evas_Object *available = e_widget_ilist_add(evas, 32, 32, NULL);
|
||||
Evas_Object *modelss;
|
||||
Evas_Object *variants;
|
||||
|
||||
{
|
||||
e_widget_size_min_set(available, 220, 160);
|
||||
e_widget_ilist_go(available);
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Available"), available, 1, 1, 1, 1, 0.5, 0.0);
|
||||
cfdata->layout_list = available;
|
||||
}
|
||||
{
|
||||
e_widget_size_min_set(available, 220, 160);
|
||||
e_widget_ilist_go(available);
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Available"), available, 1, 1, 1, 1, 0.5, 0.0);
|
||||
cfdata->layout_list = available;
|
||||
}
|
||||
|
||||
/* Holds the available models */
|
||||
modelss = e_widget_ilist_add(evas, 32, 32, NULL);
|
||||
{
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Model"), modelss, 1, 1, 1, 1, 0.5, 0.0);
|
||||
cfdata->model_list = modelss;
|
||||
}
|
||||
/* Holds the available models */
|
||||
modelss = e_widget_ilist_add(evas, 32, 32, NULL);
|
||||
{
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Model"), modelss, 1, 1, 1, 1, 0.5, 0.0);
|
||||
cfdata->model_list = modelss;
|
||||
}
|
||||
|
||||
/* Holds the available variants */
|
||||
variants = e_widget_ilist_add(evas, 32, 32, NULL);
|
||||
{
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Variant"), variants, 1, 1, 1, 1, 0.5, 0.0);
|
||||
cfdata->variant_list = variants;
|
||||
}
|
||||
e_widget_toolbook_page_show(mainn, 0);
|
||||
}
|
||||
/* Holds the available variants */
|
||||
variants = e_widget_ilist_add(evas, 32, 32, NULL);
|
||||
{
|
||||
e_widget_toolbook_page_append(mainn, NULL, _("Variant"), variants, 1, 1, 1, 1, 0.5, 0.0);
|
||||
cfdata->variant_list = variants;
|
||||
}
|
||||
e_widget_toolbook_page_show(mainn, 0);
|
||||
}
|
||||
|
||||
e_widget_size_min_get(mainn, &mw, &mh);
|
||||
e_dialog_content_set(dlg, mainn, mw, mh);
|
||||
e_dialog_content_set(dlg, mainn, mw, mh);
|
||||
|
||||
cfdata->dlg_evas = evas;
|
||||
|
||||
|
@ -539,7 +539,7 @@ static void
|
|||
_dlg_add_cb_ok(void *data __UNUSED__, E_Dialog *dlg)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata = dlg->data;
|
||||
E_Config_XKB_Layout *cl;
|
||||
E_Config_XKB_Layout *cl;
|
||||
char buf[4096];
|
||||
/* Configuration information */
|
||||
const char *layout = e_widget_ilist_selected_value_get(cfdata->layout_list);
|
||||
|
@ -547,9 +547,9 @@ _dlg_add_cb_ok(void *data __UNUSED__, E_Dialog *dlg)
|
|||
const char *variant = e_widget_ilist_selected_value_get(cfdata->variant_list);
|
||||
|
||||
/* The new configuration */
|
||||
cl = E_NEW(E_Config_XKB_Layout, 1);
|
||||
cl->name = eina_stringshare_add(layout);
|
||||
cl->model = eina_stringshare_add(model);
|
||||
cl = E_NEW(E_Config_XKB_Layout, 1);
|
||||
cl->name = eina_stringshare_add(layout);
|
||||
cl->model = eina_stringshare_add(model);
|
||||
cl->variant = eina_stringshare_add(variant);
|
||||
|
||||
cfdata->cfg_layouts = eina_list_append(cfdata->cfg_layouts, cl);
|
||||
|
@ -559,18 +559,18 @@ _dlg_add_cb_ok(void *data __UNUSED__, E_Dialog *dlg)
|
|||
edje_freeze();
|
||||
e_widget_ilist_freeze(cfdata->used_list);
|
||||
|
||||
{
|
||||
Evas_Object *ic = e_icon_add(cfdata->evas);
|
||||
const char *name = cl->name;
|
||||
{
|
||||
Evas_Object *ic = e_icon_add(cfdata->evas);
|
||||
const char *name = cl->name;
|
||||
|
||||
e_xkb_e_icon_flag_setup(ic, name);
|
||||
snprintf(buf, sizeof(buf), "%s (%s, %s)",
|
||||
cl->name, cl->model, cl->variant);
|
||||
e_widget_ilist_append_full(cfdata->used_list, ic, NULL, buf,
|
||||
_cb_used_select, cfdata, NULL);
|
||||
}
|
||||
e_xkb_e_icon_flag_setup(ic, name);
|
||||
snprintf(buf, sizeof(buf), "%s (%s, %s)",
|
||||
cl->name, cl->model, cl->variant);
|
||||
e_widget_ilist_append_full(cfdata->used_list, ic, NULL, buf,
|
||||
_cb_used_select, cfdata, NULL);
|
||||
}
|
||||
|
||||
e_widget_ilist_go (cfdata->used_list);
|
||||
e_widget_ilist_go(cfdata->used_list);
|
||||
e_widget_ilist_thaw(cfdata->used_list);
|
||||
edje_thaw();
|
||||
evas_event_thaw(cfdata->evas);
|
||||
|
@ -611,7 +611,7 @@ _cb_dlg_fill_delay(void *data)
|
|||
edje_freeze();
|
||||
|
||||
e_widget_ilist_freeze(cfdata->layout_list);
|
||||
e_widget_ilist_clear (cfdata->layout_list);
|
||||
e_widget_ilist_clear(cfdata->layout_list);
|
||||
|
||||
EINA_LIST_FOREACH(layouts, l, layout)
|
||||
{
|
||||
|
@ -625,7 +625,7 @@ _cb_dlg_fill_delay(void *data)
|
|||
_cb_layout_select, cfdata, layout->name);
|
||||
}
|
||||
|
||||
e_widget_ilist_go (cfdata->layout_list);
|
||||
e_widget_ilist_go(cfdata->layout_list);
|
||||
e_widget_ilist_thaw(cfdata->layout_list);
|
||||
|
||||
edje_thaw();
|
||||
|
@ -657,9 +657,9 @@ _cb_layout_select(void *data)
|
|||
return;
|
||||
|
||||
if (!(layout = eina_list_search_unsorted
|
||||
(layouts, layout_sort_by_name_cb,
|
||||
(layouts, layout_sort_by_name_cb,
|
||||
e_widget_ilist_nth_value_get(cfdata->layout_list, n)
|
||||
))) return;
|
||||
))) return;
|
||||
|
||||
/* Update the lists */
|
||||
evas_event_freeze(cfdata->dlg_evas);
|
||||
|
@ -684,7 +684,7 @@ _cb_layout_select(void *data)
|
|||
|
||||
EINA_LIST_FOREACH(layout->variants, l, variant)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s (%s)", variant->name, variant->description);
|
||||
snprintf(buf, sizeof(buf), "%s (%s)", variant->name, variant->description);
|
||||
e_widget_ilist_append(cfdata->variant_list, NULL, buf, NULL, cfdata, variant->name);
|
||||
}
|
||||
|
||||
|
@ -694,7 +694,7 @@ _cb_layout_select(void *data)
|
|||
edje_thaw();
|
||||
evas_event_thaw(cfdata->dlg_evas);
|
||||
|
||||
e_widget_ilist_selected_set(cfdata->model_list, 0);
|
||||
e_widget_ilist_selected_set(cfdata->model_list, 0);
|
||||
e_widget_ilist_selected_set(cfdata->variant_list, 0);
|
||||
|
||||
e_dialog_button_disable_num_set(cfdata->dlg_add_new, 0, 0);
|
||||
|
@ -729,7 +729,7 @@ _cb_fill_delay(void *data)
|
|||
cl->name, cl->model, cl->variant);
|
||||
e_widget_ilist_append_full(cfdata->used_list, ic, NULL, buf,
|
||||
_cb_used_select, cfdata, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
e_widget_ilist_go(cfdata->used_list);
|
||||
e_widget_ilist_thaw(cfdata->used_list);
|
||||
|
@ -771,17 +771,18 @@ _cb_used_select(void *data)
|
|||
|
||||
if (n == (c - 1))
|
||||
{
|
||||
e_widget_disabled_set(cfdata->btn_up, EINA_FALSE);
|
||||
e_widget_disabled_set(cfdata->btn_down, EINA_TRUE );
|
||||
e_widget_disabled_set(cfdata->btn_up, EINA_FALSE);
|
||||
e_widget_disabled_set(cfdata->btn_down, EINA_TRUE);
|
||||
}
|
||||
else if (n == 0)
|
||||
{
|
||||
e_widget_disabled_set(cfdata->btn_up, EINA_TRUE );
|
||||
e_widget_disabled_set(cfdata->btn_up, EINA_TRUE);
|
||||
e_widget_disabled_set(cfdata->btn_down, EINA_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
e_widget_disabled_set(cfdata->btn_up, EINA_FALSE);
|
||||
e_widget_disabled_set(cfdata->btn_up, EINA_FALSE);
|
||||
e_widget_disabled_set(cfdata->btn_down, EINA_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,22 +2,21 @@
|
|||
#include "e_mod_main.h"
|
||||
#include "e_mod_parse.h"
|
||||
|
||||
|
||||
/* GADCON */
|
||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
||||
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
||||
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
||||
static const char *_gc_label(const E_Gadcon_Client_Class *client_class);
|
||||
static const char *_gc_id_new(const E_Gadcon_Client_Class *client_class __UNUSED__);
|
||||
static Evas_Object *_gc_icon(const E_Gadcon_Client_Class *client_class, Evas *evas);
|
||||
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
||||
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
||||
static const char *_gc_label(const E_Gadcon_Client_Class *client_class);
|
||||
static const char *_gc_id_new(const E_Gadcon_Client_Class *client_class __UNUSED__);
|
||||
static Evas_Object *_gc_icon(const E_Gadcon_Client_Class *client_class, Evas *evas);
|
||||
|
||||
/* EVENTS */
|
||||
static Eina_Bool _xkb_changed(void *data, int type, void *event_info);
|
||||
static Eina_Bool _xkb_changed_state(void *data __UNUSED__,int type __UNUSED__, void *event);
|
||||
static void _e_xkb_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event);
|
||||
static void _e_xkb_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi __UNUSED__);
|
||||
static void _e_xkb_cb_lmenu_post(void *data, E_Menu *menu __UNUSED__);
|
||||
static void _e_xkb_cb_lmenu_set(void *data, E_Menu *mn __UNUSED__, E_Menu_Item *mi __UNUSED__);
|
||||
static Eina_Bool _xkb_changed(void *data, int type, void *event_info);
|
||||
static Eina_Bool _xkb_changed_state(void *data __UNUSED__, int type __UNUSED__, void *event);
|
||||
static void _e_xkb_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event);
|
||||
static void _e_xkb_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi __UNUSED__);
|
||||
static void _e_xkb_cb_lmenu_post(void *data, E_Menu *menu __UNUSED__);
|
||||
static void _e_xkb_cb_lmenu_set(void *data, E_Menu *mn __UNUSED__, E_Menu_Item *mi __UNUSED__);
|
||||
|
||||
/* Static variables
|
||||
* The static variables specific to the current code unit.
|
||||
|
@ -29,10 +28,10 @@ typedef struct _Instance
|
|||
{
|
||||
E_Gadcon_Client *gcc;
|
||||
|
||||
Evas_Object *o_xkbswitch;
|
||||
Evas_Object *o_xkbflag;
|
||||
Evas_Object *o_xkbswitch;
|
||||
Evas_Object *o_xkbflag;
|
||||
|
||||
E_Menu *lmenu;
|
||||
E_Menu *lmenu;
|
||||
} Instance;
|
||||
|
||||
/* LIST OF INSTANCES */
|
||||
|
@ -48,10 +47,10 @@ Xkb _xkb = { NULL, NULL, NULL };
|
|||
static const E_Gadcon_Client_Class _gc_class =
|
||||
{
|
||||
GADCON_CLIENT_CLASS_VERSION,
|
||||
"xkbswitch",
|
||||
{
|
||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, NULL
|
||||
},
|
||||
"xkbswitch",
|
||||
{
|
||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, NULL
|
||||
},
|
||||
E_GADCON_CLIENT_STYLE_PLAIN
|
||||
};
|
||||
|
||||
|
@ -72,12 +71,12 @@ e_modapi_init(E_Module *m)
|
|||
e_configure_registry_category_add("keyboard_and_mouse", 80, _("Input"),
|
||||
NULL, "preferences-behavior");
|
||||
e_configure_registry_item_add("keyboard_and_mouse/xkbswitch", 110,
|
||||
_("Keyboard"), NULL,
|
||||
_("Keyboard"), NULL,
|
||||
"preferences-desktop-keyboard",
|
||||
_xkb_cfg_dialog);
|
||||
_xkb.module = m;
|
||||
_xkb.evh = ecore_event_handler_add(E_EVENT_XKB_CHANGED, _xkb_changed, NULL);
|
||||
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);
|
||||
/* Gadcon */
|
||||
e_gadcon_provider_register(&_gc_class);
|
||||
return m;
|
||||
|
@ -95,7 +94,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
|||
|
||||
if (_xkb.evh) ecore_event_handler_del(_xkb.evh);
|
||||
if (_xkb.cfd) e_object_del(E_OBJECT(_xkb.cfd));
|
||||
_xkb.cfd = NULL;
|
||||
_xkb.cfd = NULL;
|
||||
_xkb.module = NULL;
|
||||
e_gadcon_provider_unregister(&_gc_class);
|
||||
|
||||
|
@ -120,15 +119,15 @@ _xkb_update_icon(int cur_group)
|
|||
Instance *inst;
|
||||
Eina_List *l;
|
||||
E_Config_XKB_Layout *layout;
|
||||
const char *name=NULL;
|
||||
const char *name = NULL;
|
||||
int grp = -1;
|
||||
|
||||
if (!e_config->xkb.used_layouts) return;
|
||||
INF("ui: %d",cur_group);
|
||||
INF("ui: %d", cur_group);
|
||||
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, layout)
|
||||
{
|
||||
grp++;
|
||||
if (cur_group == grp) name = layout->name;
|
||||
grp++;
|
||||
if (cur_group == grp) name = layout->name;
|
||||
}
|
||||
|
||||
if ((name) && (strchr(name, '/'))) name = strchr(name, '/') + 1;
|
||||
|
@ -172,11 +171,11 @@ _xkb_update_icon(int cur_group)
|
|||
static E_Gadcon_Client *
|
||||
_gc_init(E_Gadcon *gc, const char *gcname, const char *id, const char *style)
|
||||
{
|
||||
Instance *inst;
|
||||
Instance *inst;
|
||||
const char *name;
|
||||
|
||||
if (e_config->xkb.used_layouts)
|
||||
name = ((E_Config_XKB_Layout*)
|
||||
name = ((E_Config_XKB_Layout *)
|
||||
eina_list_data_get(e_config->xkb.used_layouts))->name;
|
||||
else name = NULL;
|
||||
|
||||
|
@ -207,7 +206,7 @@ _gc_init(E_Gadcon *gc, const char *gcname, const char *id, const char *style)
|
|||
inst->o_xkbflag);
|
||||
}
|
||||
else inst->o_xkbflag = NULL;
|
||||
/* e_config->xkb.used_layout */
|
||||
/* e_config->xkb.used_layout */
|
||||
/* Hook some menus */
|
||||
evas_object_event_callback_add(inst->o_xkbswitch, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_e_xkb_cb_mouse_down, inst);
|
||||
|
@ -283,16 +282,18 @@ _xkb_changed(void *data __UNUSED__, int type __UNUSED__, void *event_info __UNUS
|
|||
_xkb_update_icon((int)(intptr_t)data);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
static Eina_Bool
|
||||
_xkb_changed_state(void *data __UNUSED__,int type __UNUSED__,void *event __UNUSED__)
|
||||
{
|
||||
Ecore_X_Event_Xkb *ev=(Ecore_X_Event_Xkb *)event;
|
||||
|
||||
INF("xkb group %d",ev->group);
|
||||
static Eina_Bool
|
||||
_xkb_changed_state(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
|
||||
{
|
||||
Ecore_X_Event_Xkb *ev = (Ecore_X_Event_Xkb *)event;
|
||||
|
||||
INF("xkb group %d", ev->group);
|
||||
e_config->xkb.cur_group = ev->group;
|
||||
_xkb_update_icon(ev->group);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
_xkb_menu_items_sort(const void *data1, const void *data2)
|
||||
|
@ -306,6 +307,7 @@ _xkb_menu_items_sort(const void *data1, const void *data2)
|
|||
if (!v) v = strcmp(cl1->variant, cl2->variant);
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif
|
||||
static void
|
||||
_e_xkb_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event)
|
||||
|
@ -330,7 +332,7 @@ _e_xkb_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSE
|
|||
e_menu_item_callback_set(mi, _e_xkb_cb_menu_configure, NULL);
|
||||
/* Append into the util menu */
|
||||
m = e_gadcon_client_util_menu_items_append(inst->gcc,
|
||||
m, 0);
|
||||
m, 0);
|
||||
/* Coords */
|
||||
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y,
|
||||
NULL, NULL);
|
||||
|
@ -394,54 +396,65 @@ _e_xkb_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSE
|
|||
e_menu_item_callback_set(mi, _e_xkb_cb_lmenu_set, cl);
|
||||
}
|
||||
|
||||
|
||||
/* Deactivate callback */
|
||||
e_menu_post_deactivate_callback_set(inst->lmenu,
|
||||
_e_xkb_cb_lmenu_post, inst);
|
||||
/* Proper menu orientation */
|
||||
switch (inst->gcc->gadcon->orient)
|
||||
/* Proper menu orientation */
|
||||
switch (inst->gcc->gadcon->orient)
|
||||
{
|
||||
case E_GADCON_ORIENT_TOP:
|
||||
dir = E_MENU_POP_DIRECTION_DOWN;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_BOTTOM:
|
||||
dir = E_MENU_POP_DIRECTION_UP;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_LEFT:
|
||||
dir = E_MENU_POP_DIRECTION_RIGHT;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_RIGHT:
|
||||
dir = E_MENU_POP_DIRECTION_LEFT;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_CORNER_TL:
|
||||
dir = E_MENU_POP_DIRECTION_DOWN;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_CORNER_TR:
|
||||
dir = E_MENU_POP_DIRECTION_DOWN;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_CORNER_BL:
|
||||
dir = E_MENU_POP_DIRECTION_UP;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_CORNER_BR:
|
||||
dir = E_MENU_POP_DIRECTION_UP;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_CORNER_LT:
|
||||
dir = E_MENU_POP_DIRECTION_RIGHT;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_CORNER_RT:
|
||||
dir = E_MENU_POP_DIRECTION_LEFT;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_CORNER_LB:
|
||||
dir = E_MENU_POP_DIRECTION_RIGHT;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_CORNER_RB:
|
||||
dir = E_MENU_POP_DIRECTION_LEFT;
|
||||
break;
|
||||
|
||||
case E_GADCON_ORIENT_FLOAT:
|
||||
case E_GADCON_ORIENT_HORIZ:
|
||||
case E_GADCON_ORIENT_VERT:
|
||||
default:
|
||||
dir = E_MENU_POP_DIRECTION_AUTO;
|
||||
dir = E_MENU_POP_DIRECTION_AUTO;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -452,9 +465,9 @@ _e_xkb_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSE
|
|||
*/
|
||||
e_menu_activate_mouse(inst->lmenu,
|
||||
e_util_zone_current_get
|
||||
(e_manager_current_get()),
|
||||
(e_manager_current_get()),
|
||||
x, y, w, h, dir, ev->timestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ev->button == 2) /* Middle click */
|
||||
e_xkb_layout_next();
|
||||
|
@ -494,5 +507,6 @@ _e_xkb_cb_lmenu_set(void *data, E_Menu *mn __UNUSED__, E_Menu_Item *mi __UNUSED_
|
|||
{
|
||||
e_xkb_update(cur_group);
|
||||
_xkb_update_icon(cur_group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
typedef struct _Xkb
|
||||
{
|
||||
E_Module *module;
|
||||
E_Config_Dialog *cfd;
|
||||
E_Module *module;
|
||||
E_Config_Dialog *cfd;
|
||||
Ecore_Event_Handler *evh;
|
||||
} Xkb;
|
||||
|
||||
|
@ -18,13 +18,13 @@ typedef struct _Xkb
|
|||
|
||||
EAPI extern E_Module_Api e_modapi;
|
||||
|
||||
EAPI void *e_modapi_init (E_Module *m);
|
||||
EAPI int e_modapi_shutdown(E_Module *m);
|
||||
EAPI int e_modapi_save (E_Module *m);
|
||||
EAPI void *e_modapi_init(E_Module *m);
|
||||
EAPI int e_modapi_shutdown(E_Module *m);
|
||||
EAPI int e_modapi_save(E_Module *m);
|
||||
|
||||
void _xkb_update_icon(int);
|
||||
E_Config_Dialog *_xkb_cfg_dialog(E_Container *con, const char *params);
|
||||
void _xkb_update_icon(int);
|
||||
E_Config_Dialog *_xkb_cfg_dialog(E_Container *con, const char *params);
|
||||
|
||||
extern Xkb _xkb;
|
||||
extern Xkb _xkb;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,7 +68,7 @@ parse_rules(void)
|
|||
models = eina_list_append(models, model);
|
||||
|
||||
/* read models here */
|
||||
for (;;)
|
||||
for (;; )
|
||||
{
|
||||
if (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ parse_rules(void)
|
|||
/* means end of section */
|
||||
if (!buf[0]) break;
|
||||
/* get rid of initial 2 spaces here */
|
||||
p = buf + 2;
|
||||
p = buf + 2;
|
||||
tmp = strdup(p);
|
||||
|
||||
model = E_NEW(E_XKB_Model, 1);
|
||||
|
@ -91,7 +91,8 @@ parse_rules(void)
|
|||
free(tmp);
|
||||
|
||||
p += strlen(model->name);
|
||||
while (p[0] == ' ') ++p;
|
||||
while (p[0] == ' ')
|
||||
++p;
|
||||
|
||||
model->description = eina_stringshare_add(p);
|
||||
|
||||
|
@ -105,7 +106,7 @@ parse_rules(void)
|
|||
if (!fgets(buf, sizeof(buf), f)) goto err;
|
||||
|
||||
/* read layouts here */
|
||||
for (;;)
|
||||
for (;; )
|
||||
{
|
||||
if (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
|
@ -114,11 +115,11 @@ parse_rules(void)
|
|||
char *tmp;
|
||||
|
||||
n = strchr(buf, '\n');
|
||||
if (n) *n = '\0';
|
||||
if (n) *n = '\0';
|
||||
|
||||
if (!buf[0]) break;
|
||||
|
||||
p = buf + 2;
|
||||
p = buf + 2;
|
||||
tmp = strdup(p);
|
||||
|
||||
layout = E_NEW(E_XKB_Layout, 1);
|
||||
|
@ -127,7 +128,8 @@ parse_rules(void)
|
|||
free(tmp);
|
||||
|
||||
p += strlen(layout->name);
|
||||
while (p[0] == ' ') ++p;
|
||||
while (p[0] == ' ')
|
||||
++p;
|
||||
|
||||
variant = E_NEW(E_XKB_Variant, 1);
|
||||
variant->name = eina_stringshare_add("basic");
|
||||
|
@ -146,21 +148,21 @@ parse_rules(void)
|
|||
if (!fgets(buf, sizeof(buf), f)) goto err;
|
||||
|
||||
/* read variants here */
|
||||
for (;;)
|
||||
for (;; )
|
||||
{
|
||||
if (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
char *n;
|
||||
char *p;
|
||||
char *tmp;
|
||||
char *tok;
|
||||
char *tok;
|
||||
|
||||
n = strchr(buf, '\n');
|
||||
if (n) *n = '\0';
|
||||
if (n) *n = '\0';
|
||||
|
||||
if (!buf[0]) break;
|
||||
|
||||
p = buf + 2;
|
||||
p = buf + 2;
|
||||
tmp = strdup(p);
|
||||
|
||||
variant = E_NEW(E_XKB_Variant, 1);
|
||||
|
@ -173,7 +175,8 @@ parse_rules(void)
|
|||
layout->variants = eina_list_append(layout->variants, variant);
|
||||
|
||||
p += strlen(variant->name);
|
||||
while (p[0] == ' ') ++p;
|
||||
while (p[0] == ' ')
|
||||
++p;
|
||||
p += strlen(tok);
|
||||
p += 2;
|
||||
|
||||
|
@ -189,7 +192,7 @@ parse_rules(void)
|
|||
if (!fgets(buf, sizeof(buf), f)) goto err;
|
||||
|
||||
/* read options here */
|
||||
for (;;)
|
||||
for (;; )
|
||||
{
|
||||
if (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
|
@ -199,46 +202,48 @@ parse_rules(void)
|
|||
char *name;
|
||||
|
||||
n = strchr(buf, '\n');
|
||||
if (n) *n = '\0';
|
||||
if (n) *n = '\0';
|
||||
|
||||
if (!buf[0]) break;
|
||||
|
||||
p = buf + 2;
|
||||
tmp = strdup(p);
|
||||
p = buf + 2;
|
||||
tmp = strdup(p);
|
||||
name = strtok(tmp, " ");
|
||||
|
||||
p += strlen(name);
|
||||
while (p[0] == ' ') ++p;
|
||||
while (p[0] == ' ')
|
||||
++p;
|
||||
|
||||
/* skip "grp" options for switching kbd layouts */
|
||||
//if (strncmp(name, "grp", 3))
|
||||
{
|
||||
if (!strchr(name, ':'))
|
||||
{
|
||||
group = E_NEW(E_XKB_Option_Group, 1);
|
||||
{
|
||||
if (!strchr(name, ':'))
|
||||
{
|
||||
group = E_NEW(E_XKB_Option_Group, 1);
|
||||
|
||||
/* A hack to get it to parse right if
|
||||
* the group name contains a space
|
||||
*/
|
||||
if (strstr(p, " "))
|
||||
{
|
||||
p = strstr(p, " ");
|
||||
while (p[0] == ' ') ++p;
|
||||
}
|
||||
/* A hack to get it to parse right if
|
||||
* the group name contains a space
|
||||
*/
|
||||
if (strstr(p, " "))
|
||||
{
|
||||
p = strstr(p, " ");
|
||||
while (p[0] == ' ')
|
||||
++p;
|
||||
}
|
||||
|
||||
group->description = eina_stringshare_add(p);
|
||||
group->description = eina_stringshare_add(p);
|
||||
|
||||
optgroups = eina_list_append(optgroups, group);
|
||||
}
|
||||
else if (group)
|
||||
{
|
||||
option = E_NEW(E_XKB_Option, 1);
|
||||
option->name = eina_stringshare_add(name);
|
||||
option->description = eina_stringshare_add(p);
|
||||
group->options = eina_list_append(group->options,
|
||||
option);
|
||||
}
|
||||
}
|
||||
optgroups = eina_list_append(optgroups, group);
|
||||
}
|
||||
else if (group)
|
||||
{
|
||||
option = E_NEW(E_XKB_Option, 1);
|
||||
option->name = eina_stringshare_add(name);
|
||||
option->description = eina_stringshare_add(p);
|
||||
group->options = eina_list_append(group->options,
|
||||
option);
|
||||
}
|
||||
}
|
||||
|
||||
free(tmp);
|
||||
}
|
||||
|
@ -259,10 +264,10 @@ void
|
|||
clear_rules(void)
|
||||
{
|
||||
E_XKB_Option_Group *og;
|
||||
E_XKB_Variant *v;
|
||||
E_XKB_Option *o;
|
||||
E_XKB_Layout *la;
|
||||
E_XKB_Model *m;
|
||||
E_XKB_Variant *v;
|
||||
E_XKB_Option *o;
|
||||
E_XKB_Layout *la;
|
||||
E_XKB_Model *m;
|
||||
|
||||
EINA_LIST_FREE(layouts, la)
|
||||
{
|
||||
|
@ -333,3 +338,4 @@ layout_sort_by_name_cb(const void *data1, const void *data2)
|
|||
|
||||
return strcmp(l1->name, l2);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,41 +8,41 @@
|
|||
|
||||
typedef struct _E_XKB_Model
|
||||
{
|
||||
const char *name;
|
||||
const char *description;
|
||||
const char *name;
|
||||
const char *description;
|
||||
} E_XKB_Model;
|
||||
|
||||
typedef struct _E_XKB_Variant
|
||||
{
|
||||
const char *name;
|
||||
const char *description;
|
||||
const char *name;
|
||||
const char *description;
|
||||
} E_XKB_Variant;
|
||||
|
||||
typedef struct _E_XKB_Layout
|
||||
{
|
||||
const char *name;
|
||||
const char *description;
|
||||
const char *name;
|
||||
const char *description;
|
||||
|
||||
Eina_List *variants;
|
||||
Eina_List *variants;
|
||||
} E_XKB_Layout;
|
||||
|
||||
typedef struct _E_XKB_Option_Group
|
||||
{
|
||||
const char *description;
|
||||
Eina_List *options;
|
||||
const char *description;
|
||||
Eina_List *options;
|
||||
} E_XKB_Option_Group;
|
||||
|
||||
typedef struct _E_XKB_Option
|
||||
{
|
||||
const char *name;
|
||||
const char *description;
|
||||
const char *name;
|
||||
const char *description;
|
||||
} E_XKB_Option;
|
||||
|
||||
int parse_rules(void);
|
||||
void clear_rules(void);
|
||||
void find_rules(void);
|
||||
void find_rules(void);
|
||||
|
||||
int layout_sort_by_name_cb(const void *data1, const void *data2);
|
||||
int layout_sort_by_name_cb(const void *data1, const void *data2);
|
||||
|
||||
extern Eina_List *models;
|
||||
extern Eina_List *layouts;
|
||||
|
|
Loading…
Reference in New Issue