forked from enlightenment/efl
edje_entry.c: When cursor is located to each edge, entry now doesn't grab events for cursor movement.
This commit is contained in:
parent
bf8a49d9a2
commit
9a64a3b46e
|
@ -457,7 +457,7 @@ _curs_end(Evas_Textblock_Cursor *c, Evas_Object *o EINA_UNUSED, Entry *en EINA_U
|
||||||
evas_textblock_cursor_paragraph_last(c);
|
evas_textblock_cursor_paragraph_last(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln)
|
_curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln)
|
||||||
{
|
{
|
||||||
Evas_Coord cx, cy;
|
Evas_Coord cx, cy;
|
||||||
|
@ -473,9 +473,9 @@ _curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln)
|
||||||
_curs_update_from_curs(c, o, en, &cx, &cy);
|
_curs_update_from_curs(c, o, en, &cx, &cy);
|
||||||
|
|
||||||
if (!evas_object_textblock_line_number_geometry_get(o, ln, &lx, &ly, &lw, &lh))
|
if (!evas_object_textblock_line_number_geometry_get(o, ln, &lx, &ly, &lw, &lh))
|
||||||
return;
|
return EINA_FALSE;
|
||||||
if (evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
|
if (evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
|
||||||
return;
|
return EINA_FALSE;
|
||||||
evas_textblock_cursor_line_set(c, ln);
|
evas_textblock_cursor_line_set(c, ln);
|
||||||
if (cx < (lx + (lw / 2)))
|
if (cx < (lx + (lw / 2)))
|
||||||
{
|
{
|
||||||
|
@ -489,27 +489,28 @@ _curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln)
|
||||||
else
|
else
|
||||||
_curs_lin_end(c, o, en);
|
_curs_lin_end(c, o, en);
|
||||||
}
|
}
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_curs_jump_line_by(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int by)
|
_curs_jump_line_by(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int by)
|
||||||
{
|
{
|
||||||
int ln;
|
int ln;
|
||||||
|
|
||||||
ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL) + by;
|
ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL) + by;
|
||||||
_curs_jump_line(c, o, en, ln);
|
return _curs_jump_line(c, o, en, ln);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_curs_up(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
_curs_up(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
||||||
{
|
{
|
||||||
_curs_jump_line_by(c, o, en, -1);
|
return _curs_jump_line_by(c, o, en, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_curs_down(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
_curs_down(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
||||||
{
|
{
|
||||||
_curs_jump_line_by(c, o, en, 1);
|
return _curs_jump_line_by(c, o, en, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1348,13 +1349,13 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
if (shift) _sel_start(en->cursor, rp->object, en);
|
if (shift) _sel_start(en->cursor, rp->object, en);
|
||||||
else _sel_clear(ed, en->cursor, rp->object, en);
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
||||||
}
|
}
|
||||||
_curs_up(en->cursor, rp->object, en);
|
if (_curs_up(en->cursor, rp->object, en))
|
||||||
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||||
if (en->select_allow)
|
if (en->select_allow)
|
||||||
{
|
{
|
||||||
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
||||||
else _sel_clear(ed, en->cursor, rp->object, en);
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
||||||
}
|
}
|
||||||
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(ed, "cursor,changed,manual", rp->part->name);
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
||||||
|
@ -1370,13 +1371,13 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
if (shift) _sel_start(en->cursor, rp->object, en);
|
if (shift) _sel_start(en->cursor, rp->object, en);
|
||||||
else _sel_clear(ed, en->cursor, rp->object, en);
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
||||||
}
|
}
|
||||||
_curs_down(en->cursor, rp->object, en);
|
if (_curs_down(en->cursor, rp->object, en))
|
||||||
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||||
if (en->select_allow)
|
if (en->select_allow)
|
||||||
{
|
{
|
||||||
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
||||||
else _sel_clear(ed, en->cursor, rp->object, en);
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
||||||
}
|
}
|
||||||
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(ed, "cursor,changed,manual", rp->part->name);
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
||||||
|
@ -1390,7 +1391,8 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
if (shift) _sel_start(en->cursor, rp->object, en);
|
if (shift) _sel_start(en->cursor, rp->object, en);
|
||||||
else _sel_clear(ed, en->cursor, rp->object, en);
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
||||||
}
|
}
|
||||||
evas_textblock_cursor_char_prev(en->cursor);
|
if (evas_textblock_cursor_char_prev(en->cursor))
|
||||||
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||||
/* 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)
|
||||||
|
@ -1400,7 +1402,6 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
}
|
}
|
||||||
_edje_emit(ed, "entry,key,left", rp->part->name);
|
_edje_emit(ed, "entry,key,left", rp->part->name);
|
||||||
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
||||||
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))
|
||||||
|
@ -1413,7 +1414,8 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
}
|
}
|
||||||
/* If control is pressed, go to the end 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);
|
if (evas_textblock_cursor_char_next(en->cursor))
|
||||||
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||||
if (en->select_allow)
|
if (en->select_allow)
|
||||||
{
|
{
|
||||||
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
||||||
|
@ -1421,7 +1423,6 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
}
|
}
|
||||||
_edje_emit(ed, "entry,key,right", rp->part->name);
|
_edje_emit(ed, "entry,key,right", rp->part->name);
|
||||||
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
||||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
||||||
}
|
}
|
||||||
else if (!strcmp(ev->keyname, "BackSpace"))
|
else if (!strcmp(ev->keyname, "BackSpace"))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue