diff options
Diffstat (limited to 'apps/gui/wps.c')
-rw-r--r-- | apps/gui/wps.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 6afed43213..c58181ed36 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -86,6 +86,10 @@ static void wps_state_init(void); | |||
86 | static void track_changed_callback(void *param); | 86 | static void track_changed_callback(void *param); |
87 | static void nextid3available_callback(void* param); | 87 | static void nextid3available_callback(void* param); |
88 | 88 | ||
89 | #ifdef HAVE_TOUCHSCREEN | ||
90 | static void wps_disarm_touchregions(struct wps_data *data); | ||
91 | #endif | ||
92 | |||
89 | #define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" | 93 | #define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" |
90 | #ifdef HAVE_REMOTE_LCD | 94 | #ifdef HAVE_REMOTE_LCD |
91 | #define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps" | 95 | #define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps" |
@@ -623,14 +627,30 @@ static void gwps_enter_wps(void) | |||
623 | #endif | 627 | #endif |
624 | display->clear_display(); | 628 | display->clear_display(); |
625 | skin_update(gwps, WPS_REFRESH_ALL); | 629 | skin_update(gwps, WPS_REFRESH_ALL); |
630 | |||
631 | #ifdef HAVE_TOUCHSCREEN | ||
632 | wps_disarm_touchregions(gui_wps[i].data); | ||
633 | #endif | ||
626 | } | 634 | } |
627 | /* force statusbar/skin update since we just cleared the whole screen */ | 635 | /* force statusbar/skin update since we just cleared the whole screen */ |
628 | send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); | 636 | send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); |
629 | } | 637 | } |
630 | 638 | ||
631 | #ifdef HAVE_TOUCHSCREEN | 639 | #ifdef HAVE_TOUCHSCREEN |
640 | /** Disarms all touchregions. */ | ||
641 | static void wps_disarm_touchregions(struct wps_data *data) | ||
642 | { | ||
643 | struct skin_token_list *regions = data->touchregions; | ||
644 | while (regions) | ||
645 | { | ||
646 | ((struct touchregion *)regions->token->value.data)->armed = false; | ||
647 | regions = regions->next; | ||
648 | } | ||
649 | } | ||
650 | |||
632 | int wps_get_touchaction(struct wps_data *data) | 651 | int wps_get_touchaction(struct wps_data *data) |
633 | { | 652 | { |
653 | int returncode = ACTION_NONE; | ||
634 | short x,y; | 654 | short x,y; |
635 | short vx, vy; | 655 | short vx, vy; |
636 | int type = action_get_touchscreen_press(&x, &y); | 656 | int type = action_get_touchscreen_press(&x, &y); |
@@ -638,7 +658,9 @@ int wps_get_touchaction(struct wps_data *data) | |||
638 | struct touchregion *r; | 658 | struct touchregion *r; |
639 | bool repeated = (type == BUTTON_REPEAT); | 659 | bool repeated = (type == BUTTON_REPEAT); |
640 | bool released = (type == BUTTON_REL); | 660 | bool released = (type == BUTTON_REL); |
661 | bool pressed = (type == BUTTON_TOUCHSCREEN); | ||
641 | struct skin_token_list *regions = data->touchregions; | 662 | struct skin_token_list *regions = data->touchregions; |
663 | |||
642 | while (regions) | 664 | while (regions) |
643 | { | 665 | { |
644 | r = (struct touchregion *)regions->token->value.data; | 666 | r = (struct touchregion *)regions->token->value.data; |
@@ -665,11 +687,13 @@ int wps_get_touchaction(struct wps_data *data) | |||
665 | switch(r->type) | 687 | switch(r->type) |
666 | { | 688 | { |
667 | case WPS_TOUCHREGION_ACTION: | 689 | case WPS_TOUCHREGION_ACTION: |
668 | if ((repeated && r->repeat) || (released && !r->repeat)) | 690 | if (r->armed && ((repeated && r->repeat) || (released && !r->repeat))) |
669 | { | 691 | { |
670 | last_action = r->action; | 692 | last_action = r->action; |
671 | return r->action; | 693 | returncode = r->action; |
672 | } | 694 | } |
695 | if (pressed) | ||
696 | r->armed = true; | ||
673 | break; | 697 | break; |
674 | case WPS_TOUCHREGION_SCROLLBAR: | 698 | case WPS_TOUCHREGION_SCROLLBAR: |
675 | if(r->width > r->height) | 699 | if(r->width > r->height) |
@@ -708,7 +732,7 @@ int wps_get_touchaction(struct wps_data *data) | |||
708 | 732 | ||
709 | global_settings.volume += min_vol; | 733 | global_settings.volume += min_vol; |
710 | setvol(); | 734 | setvol(); |
711 | return ACTION_REDRAW; | 735 | returncode = ACTION_REDRAW; |
712 | } | 736 | } |
713 | } | 737 | } |
714 | } | 738 | } |
@@ -716,6 +740,13 @@ int wps_get_touchaction(struct wps_data *data) | |||
716 | regions = regions->next; | 740 | regions = regions->next; |
717 | } | 741 | } |
718 | 742 | ||
743 | /* On release, all regions are disarmed. */ | ||
744 | if (released) | ||
745 | wps_disarm_touchregions(data); | ||
746 | |||
747 | if (returncode != ACTION_NONE) | ||
748 | return returncode; | ||
749 | |||
719 | if ((last_action == ACTION_WPS_SEEKBACK || last_action == ACTION_WPS_SEEKFWD)) | 750 | if ((last_action == ACTION_WPS_SEEKBACK || last_action == ACTION_WPS_SEEKFWD)) |
720 | return ACTION_WPS_STOPSEEK; | 751 | return ACTION_WPS_STOPSEEK; |
721 | last_action = ACTION_TOUCHSCREEN; | 752 | last_action = ACTION_TOUCHSCREEN; |