diff options
author | Uros Majstorovic <majstor@majstor.org> | 2021-03-28 16:51:56 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2021-03-28 16:51:56 +0200 |
commit | cd7d67b9a801f6446c2546ec89f71a6019432b68 (patch) | |
tree | 44f849f68584060cbdea9ac3d103ab814c6c1929 /fw/fe310/eos/eve/widget/textw.c | |
parent | daa87d92b3df433578e53284a8c88083e24f8623 (diff) |
fixed cursor handling in strw and textw
Diffstat (limited to 'fw/fe310/eos/eve/widget/textw.c')
-rw-r--r-- | fw/fe310/eos/eve/widget/textw.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/fw/fe310/eos/eve/widget/textw.c b/fw/fe310/eos/eve/widget/textw.c index e17351c..abf2a68 100644 --- a/fw/fe310/eos/eve/widget/textw.c +++ b/fw/fe310/eos/eve/widget/textw.c @@ -257,27 +257,30 @@ int eve_textw_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt) { } } - if ((evt & EVE_TOUCH_ETYPE_TRACK) && widget->track.cursor) { - eve_textw_cursor_set(widget, widget->track.cursor, touch->tag + widget->track.dl, eve_page_x(page, touch->x) + widget->track.dx); + if (widget->track.cursor) { + if (evt & EVE_TOUCH_ETYPE_TRACK) eve_textw_cursor_set(widget, widget->track.cursor, touch->tag + widget->track.dl, eve_page_x(page, touch->x) + widget->track.dx); ret = 1; - } else if (evt & EVE_TOUCH_ETYPE_LPRESS) { - if (widget->cursor2.on) { - // copy - } else if (widget->cursor1.on) { - if (t_cursor && (dl == 0)) { - // paste + } else { + if (evt & EVE_TOUCH_ETYPE_LPRESS) { + if (widget->cursor2.on) { + // copy + } else if (widget->cursor1.on) { + if (t_cursor && (dl == 0)) { + // paste + } else { + eve_textw_cursor_set(widget, &widget->cursor2, touch->tag, eve_page_x(page, touch->x)); + } } else { - eve_textw_cursor_set(widget, &widget->cursor2, touch->tag, eve_page_x(page, touch->x)); + // select } - } else { - // select + ret = 1; + } + if ((evt & EVE_TOUCH_ETYPE_POINT_UP) && !(touch->eevt & (EVE_TOUCH_EETYPE_TRACK_XY | EVE_TOUCH_EETYPE_ABORT | EVE_TOUCH_EETYPE_LPRESS))) { + eve_textw_cursor_set(widget, &widget->cursor1, touch->tag_up, eve_page_x(page, touch->x0)); + if (widget->cursor2.on) eve_textw_cursor_clear(widget, &widget->cursor2); + set_focus(widget, &widget->cursor1); + ret = 1; } - ret = 1; - } else if ((evt & EVE_TOUCH_ETYPE_POINT_UP) && !(touch->eevt & EVE_TOUCH_EETYPE_LPRESS)) { - eve_textw_cursor_set(widget, &widget->cursor1, touch->tag_up, eve_page_x(page, touch->x0)); - if (widget->cursor2.on) eve_textw_cursor_clear(widget, &widget->cursor2); - set_focus(widget, &widget->cursor1); - ret = 1; } if (evt & EVE_TOUCH_ETYPE_TRACK_STOP) { |