fix minor focus and key handling issues
This commit is contained in:
parent
5b1f5a8d25
commit
c775617dd6
|
@ -102,14 +102,13 @@ ecrire_cfg_load(void)
|
|||
}
|
||||
|
||||
_ent_cfg = eet_data_read(ef, _ent_cfg_descriptor, _CONFIG_ENTRY);
|
||||
eet_close(ef);
|
||||
|
||||
end:
|
||||
if (!_ent_cfg)
|
||||
{
|
||||
_ent_cfg = _ecrire_cfg_new();
|
||||
}
|
||||
|
||||
eet_close(ef);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -513,6 +513,16 @@ my_win_del(void *data, Evas_Object *obj, void *event_info)
|
|||
_alert_if_need_saving(_win_del_do, ent);
|
||||
}
|
||||
|
||||
static void
|
||||
my_win_focused(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Ecrire_Entry *ent = data;
|
||||
(void) data;
|
||||
(void) obj;
|
||||
(void) event_info;
|
||||
elm_object_focus_set(main_ec_ent->entry, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
editor_font_set(Ecrire_Entry *ent, const char *font, int font_size)
|
||||
{
|
||||
|
@ -597,19 +607,14 @@ _key_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event)
|
|||
ctrl = evas_key_modifier_is_set(ev->modifiers, "Control");
|
||||
alt = evas_key_modifier_is_set(ev->modifiers, "Alt");
|
||||
shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
|
||||
if ((alt) || (!ctrl) || (shift))
|
||||
return;
|
||||
|
||||
if (!strcmp(ev->key, "a"))
|
||||
elm_entry_select_all(ent->entry);
|
||||
else if (!strcmp(ev->key, "f"))
|
||||
_find(data, obj, event);
|
||||
else if (!strcmp(ev->key, "g"))
|
||||
_goto_line(data, obj, event);
|
||||
else if (!strcmp(ev->key, "n"))
|
||||
_new(data, obj, event);
|
||||
else if (!strcmp(ev->key, "s"))
|
||||
_save(data, obj, event);
|
||||
if ((ctrl) && (!alt) && (!shift))
|
||||
{
|
||||
if (!strcmp(ev->keyname, "a")) elm_entry_select_all(ent->entry);
|
||||
else if (!strcmp(ev->keyname, "f")) _find(data, obj, event);
|
||||
else if (!strcmp(ev->keyname, "g")) _goto_line(data, obj, event);
|
||||
else if (!strcmp(ev->keyname, "n")) _new(data, obj, event);
|
||||
else if (!strcmp(ev->keyname, "s")) _save(data, obj, event);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI_MAIN int
|
||||
|
@ -777,12 +782,11 @@ elm_main(int argc, char **argv)
|
|||
evas_object_resize(main_ec_ent->win, w, h);
|
||||
|
||||
evas_object_smart_callback_add(main_ec_ent->win, "delete,request", my_win_del, main_ec_ent);
|
||||
evas_object_smart_callback_add(main_ec_ent->win, "focus,in", my_win_focused, main_ec_ent);
|
||||
evas_object_show(main_ec_ent->win);
|
||||
|
||||
_load_to_entry(main_ec_ent, main_ec_ent->filename);
|
||||
|
||||
elm_object_focus_set(main_ec_ent->entry, EINA_TRUE);
|
||||
|
||||
elm_run();
|
||||
|
||||
ecrire_cfg_shutdown();
|
||||
|
|
Loading…
Reference in New Issue