summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/screen
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2023-04-30 20:50:41 +0200
committerUros Majstorovic <majstor@majstor.org>2023-04-30 20:50:41 +0200
commitb57e45a19ba49efa1cb754c1e5258588405b7a30 (patch)
tree0b5d94eb35d94050cc182f508e43740f8d88c929 /fw/fe310/eos/eve/screen
parent1628a3f248f7d2a32029ab5d6dae00deb0d4906c (diff)
fixed text widget
Diffstat (limited to 'fw/fe310/eos/eve/screen')
-rw-r--r--fw/fe310/eos/eve/screen/page.c171
1 files changed, 84 insertions, 87 deletions
diff --git a/fw/fe310/eos/eve/screen/page.c b/fw/fe310/eos/eve/screen/page.c
index 9cbc638..93b81c5 100644
--- a/fw/fe310/eos/eve/screen/page.c
+++ b/fw/fe310/eos/eve/screen/page.c
@@ -204,91 +204,89 @@ static int page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0
} else if (page->opt & EVE_PAGE_OPT_SCROLL_Y) {
scroll_y = (touch->eevt & EVE_TOUCH_EETYPE_TRACK_Y);
}
- }
-
- scroll = scroll_x || scroll_y;
-
- if ((evt & EVE_TOUCH_ETYPE_POINT_UP) && !(touch->eevt & (EVE_TOUCH_EETYPE_TRACK_XY | EVE_TOUCH_EETYPE_ABORT))) {
- int _ret = 0;
- eve_page_set_focus(page, NULL);
- _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_TOUCH, touch, evt, tag0);
- if (_ret) return _ret;
- ret = 1;
- }
+ scroll = scroll_x || scroll_y;
- /* Scroll / track start */
- if ((evt & EVE_TOUCH_ETYPE_TRACK_START) && !(touch->eevt & EVE_TOUCH_EETYPE_ABORT)) {
- int _ret = 0;
-
- if (scroll) {
- page->track_mode = PAGE_TMODE_SCROLL;
- eve_window_scroll_start(window, touch->tracker.tag);
- _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_SCROLL_START, touch, evt, tag0);
- } else {
- page->track_mode = PAGE_TMODE_TRACK;
- _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_TRACK_START, touch, evt, tag0);
- }
- if (_ret) return _ret;
- ret = 1;
- }
-
- /* Scroll / track stop */
- if (((evt & EVE_TOUCH_ETYPE_TRACK_STOP) && !(evt & EVE_TOUCH_ETYPE_TRACK_ABORT)) ||
- ((evt & EVE_TOUCH_ETYPE_POINT_UP) && (touch->eevt & EVE_TOUCH_EETYPE_ABORT) && !(touch->eevt & EVE_TOUCH_EETYPE_TRACK_XY))) {
- if ((page->track_mode == PAGE_TMODE_SCROLL) && (page->opt & EVE_PAGE_OPT_SCROLL_BACK)) {
- int max_x, max_y;
- int oob;
-
- oob = eve_page_oob(page, &max_x, &max_y);
- if (oob) {
- int lho_x, lho_y;
- uint8_t _tag;
- EVEPhyLHO *lho = &page->lho;
-
- lho_x = page->g.x < 0 ? 0 : max_x;
- lho_y = page->g.y < 0 ? 0 : max_y;
- eve_window_scroll(window->root, &_tag);
-
- page->lho_t0 = eve_get_tick();
- eve_phy_lho_init(lho, lho_x, lho_y, 100, 0.5, 0);
- eve_phy_lho_start(lho, page->g.x, page->g.y);
- eve_timer_start(_tag, 20);
- }
- }
-
- if (!eve_timer_running()) {
+ if ((tag0 == page->v.tag) && (evt & EVE_TOUCH_ETYPE_POINT_UP) && !(touch->eevt & (EVE_TOUCH_EETYPE_TRACK_XY | EVE_TOUCH_EETYPE_ABORT))) {
int _ret = 0;
- switch (page->track_mode) {
- case PAGE_TMODE_SCROLL: {
- page->track_mode = PAGE_TMODE_NONE;
- eve_window_scroll_stop(window);
- _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_SCROLL_STOP, touch, evt, tag0);
- break;
- }
-
- case PAGE_TMODE_TRACK: {
- page->track_mode = PAGE_TMODE_NONE;
- _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_TRACK_STOP, touch, evt, tag0);
- break;
- }
- }
+ eve_page_set_focus(page, NULL);
+ _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_TOUCH, touch, evt, tag0);
if (_ret) return _ret;
ret = 1;
}
- }
- if (page->track_mode == PAGE_TMODE_SCROLL) {
+ /* Scroll / track start */
if (evt & EVE_TOUCH_ETYPE_TRACK_START) {
+ int _ret = 0;
+
+ if (!(touch->eevt & EVE_TOUCH_EETYPE_ABORT)) {
+ if (scroll) {
+ page->track_mode = PAGE_TMODE_SCROLL;
+ eve_window_scroll_start(window, touch->tracker.tag);
+ _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_SCROLL_START, touch, evt, tag0);
+ } else {
+ page->track_mode = PAGE_TMODE_TRACK;
+ _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_TRACK_START, touch, evt, tag0);
+ }
+ if (_ret) return _ret;
+ }
if (scroll_x) {
page->x0 = page->g.x;
}
if (scroll_y) {
page->y0 = page->g.y;
}
+ ret = 1;
}
- if (evt & EVE_TOUCH_ETYPE_TRACK) {
+
+ /* Scroll / track stop */
+ if (((evt & EVE_TOUCH_ETYPE_TRACK_STOP) && !(evt & EVE_TOUCH_ETYPE_TRACK_ABORT)) ||
+ ((evt & EVE_TOUCH_ETYPE_POINT_UP) && (touch->eevt & EVE_TOUCH_EETYPE_ABORT) && !(touch->eevt & EVE_TOUCH_EETYPE_TRACK_XY))) {
+ if ((page->track_mode == PAGE_TMODE_SCROLL) && (page->opt & EVE_PAGE_OPT_SCROLL_BACK)) {
+ int max_x, max_y;
+ int oob;
+
+ oob = eve_page_oob(page, &max_x, &max_y);
+ if (oob) {
+ int lho_x, lho_y;
+ uint8_t _tag;
+ EVEPhyLHO *lho = &page->lho;
+
+ lho_x = page->g.x < 0 ? 0 : max_x;
+ lho_y = page->g.y < 0 ? 0 : max_y;
+ eve_window_scroll(window->root, &_tag);
+
+ page->lho_t0 = eve_get_tick();
+ eve_phy_lho_init(lho, lho_x, lho_y, 100, 0.5, 0);
+ eve_phy_lho_start(lho, page->g.x, page->g.y);
+ eve_timer_start(_tag, 20);
+ }
+ }
+
+ if (!eve_timer_running()) {
+ int _ret = 0;
+
+ switch (page->track_mode) {
+ case PAGE_TMODE_SCROLL: {
+ page->track_mode = PAGE_TMODE_NONE;
+ eve_window_scroll_stop(window);
+ _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_SCROLL_STOP, touch, evt, tag0);
+ break;
+ }
+
+ case PAGE_TMODE_TRACK: {
+ page->track_mode = PAGE_TMODE_NONE;
+ _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_TRACK_STOP, touch, evt, tag0);
+ break;
+ }
+ }
+ if (_ret) return _ret;
+ }
+ ret = 1;
+ }
+
+ if ((evt & EVE_TOUCH_ETYPE_TRACK) && (page->track_mode == PAGE_TMODE_SCROLL)) {
if (scroll_x) {
page->g.x = page->x0 + touch->x0 - touch->x;
}
@@ -297,26 +295,25 @@ static int page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0
}
ret = 1;
}
- if ((evt & EVE_TOUCH_ETYPE_TIMER) && (page->opt & EVE_PAGE_OPT_SCROLL_BACK)) {
- EVEPhyLHO *lho = &page->lho;
- int scroll_x = page->opt & EVE_PAGE_OPT_SCROLL_X;
- int scroll_y = page->opt & EVE_PAGE_OPT_SCROLL_Y;
- int x, y, more;
-
- more = eve_phy_lho_tick(lho, eve_get_tick() - page->lho_t0, scroll_x ? &x : NULL, scroll_y ? &y : NULL);
- if (scroll_x) page->g.x = x;
- if (scroll_y) page->g.y = y;
- if (!more) {
- int _ret = 0;
+ } else if ((evt & EVE_TOUCH_ETYPE_TIMER) && (page->track_mode == PAGE_TMODE_SCROLL) && (page->opt & EVE_PAGE_OPT_SCROLL_BACK)) {
+ EVEPhyLHO *lho = &page->lho;
+ int scroll_x = page->opt & EVE_PAGE_OPT_SCROLL_X;
+ int scroll_y = page->opt & EVE_PAGE_OPT_SCROLL_Y;
+ int x, y, more;
+
+ more = eve_phy_lho_tick(lho, eve_get_tick() - page->lho_t0, scroll_x ? &x : NULL, scroll_y ? &y : NULL);
+ if (scroll_x) page->g.x = x;
+ if (scroll_y) page->g.y = y;
+ if (!more) {
+ int _ret = 0;
- page->track_mode = PAGE_TMODE_NONE;
- eve_timer_stop();
- eve_window_scroll_stop(window);
- _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_SCROLL_STOP, touch, evt, tag0);
- if (_ret) return _ret;
- }
- ret = 1;
+ page->track_mode = PAGE_TMODE_NONE;
+ eve_timer_stop();
+ eve_window_scroll_stop(window);
+ _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_SCROLL_STOP, touch, evt, tag0);
+ if (_ret) return _ret;
}
+ ret = 1;
}
return ret;