edje_entry.c | edje_entry.c | |||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
Evas_Object *cursor_fg; | Evas_Object *cursor_fg; | |||
Evas_Textblock_Cursor *cursor; | Evas_Textblock_Cursor *cursor; | |||
Evas_Textblock_Cursor *sel_start, *sel_end; | Evas_Textblock_Cursor *sel_start, *sel_end; | |||
Evas_Textblock_Cursor *cursor_user, *cursor_user_extra; | Evas_Textblock_Cursor *cursor_user, *cursor_user_extra; | |||
Evas_Textblock_Cursor *preedit_start, *preedit_end; | Evas_Textblock_Cursor *preedit_start, *preedit_end; | |||
Ecore_Timer *pw_timer; | Ecore_Timer *pw_timer; | |||
Eina_List *sel; | Eina_List *sel; | |||
Eina_List *anchors; | Eina_List *anchors; | |||
Eina_List *anchorlist; | Eina_List *anchorlist; | |||
Eina_List *itemlist; | Eina_List *itemlist; | |||
Eina_List *seq; | ||||
char *selection; | char *selection; | |||
Edje_Input_Panel_Lang input_panel_lang; | Edje_Input_Panel_Lang input_panel_lang; | |||
Eina_Bool composing : 1; | ||||
Eina_Bool selecting : 1; | Eina_Bool selecting : 1; | |||
Eina_Bool have_selection : 1; | Eina_Bool have_selection : 1; | |||
Eina_Bool select_allow : 1; | Eina_Bool select_allow : 1; | |||
Eina_Bool select_mod_start : 1; | Eina_Bool select_mod_start : 1; | |||
Eina_Bool select_mod_end : 1; | Eina_Bool select_mod_end : 1; | |||
Eina_Bool had_sel : 1; | Eina_Bool had_sel : 1; | |||
Eina_Bool input_panel_enable : 1; | Eina_Bool input_panel_enable : 1; | |||
Eina_Bool prediction_allow : 1; | Eina_Bool prediction_allow : 1; | |||
#ifdef HAVE_ECORE_IMF | #ifdef HAVE_ECORE_IMF | |||
skipping to change at line 1051 | skipping to change at line 1053 | |||
eina_stringshare_del(info->change.del.content); | eina_stringshare_del(info->change.del.content); | |||
} | } | |||
free(info); | free(info); | |||
} | } | |||
static void | static void | |||
_range_del_emit(Edje *ed, Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en) | _range_del_emit(Edje *ed, Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en) | |||
{ | { | |||
size_t start, end; | size_t start, end; | |||
char *tmp; | char *tmp; | |||
Edje_Entry_Change_Info *info = calloc(1, sizeof(*info)); | Edje_Entry_Change_Info *info; | |||
info->insert = EINA_FALSE; | ||||
start = evas_textblock_cursor_pos_get(en->sel_start); | start = evas_textblock_cursor_pos_get(en->sel_start); | |||
end = evas_textblock_cursor_pos_get(en->sel_end); | end = evas_textblock_cursor_pos_get(en->sel_end); | |||
if (start == end) | ||||
goto noop; | ||||
info = calloc(1, sizeof(*info)); | ||||
info->insert = EINA_FALSE; | ||||
info->change.del.start = start; | info->change.del.start = start; | |||
info->change.del.end = end; | info->change.del.end = end; | |||
tmp = evas_textblock_cursor_range_text_get(en->sel_start, en->sel_end, E VAS_TEXTBLOCK_TEXT_MARKUP); | tmp = evas_textblock_cursor_range_text_get(en->sel_start, en->sel_end, E VAS_TEXTBLOCK_TEXT_MARKUP); | |||
info->change.del.content = eina_stringshare_add(tmp); | info->change.del.content = eina_stringshare_add(tmp); | |||
if (tmp) free(tmp); | if (tmp) free(tmp); | |||
evas_textblock_cursor_range_delete(en->sel_start, en->sel_end); | evas_textblock_cursor_range_delete(en->sel_start, en->sel_end); | |||
_edje_emit(ed, "entry,changed", en->rp->part->name); | _edje_emit(ed, "entry,changed", en->rp->part->name); | |||
_edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info, | _edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info, | |||
_free_entry_change_info); | _free_entry_change_info); | |||
noop: | ||||
_sel_clear(en->cursor, en->rp->object, en); | _sel_clear(en->cursor, en->rp->object, en); | |||
} | } | |||
static void | static void | |||
_range_del(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en) | _range_del(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en) | |||
{ | { | |||
evas_textblock_cursor_range_delete(en->sel_start, en->sel_end); | evas_textblock_cursor_range_delete(en->sel_start, en->sel_end); | |||
_sel_clear(en->cursor, en->rp->object, en); | _sel_clear(en->cursor, en->rp->object, en); | |||
} | } | |||
skipping to change at line 1140 | skipping to change at line 1148 | |||
static Eina_Bool | static Eina_Bool | |||
_password_timer_cb(void *data) | _password_timer_cb(void *data) | |||
{ | { | |||
Entry *en = (Entry *)data; | Entry *en = (Entry *)data; | |||
_edje_entry_hide_visible_password(en->rp); | _edje_entry_hide_visible_password(en->rp); | |||
en->pw_timer = NULL; | en->pw_timer = NULL; | |||
return ECORE_CALLBACK_CANCEL; | return ECORE_CALLBACK_CANCEL; | |||
} | } | |||
static Eina_Bool | ||||
_is_modifier(const char *key) | ||||
{ | ||||
if ((!strncmp(key, "Shift", 5)) || | ||||
(!strncmp(key, "Control", 7)) || | ||||
(!strncmp(key, "Alt", 3)) || | ||||
(!strncmp(key, "Meta", 4)) || | ||||
(!strncmp(key, "Super", 5)) || | ||||
(!strncmp(key, "Hyper", 5)) || | ||||
(!strcmp(key, "Scroll_Lock")) || | ||||
(!strcmp(key, "Num_Lock")) || | ||||
(!strcmp(key, "Caps_Lock"))) | ||||
return EINA_TRUE; | ||||
return EINA_FALSE; | ||||
} | ||||
static void | ||||
_compose_seq_reset(Entry *en) | ||||
{ | ||||
char *str; | ||||
EINA_LIST_FREE(en->seq, str) eina_stringshare_del(str); | ||||
en->composing = EINA_FALSE; | ||||
} | ||||
static void | static void | |||
_edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED __, void *event_info) | _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED __, void *event_info) | |||
{ | { | |||
Edje *ed = data; | Edje *ed = data; | |||
Evas_Event_Key_Down *ev = event_info; | Evas_Event_Key_Down *ev = event_info; | |||
Edje_Real_Part *rp = ed->focused_part; | Edje_Real_Part *rp = ed->focused_part; | |||
Entry *en; | Entry *en; | |||
Eina_Bool control, alt, shift; | Eina_Bool control, alt, shift; | |||
Eina_Bool multiline; | Eina_Bool multiline; | |||
Eina_Bool cursor_changed; | Eina_Bool cursor_changed; | |||
skipping to change at line 1163 | skipping to change at line 1196 | |||
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || | if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || | |||
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE)) | (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE)) | |||
return; | return; | |||
if (!ev->keyname) return; | if (!ev->keyname) return; | |||
#ifdef HAVE_ECORE_IMF | #ifdef HAVE_ECORE_IMF | |||
if (en->imf_context) | if (en->imf_context) | |||
{ | { | |||
Ecore_IMF_Event_Key_Down ecore_ev; | Ecore_IMF_Event_Key_Down ecore_ev; | |||
ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev); | ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev); | |||
if (ecore_imf_context_filter_event(en->imf_context, | if (!en->composing) | |||
ECORE_IMF_EVENT_KEY_DOWN, | { | |||
(Ecore_IMF_Event *)&ecore_ev)) | if (ecore_imf_context_filter_event(en->imf_context, | |||
return; | ECORE_IMF_EVENT_KEY_DOWN, | |||
(Ecore_IMF_Event *)&ecore_e | ||||
v)) | ||||
return; | ||||
} | ||||
} | } | |||
#endif | #endif | |||
if ((!strcmp(ev->keyname, "Escape")) || | if ((!strcmp(ev->keyname, "Escape")) || | |||
(!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "KP_Enter" ))) | (!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "KP_Enter" ))) | |||
_edje_entry_imf_context_reset(rp); | _edje_entry_imf_context_reset(rp); | |||
old_cur_pos = evas_textblock_cursor_pos_get(en->cursor); | old_cur_pos = evas_textblock_cursor_pos_get(en->cursor); | |||
control = evas_key_modifier_is_set(ev->modifiers, "Control"); | control = evas_key_modifier_is_set(ev->modifiers, "Control"); | |||
alt = evas_key_modifier_is_set(ev->modifiers, "Alt"); | alt = evas_key_modifier_is_set(ev->modifiers, "Alt"); | |||
shift = evas_key_modifier_is_set(ev->modifiers, "Shift"); | shift = evas_key_modifier_is_set(ev->modifiers, "Shift"); | |||
multiline = rp->part->multiline; | multiline = rp->part->multiline; | |||
cursor_changed = EINA_FALSE; | cursor_changed = EINA_FALSE; | |||
if (!strcmp(ev->keyname, "Escape")) | if (!strcmp(ev->keyname, "Escape")) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
// dead keys here. Escape for now (should emit these) | // dead keys here. Escape for now (should emit these) | |||
_edje_emit(ed, "entry,key,escape", rp->part->name); | _edje_emit(ed, "entry,key,escape", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if (!strcmp(ev->keyname, "Up") || | else if (!strcmp(ev->keyname, "Up") || | |||
(!strcmp(ev->keyname, "KP_Up") && !ev->string)) | (!strcmp(ev->keyname, "KP_Up") && !ev->string)) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (multiline) | if (multiline) | |||
{ | { | |||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_start(en->cursor, rp->object, en); | if (shift) _sel_start(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
_curs_up(en->cursor, rp->object, en); | _curs_up(en->cursor, rp->object, en); | |||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
skipping to change at line 1211 | skipping to change at line 1249 | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
_edje_emit(ed, "entry,key,up", rp->part->name); | _edje_emit(ed, "entry,key,up", rp->part->name); | |||
_edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); | _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); | |||
} | } | |||
else if (!strcmp(ev->keyname, "Down") || | else if (!strcmp(ev->keyname, "Down") || | |||
(!strcmp(ev->keyname, "KP_Down") && !ev->string)) | (!strcmp(ev->keyname, "KP_Down") && !ev->string)) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (multiline) | if (multiline) | |||
{ | { | |||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_start(en->cursor, rp->object, en); | if (shift) _sel_start(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
_curs_down(en->cursor, rp->object, en); | _curs_down(en->cursor, rp->object, en); | |||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
skipping to change at line 1232 | skipping to change at line 1271 | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
_edje_emit(ed, "entry,key,down", rp->part->name); | _edje_emit(ed, "entry,key,down", rp->part->name); | |||
_edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); | _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); | |||
} | } | |||
else if (!strcmp(ev->keyname, "Left") || | else if (!strcmp(ev->keyname, "Left") || | |||
(!strcmp(ev->keyname, "KP_Left") && !ev->string)) | (!strcmp(ev->keyname, "KP_Left") && !ev->string)) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_start(en->cursor, rp->object, en); | if (shift) _sel_start(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
evas_textblock_cursor_char_prev(en->cursor); | evas_textblock_cursor_char_prev(en->cursor); | |||
/* If control is pressed, go to the start of the word */ | /* If control is pressed, go to the start of the word */ | |||
if (control) evas_textblock_cursor_word_start(en->cursor); | if (control) evas_textblock_cursor_word_start(en->cursor); | |||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_extend(en->cursor, rp->object, en); | if (shift) _sel_extend(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
_edje_emit(ed, "entry,key,left", rp->part->name); | _edje_emit(ed, "entry,key,left", rp->part->name); | |||
_edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); | _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if (!strcmp(ev->keyname, "Right") || | else if (!strcmp(ev->keyname, "Right") || | |||
(!strcmp(ev->keyname, "KP_Right") && !ev->string)) | (!strcmp(ev->keyname, "KP_Right") && !ev->string)) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_start(en->cursor, rp->object, en); | if (shift) _sel_start(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
/* If control is pressed, go to the start of the word */ | /* If control is pressed, go to the end of the word */ | |||
if (control) evas_textblock_cursor_word_end(en->cursor); | if (control) evas_textblock_cursor_word_end(en->cursor); | |||
evas_textblock_cursor_char_next(en->cursor); | evas_textblock_cursor_char_next(en->cursor); | |||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_extend(en->cursor, rp->object, en); | if (shift) _sel_extend(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
_edje_emit(ed, "entry,key,right", rp->part->name); | _edje_emit(ed, "entry,key,right", rp->part->name); | |||
_edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); | _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if (!strcmp(ev->keyname, "BackSpace")) | else if (!strcmp(ev->keyname, "BackSpace")) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (control && !en->have_selection) | if (control && !en->have_selection) | |||
{ | { | |||
// del to start of previous word | // del to start of previous word | |||
_sel_start(en->cursor, rp->object, en); | _sel_start(en->cursor, rp->object, en); | |||
evas_textblock_cursor_char_prev(en->cursor); | evas_textblock_cursor_char_prev(en->cursor); | |||
evas_textblock_cursor_word_start(en->cursor); | evas_textblock_cursor_word_start(en->cursor); | |||
_sel_extend(en->cursor, rp->object, en); | _sel_preextend(en->cursor, rp->object, en); | |||
_range_del_emit(ed, en->cursor, rp->object, en); | _range_del_emit(ed, en->cursor, rp->object, en); | |||
} | } | |||
else if ((alt) && (shift)) | else if ((alt) && (shift)) | |||
{ | { | |||
// undo last action | // undo last action | |||
} | } | |||
else | else | |||
{ | { | |||
if (en->have_selection) | if (en->have_selection) | |||
skipping to change at line 1309 | skipping to change at line 1351 | |||
} | } | |||
} | } | |||
_sel_clear(en->cursor, rp->object, en); | _sel_clear(en->cursor, rp->object, en); | |||
_anchors_get(en->cursor, rp->object, en); | _anchors_get(en->cursor, rp->object, en); | |||
_edje_emit(ed, "entry,key,backspace", rp->part->name); | _edje_emit(ed, "entry,key,backspace", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if (!strcmp(ev->keyname, "Delete") || | else if (!strcmp(ev->keyname, "Delete") || | |||
(!strcmp(ev->keyname, "KP_Delete") && !ev->string)) | (!strcmp(ev->keyname, "KP_Delete") && !ev->string)) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (control) | if (control) | |||
{ | { | |||
// del to end of next word | // del to end of next word | |||
_sel_start(en->cursor, rp->object, en); | _sel_start(en->cursor, rp->object, en); | |||
evas_textblock_cursor_word_end(en->cursor); | evas_textblock_cursor_word_end(en->cursor); | |||
evas_textblock_cursor_char_next(en->cursor); | evas_textblock_cursor_char_next(en->cursor); | |||
_sel_extend(en->cursor, rp->object, en); | _sel_extend(en->cursor, rp->object, en); | |||
skipping to change at line 1344 | skipping to change at line 1387 | |||
} | } | |||
} | } | |||
_sel_clear(en->cursor, rp->object, en); | _sel_clear(en->cursor, rp->object, en); | |||
_anchors_get(en->cursor, rp->object, en); | _anchors_get(en->cursor, rp->object, en); | |||
_edje_emit(ed, "entry,key,delete", rp->part->name); | _edje_emit(ed, "entry,key,delete", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if (!strcmp(ev->keyname, "Home") || | else if (!strcmp(ev->keyname, "Home") || | |||
((!strcmp(ev->keyname, "KP_Home")) && !ev->string)) | ((!strcmp(ev->keyname, "KP_Home")) && !ev->string)) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_start(en->cursor, rp->object, en); | if (shift) _sel_start(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
if ((control) && (multiline)) | if ((control) && (multiline)) | |||
_curs_start(en->cursor, rp->object, en); | _curs_start(en->cursor, rp->object, en); | |||
else | else | |||
_curs_lin_start(en->cursor, rp->object, en); | _curs_lin_start(en->cursor, rp->object, en); | |||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_extend(en->cursor, rp->object, en); | if (shift) _sel_extend(en->cursor, rp->object, en); | |||
} | } | |||
_edje_emit(ed, "entry,key,home", rp->part->name); | _edje_emit(ed, "entry,key,home", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if (!strcmp(ev->keyname, "End") || | else if (!strcmp(ev->keyname, "End") || | |||
((!strcmp(ev->keyname, "KP_End")) && !ev->string)) | ((!strcmp(ev->keyname, "KP_End")) && !ev->string)) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_start(en->cursor, rp->object, en); | if (shift) _sel_start(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
if ((control) && (multiline)) | if ((control) && (multiline)) | |||
_curs_end(en->cursor, rp->object, en); | _curs_end(en->cursor, rp->object, en); | |||
else | else | |||
_curs_lin_end(en->cursor, rp->object, en); | _curs_lin_end(en->cursor, rp->object, en); | |||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_extend(en->cursor, rp->object, en); | if (shift) _sel_extend(en->cursor, rp->object, en); | |||
} | } | |||
_edje_emit(ed, "entry,key,end", rp->part->name); | _edje_emit(ed, "entry,key,end", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if ((control) && (!shift) && (!strcmp(ev->keyname, "v"))) | else if ((control) && (!shift) && (!strcmp(ev->keyname, "v"))) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
_edje_emit(ed, "entry,paste,request", rp->part->name); | _edje_emit(ed, "entry,paste,request", rp->part->name); | |||
_edje_emit(ed, "entry,paste,request,3", rp->part->name); | _edje_emit(ed, "entry,paste,request,3", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if ((control) && (!strcmp(ev->keyname, "a"))) | else if ((control) && (!strcmp(ev->keyname, "a"))) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (shift) | if (shift) | |||
{ | { | |||
_edje_emit(ed, "entry,selection,none,request", rp->part->name) ; | _edje_emit(ed, "entry,selection,none,request", rp->part->name) ; | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else | else | |||
{ | { | |||
_edje_emit(ed, "entry,selection,all,request", rp->part->name); | _edje_emit(ed, "entry,selection,all,request", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
} | } | |||
else if ((control) && (((!shift) && !strcmp(ev->keyname, "c")) || !strcm p(ev->keyname, "Insert"))) | else if ((control) && (((!shift) && !strcmp(ev->keyname, "c")) || !strcm p(ev->keyname, "Insert"))) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
_edje_emit(ed, "entry,copy,notify", rp->part->name); | _edje_emit(ed, "entry,copy,notify", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if ((control) && (!shift) && ((!strcmp(ev->keyname, "x") || (!strcm p(ev->keyname, "m"))))) | else if ((control) && (!shift) && ((!strcmp(ev->keyname, "x") || (!strcm p(ev->keyname, "m"))))) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
_edje_emit(ed, "entry,cut,notify", rp->part->name); | _edje_emit(ed, "entry,cut,notify", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if ((control) && (!strcmp(ev->keyname, "z"))) | else if ((control) && (!strcmp(ev->keyname, "z"))) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (shift) | if (shift) | |||
{ | { | |||
// redo | // redo | |||
_edje_emit(ed, "entry,redo,request", rp->part->name); | _edje_emit(ed, "entry,redo,request", rp->part->name); | |||
} | } | |||
else | else | |||
{ | { | |||
// undo | // undo | |||
_edje_emit(ed, "entry,undo,request", rp->part->name); | _edje_emit(ed, "entry,undo,request", rp->part->name); | |||
} | } | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if ((control) && (!shift) && (!strcmp(ev->keyname, "y"))) | else if ((control) && (!shift) && (!strcmp(ev->keyname, "y"))) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
// redo | // redo | |||
_edje_emit(ed, "entry,redo,request", rp->part->name); | _edje_emit(ed, "entry,redo,request", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if ((control) && (!shift) && (!strcmp(ev->keyname, "w"))) | else if ((control) && (!shift) && (!strcmp(ev->keyname, "w"))) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
_sel_clear(en->cursor, rp->object, en); | _sel_clear(en->cursor, rp->object, en); | |||
// select current word? | // select current word? | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if (!strcmp(ev->keyname, "Tab")) | else if (!strcmp(ev->keyname, "Tab")) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (multiline) | if (multiline) | |||
{ | { | |||
if (shift) | if (shift) | |||
{ | { | |||
// remove a tab | // remove a tab | |||
} | } | |||
else | else | |||
{ | { | |||
Edje_Entry_Change_Info *info = calloc(1, sizeof(*info)); | Edje_Entry_Change_Info *info = calloc(1, sizeof(*info)); | |||
info->insert = EINA_TRUE; | info->insert = EINA_TRUE; | |||
skipping to change at line 1470 | skipping to change at line 1523 | |||
_edje_emit(ed, "entry,changed", rp->part->name); | _edje_emit(ed, "entry,changed", rp->part->name); | |||
_edje_emit_full(ed, "entry,changed,user", rp->part->name, | _edje_emit_full(ed, "entry,changed,user", rp->part->name, | |||
info, _free_entry_change_info); | info, _free_entry_change_info); | |||
} | } | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
_edje_emit(ed, "entry,key,tab", rp->part->name); | _edje_emit(ed, "entry,key,tab", rp->part->name); | |||
} | } | |||
else if ((!strcmp(ev->keyname, "ISO_Left_Tab")) && (multiline)) | else if ((!strcmp(ev->keyname, "ISO_Left_Tab")) && (multiline)) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
// remove a tab | // remove a tab | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if (!strcmp(ev->keyname, "Prior") || | else if (!strcmp(ev->keyname, "Prior") || | |||
(!strcmp(ev->keyname, "KP_Prior") && !ev->string)) | (!strcmp(ev->keyname, "KP_Prior") && !ev->string)) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_start(en->cursor, rp->object, en); | if (shift) _sel_start(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
_curs_jump_line_by(en->cursor, rp->object, en, -10); | _curs_jump_line_by(en->cursor, rp->object, en, -10); | |||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_extend(en->cursor, rp->object, en); | if (shift) _sel_extend(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
_edje_emit(ed, "entry,key,pgup", rp->part->name); | _edje_emit(ed, "entry,key,pgup", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if (!strcmp(ev->keyname, "Next") || | else if (!strcmp(ev->keyname, "Next") || | |||
(!strcmp(ev->keyname, "KP_Next") && !ev->string)) | (!strcmp(ev->keyname, "KP_Next") && !ev->string)) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_start(en->cursor, rp->object, en); | if (shift) _sel_start(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
_curs_jump_line_by(en->cursor, rp->object, en, 10); | _curs_jump_line_by(en->cursor, rp->object, en, 10); | |||
if (en->select_allow) | if (en->select_allow) | |||
{ | { | |||
if (shift) _sel_extend(en->cursor, rp->object, en); | if (shift) _sel_extend(en->cursor, rp->object, en); | |||
else _sel_clear(en->cursor, rp->object, en); | else _sel_clear(en->cursor, rp->object, en); | |||
} | } | |||
_edje_emit(ed, "entry,key,pgdn", rp->part->name); | _edje_emit(ed, "entry,key,pgdn", rp->part->name); | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
else if ((!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "KP_E nter"))) | else if ((!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "KP_E nter"))) | |||
{ | { | |||
_compose_seq_reset(en); | ||||
if (multiline) | if (multiline) | |||
{ | { | |||
Edje_Entry_Change_Info *info = calloc(1, sizeof(*info)); | Edje_Entry_Change_Info *info = calloc(1, sizeof(*info)); | |||
info->insert = EINA_TRUE; | info->insert = EINA_TRUE; | |||
info->change.insert.plain_length = 1; | info->change.insert.plain_length = 1; | |||
if (en->have_selection) | if (en->have_selection) | |||
{ | { | |||
_range_del_emit(ed, en->cursor, rp->object, en); | _range_del_emit(ed, en->cursor, rp->object, en); | |||
info->merge = EINA_TRUE; | info->merge = EINA_TRUE; | |||
} | } | |||
skipping to change at line 1549 | skipping to change at line 1606 | |||
_edje_emit_full(ed, "entry,changed,user", rp->part->name, | _edje_emit_full(ed, "entry,changed,user", rp->part->name, | |||
info, _free_entry_change_info); | info, _free_entry_change_info); | |||
_edje_emit(ed, "cursor,changed", rp->part->name); | _edje_emit(ed, "cursor,changed", rp->part->name); | |||
cursor_changed = EINA_TRUE; | cursor_changed = EINA_TRUE; | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
_edje_emit(ed, "entry,key,enter", rp->part->name); | _edje_emit(ed, "entry,key,enter", rp->part->name); | |||
} | } | |||
else | else | |||
{ | { | |||
if (ev->string) | char *compres = NULL, *string = (char *)ev->string; | |||
Eina_Bool free_string = EINA_FALSE; | ||||
Ecore_Compose_State state; | ||||
if (!en->composing) | ||||
{ | ||||
_compose_seq_reset(en); | ||||
en->seq = eina_list_append(en->seq, eina_stringshare_add(ev->k | ||||
ey)); | ||||
state = ecore_compose_get(en->seq, &compres); | ||||
if (state == ECORE_COMPOSE_MIDDLE) en->composing = EINA_TRUE; | ||||
else en->composing = EINA_FALSE; | ||||
if (!en->composing) _compose_seq_reset(en); | ||||
else goto end; | ||||
} | ||||
else | ||||
{ | ||||
if (_is_modifier(ev->key)) goto end; | ||||
en->seq = eina_list_append(en->seq, eina_stringshare_add(ev->k | ||||
ey)); | ||||
state = ecore_compose_get(en->seq, &compres); | ||||
if (state == ECORE_COMPOSE_NONE) _compose_seq_reset(en); | ||||
else if (state == ECORE_COMPOSE_DONE) | ||||
{ | ||||
_compose_seq_reset(en); | ||||
if (compres) | ||||
{ | ||||
string = compres; | ||||
free_string = EINA_TRUE; | ||||
} | ||||
} | ||||
else goto end; | ||||
} | ||||
if (string) | ||||
{ | { | |||
Edje_Entry_Change_Info *info = calloc(1, sizeof(*info)); | Edje_Entry_Change_Info *info = calloc(1, sizeof(*info)); | |||
info->insert = EINA_TRUE; | info->insert = EINA_TRUE; | |||
info->change.insert.plain_length = 1; | info->change.insert.plain_length = 1; | |||
info->change.insert.content = eina_stringshare_add(ev->string) ; | info->change.insert.content = eina_stringshare_add(string); | |||
if (en->have_selection) | if (en->have_selection) | |||
{ | { | |||
_range_del_emit(ed, en->cursor, rp->object, en); | _range_del_emit(ed, en->cursor, rp->object, en); | |||
info->merge = EINA_TRUE; | info->merge = EINA_TRUE; | |||
} | } | |||
info->change.insert.pos = | info->change.insert.pos = | |||
evas_textblock_cursor_pos_get(en->cursor); | evas_textblock_cursor_pos_get(en->cursor); | |||
// if PASSWORD_SHOW_LAST mode, appending text with password=of f tag | // if PASSWORD_SHOW_LAST mode, appending text with password=of f tag | |||
if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) && | if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) && | |||
_edje_password_show_last) | _edje_password_show_last) | |||
{ | { | |||
_edje_entry_hide_visible_password(en->rp); | _edje_entry_hide_visible_password(en->rp); | |||
_text_filter_format_prepend(en, en->cursor, "+ password=o ff"); | _text_filter_format_prepend(en, en->cursor, "+ password=o ff"); | |||
_text_filter_text_prepend(en, en->cursor, ev->string); | _text_filter_text_prepend(en, en->cursor, string); | |||
_text_filter_format_prepend(en, en->cursor, "- password") ; | _text_filter_format_prepend(en, en->cursor, "- password") ; | |||
if (en->pw_timer) | if (en->pw_timer) | |||
{ | { | |||
ecore_timer_del(en->pw_timer); | ecore_timer_del(en->pw_timer); | |||
en->pw_timer = NULL; | en->pw_timer = NULL; | |||
} | } | |||
en->pw_timer = ecore_timer_add(_edje_password_show_last_t imeout, | en->pw_timer = ecore_timer_add(TO_DOUBLE(_edje_password_s how_last_timeout), | |||
_password_timer_cb, en); | _password_timer_cb, en); | |||
} | } | |||
else | else | |||
_text_filter_text_prepend(en, en->cursor, ev->string); | _text_filter_text_prepend(en, en->cursor, string); | |||
_anchors_get(en->cursor, rp->object, en); | _anchors_get(en->cursor, rp->object, en); | |||
_edje_emit(ed, "entry,changed", rp->part->name); | _edje_emit(ed, "entry,changed", rp->part->name); | |||
_edje_emit_full(ed, "entry,changed,user", rp->part->name, | _edje_emit_full(ed, "entry,changed,user", rp->part->name, | |||
info, _free_entry_change_info); | info, _free_entry_change_info); | |||
_edje_emit(ed, "cursor,changed", rp->part->name); | _edje_emit(ed, "cursor,changed", rp->part->name); | |||
cursor_changed = EINA_TRUE; | cursor_changed = EINA_TRUE; | |||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; | |||
} | } | |||
if (free_string) free(string); | ||||
} | } | |||
end: | ||||
if (!cursor_changed && (old_cur_pos != evas_textblock_cursor_pos_get(en- >cursor))) | if (!cursor_changed && (old_cur_pos != evas_textblock_cursor_pos_get(en- >cursor))) | |||
_edje_emit(ed, "cursor,changed", rp->part->name); | _edje_emit(ed, "cursor,changed", rp->part->name); | |||
_edje_entry_imf_cursor_info_set(en); | _edje_entry_imf_cursor_info_set(en); | |||
_edje_entry_real_part_configure(rp); | _edje_entry_real_part_configure(rp); | |||
} | } | |||
static void | static void | |||
_edje_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__ , void *event_info) | _edje_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__ , void *event_info) | |||
{ | { | |||
skipping to change at line 1648 | skipping to change at line 1738 | |||
static void | static void | |||
_edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj _ _UNUSED__, void *event_info) | _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj _ _UNUSED__, void *event_info) | |||
{ | { | |||
Evas_Coord cx, cy; | Evas_Coord cx, cy; | |||
Edje_Real_Part *rp = data; | Edje_Real_Part *rp = data; | |||
Evas_Event_Mouse_Down *ev = event_info; | Evas_Event_Mouse_Down *ev = event_info; | |||
Entry *en; | Entry *en; | |||
Evas_Coord x, y, w, h; | Evas_Coord x, y, w, h; | |||
// Eina_Bool multiline; | // Eina_Bool multiline; | |||
Evas_Textblock_Cursor *tc; | Evas_Textblock_Cursor *tc = NULL; | |||
Eina_Bool dosel = EINA_FALSE; | Eina_Bool dosel = EINA_FALSE; | |||
Eina_Bool shift; | ||||
if (!rp) return; | if (!rp) return; | |||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; | if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; | |||
en = rp->entry_data; | en = rp->entry_data; | |||
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || | if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || | |||
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) | (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) | |||
return; | return; | |||
if ((ev->button != 1) && (ev->button != 2)) return; | if ((ev->button != 1) && (ev->button != 2)) return; | |||
#ifdef HAVE_ECORE_IMF | #ifdef HAVE_ECORE_IMF | |||
if (en->imf_context) | if (en->imf_context) | |||
{ | { | |||
Ecore_IMF_Event_Mouse_Down ecore_ev; | Ecore_IMF_Event_Mouse_Down ecore_ev; | |||
ecore_imf_evas_event_mouse_down_wrap(ev, &ecore_ev); | ecore_imf_evas_event_mouse_down_wrap(ev, &ecore_ev); | |||
if (ecore_imf_context_filter_event(en->imf_context, | if (ecore_imf_context_filter_event(en->imf_context, | |||
ECORE_IMF_EVENT_MOUSE_DOWN, | ECORE_IMF_EVENT_MOUSE_DOWN, | |||
(Ecore_IMF_Event *)&ecore_ev)) | (Ecore_IMF_Event *)&ecore_ev)) | |||
return; | return; | |||
} | } | |||
#endif | #endif | |||
_edje_entry_imf_context_reset(rp); | shift = evas_key_modifier_is_set(ev->modifiers, "Shift"); | |||
en->select_mod_start = EINA_FALSE; | en->select_mod_start = EINA_FALSE; | |||
en->select_mod_end = EINA_FALSE; | en->select_mod_end = EINA_FALSE; | |||
if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT) | if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT) | |||
dosel = EINA_TRUE; | dosel = EINA_TRUE; | |||
else if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) | else if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) | |||
{ | { | |||
if (en->select_allow) dosel = EINA_TRUE; | if (en->select_allow) dosel = EINA_TRUE; | |||
} | } | |||
if (ev->button == 2) dosel = EINA_FALSE; | if (ev->button == 2) dosel = EINA_FALSE; | |||
if (dosel) | if (dosel) | |||
{ | { | |||
evas_object_geometry_get(rp->object, &x, &y, &w, &h); | ||||
cx = ev->canvas.x - x; | ||||
cy = ev->canvas.y - y; | ||||
if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) | if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) | |||
{ | { | |||
en->have_selection = EINA_FALSE; | if (shift) | |||
en->selecting = EINA_FALSE; | { | |||
_sel_clear(en->cursor, rp->object, en); | tc = evas_object_textblock_cursor_new(rp->object); | |||
tc = evas_object_textblock_cursor_new(rp->object); | evas_textblock_cursor_copy(en->cursor, tc); | |||
evas_textblock_cursor_copy(en->cursor, tc); | if (evas_textblock_cursor_compare(en->cursor, en->sel_sta | |||
evas_textblock_cursor_line_char_first(en->cursor); | rt) < 0) | |||
_sel_start(en->cursor, rp->object, en); | evas_textblock_cursor_line_char_first(en->cursor); | |||
evas_textblock_cursor_line_char_last(en->cursor); | else | |||
_sel_extend(en->cursor, rp->object, en); | evas_textblock_cursor_line_char_last(en->cursor); | |||
_sel_extend(en->cursor, rp->object, en); | ||||
} | ||||
else | ||||
{ | ||||
en->have_selection = EINA_FALSE; | ||||
en->selecting = EINA_FALSE; | ||||
_sel_clear(en->cursor, rp->object, en); | ||||
tc = evas_object_textblock_cursor_new(rp->object); | ||||
evas_textblock_cursor_copy(en->cursor, tc); | ||||
evas_textblock_cursor_line_char_first(en->cursor); | ||||
_sel_start(en->cursor, rp->object, en); | ||||
evas_textblock_cursor_line_char_last(en->cursor); | ||||
_sel_extend(en->cursor, rp->object, en); | ||||
} | ||||
goto end; | goto end; | |||
} | } | |||
else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) | else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) | |||
{ | { | |||
en->have_selection = EINA_FALSE; | if (shift) | |||
en->selecting = EINA_FALSE; | { | |||
_sel_clear(en->cursor, rp->object, en); | tc = evas_object_textblock_cursor_new(rp->object); | |||
tc = evas_object_textblock_cursor_new(rp->object); | evas_textblock_cursor_copy(en->cursor, tc); | |||
evas_textblock_cursor_copy(en->cursor, tc); | if (evas_textblock_cursor_compare(en->cursor, en->sel_sta | |||
evas_textblock_cursor_word_start(en->cursor); | rt) < 0) | |||
_sel_start(en->cursor, rp->object, en); | evas_textblock_cursor_word_start(en->cursor); | |||
evas_textblock_cursor_word_end(en->cursor); | else | |||
evas_textblock_cursor_char_next(en->cursor); | { | |||
_sel_extend(en->cursor, rp->object, en); | evas_textblock_cursor_word_end(en->cursor); | |||
evas_textblock_cursor_char_next(en->cursor); | ||||
} | ||||
_sel_extend(en->cursor, rp->object, en); | ||||
} | ||||
else | ||||
{ | ||||
en->have_selection = EINA_FALSE; | ||||
en->selecting = EINA_FALSE; | ||||
_sel_clear(en->cursor, rp->object, en); | ||||
tc = evas_object_textblock_cursor_new(rp->object); | ||||
evas_textblock_cursor_copy(en->cursor, tc); | ||||
evas_textblock_cursor_word_start(en->cursor); | ||||
_sel_start(en->cursor, rp->object, en); | ||||
evas_textblock_cursor_word_end(en->cursor); | ||||
evas_textblock_cursor_char_next(en->cursor); | ||||
_sel_extend(en->cursor, rp->object, en); | ||||
} | ||||
goto end; | goto end; | |||
} | } | |||
} | } | |||
tc = evas_object_textblock_cursor_new(rp->object); | tc = evas_object_textblock_cursor_new(rp->object); | |||
evas_textblock_cursor_copy(en->cursor, tc); | evas_textblock_cursor_copy(en->cursor, tc); | |||
// multiline = rp->part->multiline; | // multiline = rp->part->multiline; | |||
evas_object_geometry_get(rp->object, &x, &y, &w, &h); | evas_object_geometry_get(rp->object, &x, &y, &w, &h); | |||
cx = ev->canvas.x - x; | cx = ev->canvas.x - x; | |||
cy = ev->canvas.y - y; | cy = ev->canvas.y - y; | |||
if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy)) | if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy)) | |||
skipping to change at line 1760 | skipping to change at line 1880 | |||
else | else | |||
_curs_lin_end(en->cursor, rp->object, en); | _curs_lin_end(en->cursor, rp->object, en); | |||
} | } | |||
} | } | |||
} | } | |||
if (dosel) | if (dosel) | |||
{ | { | |||
if ((en->have_selection) && | if ((en->have_selection) && | |||
(rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)) | (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)) | |||
{ | { | |||
Eina_List *first, *last; | if (shift) | |||
FLOAT_T sc; | _sel_extend(en->cursor, rp->object, en); | |||
else | ||||
{ | ||||
Eina_List *first, *last; | ||||
FLOAT_T sc; | ||||
first = en->sel; | first = en->sel; | |||
last = eina_list_last(en->sel); | last = eina_list_last(en->sel); | |||
if (first && last) | if (first && last) | |||
{ | ||||
Evas_Textblock_Rectangle *r1, *r2; | ||||
Evas_Coord d, d1, d2; | ||||
r1 = first->data; | ||||
r2 = last->data; | ||||
d = r1->x - cx; | ||||
d1 = d * d; | ||||
d = (r1->y + (r1->h / 2)) - cy; | ||||
d1 += d * d; | ||||
d = r2->x + r2->w - 1 - cx; | ||||
d2 = d * d; | ||||
d = (r2->y + (r2->h / 2)) - cy; | ||||
d2 += d * d; | ||||
sc = rp->edje->scale; | ||||
if (sc == ZERO) sc = _edje_scale; | ||||
d = (Evas_Coord)MUL(FROM_INT(20), sc); // FIXME: maxing n | ||||
umber! | ||||
d = d * d; | ||||
if (d1 < d2) | ||||
{ | { | |||
if (d1 <= d) | Evas_Textblock_Rectangle *r1, *r2; | |||
Evas_Coord d, d1, d2; | ||||
r1 = first->data; | ||||
r2 = last->data; | ||||
d = r1->x - cx; | ||||
d1 = d * d; | ||||
d = (r1->y + (r1->h / 2)) - cy; | ||||
d1 += d * d; | ||||
d = r2->x + r2->w - 1 - cx; | ||||
d2 = d * d; | ||||
d = (r2->y + (r2->h / 2)) - cy; | ||||
d2 += d * d; | ||||
sc = rp->edje->scale; | ||||
if (sc == ZERO) sc = _edje_scale; | ||||
d = (Evas_Coord)MUL(FROM_INT(20), sc); // FIXME: max | ||||
ing number! | ||||
d = d * d; | ||||
if (d1 < d2) | ||||
{ | { | |||
en->select_mod_start = EINA_TRUE; | if (d1 <= d) | |||
en->selecting = EINA_TRUE; | { | |||
en->select_mod_start = EINA_TRUE; | ||||
en->selecting = EINA_TRUE; | ||||
} | ||||
} | } | |||
} | else | |||
else | ||||
{ | ||||
if (d2 <= d) | ||||
{ | { | |||
en->select_mod_end = EINA_TRUE; | if (d2 <= d) | |||
en->selecting = EINA_TRUE; | { | |||
en->select_mod_end = EINA_TRUE; | ||||
en->selecting = EINA_TRUE; | ||||
} | ||||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
en->selecting = EINA_TRUE; | if ((en->have_selection) && (shift)) | |||
_sel_clear(en->cursor, rp->object, en); | _sel_extend(en->cursor, rp->object, en); | |||
if (en->select_allow) | else | |||
{ | { | |||
_sel_start(en->cursor, rp->object, en); | en->selecting = EINA_TRUE; | |||
_sel_clear(en->cursor, rp->object, en); | ||||
if (en->select_allow) | ||||
{ | ||||
_sel_start(en->cursor, rp->object, en); | ||||
} | ||||
} | } | |||
} | } | |||
} | } | |||
end: | end: | |||
if (evas_textblock_cursor_compare(tc, en->cursor)) | if (evas_textblock_cursor_compare(tc, en->cursor)) | |||
{ | { | |||
_edje_emit(rp->edje, "cursor,changed", rp->part->name); | _edje_emit(rp->edje, "cursor,changed", rp->part->name); | |||
_edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); | _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name); | |||
} | } | |||
evas_textblock_cursor_free(tc); | evas_textblock_cursor_free(tc); | |||
skipping to change at line 2249 | skipping to change at line 2379 | |||
ecore_imf_context_del(en->imf_context); | ecore_imf_context_del(en->imf_context); | |||
en->imf_context = NULL; | en->imf_context = NULL; | |||
} | } | |||
edje_object_signal_callback_del(rp->edje->obj, "focus,part,in", rp- >part->name, _edje_entry_focus_in_cb); | edje_object_signal_callback_del(rp->edje->obj, "focus,part,in", rp- >part->name, _edje_entry_focus_in_cb); | |||
edje_object_signal_callback_del(rp->edje->obj, "focus,part,out", rp ->part->name, _edje_entry_focus_out_cb); | edje_object_signal_callback_del(rp->edje->obj, "focus,part,out", rp ->part->name, _edje_entry_focus_out_cb); | |||
ecore_imf_shutdown(); | ecore_imf_shutdown(); | |||
} | } | |||
#endif | #endif | |||
_compose_seq_reset(en); | ||||
free(en); | free(en); | |||
} | } | |||
void | void | |||
_edje_entry_real_part_configure(Edje_Real_Part *rp) | _edje_entry_real_part_configure(Edje_Real_Part *rp) | |||
{ | { | |||
Evas_Coord x, y, w, h, xx, yy, ww, hh; | Evas_Coord x, y, w, h, xx, yy, ww, hh; | |||
Entry *en = rp->entry_data; | Entry *en = rp->entry_data; | |||
Evas_Textblock_Cursor_Type cur_type; | Evas_Textblock_Cursor_Type cur_type; | |||
skipping to change at line 2326 | skipping to change at line 2457 | |||
if (!en) return; | if (!en) return; | |||
_edje_entry_imf_context_reset(rp); | _edje_entry_imf_context_reset(rp); | |||
// set text as markup | // set text as markup | |||
_sel_clear(en->cursor, rp->object, en); | _sel_clear(en->cursor, rp->object, en); | |||
evas_object_textblock_text_markup_set(rp->object, text); | evas_object_textblock_text_markup_set(rp->object, text); | |||
_edje_entry_set_cursor_start(rp); | _edje_entry_set_cursor_start(rp); | |||
_anchors_get(en->cursor, rp->object, en); | _anchors_get(en->cursor, rp->object, en); | |||
_edje_emit(rp->edje, "entry,changed", rp->part->name); | _edje_emit(rp->edje, "entry,changed", rp->part->name); | |||
_edje_entry_imf_cursor_info_set(en); | _edje_entry_imf_cursor_info_set(en); | |||
_edje_entry_real_part_configure(rp); | ||||
#if 0 | #if 0 | |||
/* Don't emit cursor changed cause it didn't. It's just init to 0. */ | /* Don't emit cursor changed cause it didn't. It's just init to 0. */ | |||
_edje_emit(rp->edje, "cursor,changed", rp->part->name); | _edje_emit(rp->edje, "cursor,changed", rp->part->name); | |||
#endif | #endif | |||
} | } | |||
void | void | |||
_edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text) | _edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text) | |||
{ | { | |||
Entry *en = rp->entry_data; | Entry *en = rp->entry_data; | |||
skipping to change at line 2586 | skipping to change at line 2719 | |||
free(tmp); | free(tmp); | |||
} | } | |||
if (en->have_selection) | if (en->have_selection) | |||
{ | { | |||
_range_del_emit(rp->edje, en->cursor, rp->object, en); | _range_del_emit(rp->edje, en->cursor, rp->object, en); | |||
info->merge = EINA_TRUE; | info->merge = EINA_TRUE; | |||
} | } | |||
info->change.insert.pos = evas_textblock_cursor_pos_get(en->cursor); | info->change.insert.pos = evas_textblock_cursor_pos_get(en->cursor); | |||
_text_filter_markup_prepend(en, en->cursor, text); | _text_filter_markup_prepend(en, en->cursor, text); | |||
_anchors_get(en->cursor, rp->object, en); | ||||
_edje_emit(rp->edje, "entry,changed", rp->part->name); | _edje_emit(rp->edje, "entry,changed", rp->part->name); | |||
_edje_emit_full(rp->edje, "entry,changed,user", rp->part->name, | _edje_emit_full(rp->edje, "entry,changed,user", rp->part->name, | |||
info, _free_entry_change_info); | info, _free_entry_change_info); | |||
_edje_emit(rp->edje, "cursor,changed", rp->part->name); | _edje_emit(rp->edje, "cursor,changed", rp->part->name); | |||
} | } | |||
void | void | |||
_edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow) | _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow) | |||
{ | { | |||
Entry *en = rp->entry_data; | Entry *en = rp->entry_data; | |||
skipping to change at line 2754 | skipping to change at line 2888 | |||
Edje_Input_Panel_Lang | Edje_Input_Panel_Lang | |||
_edje_entry_input_panel_language_get(Edje_Real_Part *rp) | _edje_entry_input_panel_language_get(Edje_Real_Part *rp) | |||
{ | { | |||
Entry *en = rp->entry_data; | Entry *en = rp->entry_data; | |||
if (!en) return EDJE_INPUT_PANEL_LANG_AUTOMATIC; | if (!en) return EDJE_INPUT_PANEL_LANG_AUTOMATIC; | |||
return en->input_panel_lang; | return en->input_panel_lang; | |||
} | } | |||
#ifdef HAVE_ECORE_IMF | ||||
void | void | |||
_edje_entry_input_panel_imdata_set(Edje_Real_Part *rp, const void *data, in t len) | _edje_entry_input_panel_imdata_set(Edje_Real_Part *rp, const void *data, in t len) | |||
#else | ||||
void | ||||
_edje_entry_input_panel_imdata_set(Edje_Real_Part *rp, const void *data __U | ||||
NUSED__, int len __UNUSED__) | ||||
#endif | ||||
{ | { | |||
Entry *en = rp->entry_data; | Entry *en = rp->entry_data; | |||
if (!en) return; | if (!en) return; | |||
#ifdef HAVE_ECORE_IMF | #ifdef HAVE_ECORE_IMF | |||
if (en->imf_context) | if (en->imf_context) | |||
ecore_imf_context_input_panel_imdata_set(en->imf_context, data, len); | ecore_imf_context_input_panel_imdata_set(en->imf_context, data, len); | |||
#endif | #endif | |||
} | } | |||
#ifdef HAVE_ECORE_IMF | ||||
void | void | |||
_edje_entry_input_panel_imdata_get(Edje_Real_Part *rp, void *data, int *len ) | _edje_entry_input_panel_imdata_get(Edje_Real_Part *rp, void *data, int *len ) | |||
#else | ||||
void | ||||
_edje_entry_input_panel_imdata_get(Edje_Real_Part *rp, void *data __UNUSED_ | ||||
_, int *len __UNUSED__) | ||||
#endif | ||||
{ | { | |||
Entry *en = rp->entry_data; | Entry *en = rp->entry_data; | |||
if (!en) return; | if (!en) return; | |||
#ifdef HAVE_ECORE_IMF | #ifdef HAVE_ECORE_IMF | |||
if (en->imf_context) | if (en->imf_context) | |||
ecore_imf_context_input_panel_imdata_get(en->imf_context, data, len); | ecore_imf_context_input_panel_imdata_get(en->imf_context, data, len); | |||
#endif | #endif | |||
} | } | |||
#ifdef HAVE_ECORE_IMF | ||||
void | void | |||
_edje_entry_input_panel_return_key_type_set(Edje_Real_Part *rp, Edje_Input_ Panel_Return_Key_Type return_key_type) | _edje_entry_input_panel_return_key_type_set(Edje_Real_Part *rp, Edje_Input_ Panel_Return_Key_Type return_key_type) | |||
#else | ||||
void | ||||
_edje_entry_input_panel_return_key_type_set(Edje_Real_Part *rp, Edje_Input_ | ||||
Panel_Return_Key_Type return_key_type __UNUSED__) | ||||
#endif | ||||
{ | { | |||
Entry *en = rp->entry_data; | Entry *en = rp->entry_data; | |||
if (!en) return; | if (!en) return; | |||
#ifdef HAVE_ECORE_IMF | #ifdef HAVE_ECORE_IMF | |||
if (en->imf_context) | if (en->imf_context) | |||
ecore_imf_context_input_panel_return_key_type_set(en->imf_context, ret urn_key_type); | ecore_imf_context_input_panel_return_key_type_set(en->imf_context, ret urn_key_type); | |||
#endif | #endif | |||
} | } | |||
Edje_Input_Panel_Return_Key_Type | Edje_Input_Panel_Return_Key_Type | |||
skipping to change at line 2799 | skipping to change at line 2948 | |||
{ | { | |||
Entry *en = rp->entry_data; | Entry *en = rp->entry_data; | |||
if (!en) return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; | if (!en) return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; | |||
#ifdef HAVE_ECORE_IMF | #ifdef HAVE_ECORE_IMF | |||
if (en->imf_context) | if (en->imf_context) | |||
return ecore_imf_context_input_panel_return_key_type_get(en->imf_conte xt); | return ecore_imf_context_input_panel_return_key_type_get(en->imf_conte xt); | |||
#endif | #endif | |||
return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; | return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; | |||
} | } | |||
#ifdef HAVE_ECORE_IMF | ||||
void | void | |||
_edje_entry_input_panel_return_key_disabled_set(Edje_Real_Part *rp, Eina_Bo ol disabled) | _edje_entry_input_panel_return_key_disabled_set(Edje_Real_Part *rp, Eina_Bo ol disabled) | |||
#else | ||||
void | ||||
_edje_entry_input_panel_return_key_disabled_set(Edje_Real_Part *rp, Eina_Bo | ||||
ol disabled __UNUSED__) | ||||
#endif | ||||
{ | { | |||
Entry *en = rp->entry_data; | Entry *en = rp->entry_data; | |||
if (!en) return; | if (!en) return; | |||
#ifdef HAVE_ECORE_IMF | #ifdef HAVE_ECORE_IMF | |||
if (en->imf_context) | if (en->imf_context) | |||
ecore_imf_context_input_panel_return_key_disabled_set(en->imf_context, disabled); | ecore_imf_context_input_panel_return_key_disabled_set(en->imf_context, disabled); | |||
#endif | #endif | |||
} | } | |||
Eina_Bool | Eina_Bool | |||
skipping to change at line 3256 | skipping to change at line 3410 | |||
{ | { | |||
_text_filter_format_prepend(en, en->cursor, "+ password=off"); | _text_filter_format_prepend(en, en->cursor, "+ password=off"); | |||
_text_filter_text_prepend(en, en->cursor, commit_str); | _text_filter_text_prepend(en, en->cursor, commit_str); | |||
_text_filter_format_prepend(en, en->cursor, "- password"); | _text_filter_format_prepend(en, en->cursor, "- password"); | |||
if (en->pw_timer) | if (en->pw_timer) | |||
{ | { | |||
ecore_timer_del(en->pw_timer); | ecore_timer_del(en->pw_timer); | |||
en->pw_timer = NULL; | en->pw_timer = NULL; | |||
} | } | |||
en->pw_timer = ecore_timer_add(_edje_password_show_last_timeout, | en->pw_timer = ecore_timer_add(TO_DOUBLE(_edje_password_show_last_t imeout), | |||
_password_timer_cb, en); | _password_timer_cb, en); | |||
} | } | |||
else | else | |||
_text_filter_text_prepend(en, en->cursor, commit_str); | _text_filter_text_prepend(en, en->cursor, commit_str); | |||
_edje_entry_imf_cursor_info_set(en); | _edje_entry_imf_cursor_info_set(en); | |||
_anchors_get(en->cursor, rp->object, en); | _anchors_get(en->cursor, rp->object, en); | |||
_edje_emit(rp->edje, "entry,changed", rp->part->name); | _edje_emit(rp->edje, "entry,changed", rp->part->name); | |||
{ | { | |||
skipping to change at line 3348 | skipping to change at line 3502 | |||
else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB 2 || | else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB 2 || | |||
attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB 3) | attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB 3) | |||
{ | { | |||
eina_strbuf_append(buf, "<preedit_sel>"); | eina_strbuf_append(buf, "<preedit_sel>"); | |||
eina_strbuf_append_n(buf, preedit_string + attr->sta rt_index, | eina_strbuf_append_n(buf, preedit_string + attr->sta rt_index, | |||
attr->end_index - attr->start_i ndex); | attr->end_index - attr->start_i ndex); | |||
eina_strbuf_append(buf, "</preedit_sel>"); | eina_strbuf_append(buf, "</preedit_sel>"); | |||
} | } | |||
} | } | |||
} | } | |||
else | ||||
{ | ||||
eina_strbuf_append(buf, preedit_string); | ||||
} | ||||
if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) && | if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) && | |||
_edje_password_show_last) | _edje_password_show_last) | |||
{ | { | |||
_edje_entry_hide_visible_password(en->rp); | _edje_entry_hide_visible_password(en->rp); | |||
_text_filter_format_prepend(en, en->cursor, "+ password=off"); | _text_filter_format_prepend(en, en->cursor, "+ password=off"); | |||
_text_filter_markup_prepend(en, en->cursor, eina_strbuf_string _get(buf)); | _text_filter_markup_prepend(en, en->cursor, eina_strbuf_string _get(buf)); | |||
_text_filter_format_prepend(en, en->cursor, "- password"); | _text_filter_format_prepend(en, en->cursor, "- password"); | |||
if (en->pw_timer) | if (en->pw_timer) | |||
{ | { | |||
ecore_timer_del(en->pw_timer); | ecore_timer_del(en->pw_timer); | |||
en->pw_timer = NULL; | en->pw_timer = NULL; | |||
} | } | |||
en->pw_timer = ecore_timer_add(_edje_password_show_last_timeou t, | en->pw_timer = ecore_timer_add(TO_DOUBLE(_edje_password_show_l ast_timeout), | |||
_password_timer_cb, en); | _password_timer_cb, en); | |||
} | } | |||
else | else | |||
{ | { | |||
_text_filter_markup_prepend(en, en->cursor, eina_strbuf_string _get(buf)); | _text_filter_markup_prepend(en, en->cursor, eina_strbuf_string _get(buf)); | |||
} | } | |||
eina_strbuf_free(buf); | eina_strbuf_free(buf); | |||
} | } | |||
if (!preedit_end_state) | if (!preedit_end_state) | |||
End of changes. 65 change blocks. | ||||
77 lines changed or deleted | 244 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |