diff options
-rw-r--r-- | apps/gui/wps.c | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 29c9403235..30c4aa85bb 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -599,15 +599,53 @@ int wps_get_touchaction(struct wps_data *data) | |||
599 | if (vx >= r->x && vx < r->x+r->width && | 599 | if (vx >= r->x && vx < r->x+r->width && |
600 | vy >= r->y && vy < r->y+r->height) | 600 | vy >= r->y && vy < r->y+r->height) |
601 | { | 601 | { |
602 | if ((repeated && r->repeat) || | 602 | /* reposition the touch within the area */ |
603 | (released && !r->repeat)) | 603 | vx -= r->x; |
604 | vy -= r->y; | ||
605 | |||
606 | switch(r->type) | ||
604 | { | 607 | { |
605 | last_action = r->action; | 608 | case WPS_TOUCHREGION_ACTION: |
606 | return r->action; | 609 | if ((repeated && r->repeat) || (released && !r->repeat)) |
607 | } | 610 | { |
611 | last_action = r->action; | ||
612 | return r->action; | ||
613 | } | ||
614 | break; | ||
615 | case WPS_TOUCHREGION_SCROLLBAR: | ||
616 | if(r->width > r->height) | ||
617 | /* landscape */ | ||
618 | wps_state.id3->elapsed = (vx * | ||
619 | wps_state.id3->length) / r->width; | ||
620 | else | ||
621 | /* portrait */ | ||
622 | wps_state.id3->elapsed = (vy * | ||
623 | wps_state.id3->length) / r->height; | ||
624 | |||
625 | audio_ff_rewind(wps_state.id3->elapsed); | ||
626 | break; | ||
627 | case WPS_TOUCHREGION_VOLUME: | ||
628 | { | ||
629 | const int min_vol = sound_min(SOUND_VOLUME); | ||
630 | const int max_vol = sound_max(SOUND_VOLUME); | ||
631 | if(r->width > r->height) | ||
632 | /* landscape */ | ||
633 | global_settings.volume = (vx * | ||
634 | (max_vol - min_vol)) / r->width; | ||
635 | else | ||
636 | /* portrait */ | ||
637 | global_settings.volume = (vy * | ||
638 | (max_vol-min_vol)) / r->height; | ||
639 | |||
640 | global_settings.volume += min_vol; | ||
641 | setvol(); | ||
642 | break; | ||
643 | } | ||
644 | } | ||
608 | } | 645 | } |
609 | } | 646 | } |
610 | } | 647 | } |
648 | |||
611 | if ((last_action == ACTION_WPS_SEEKBACK || last_action == ACTION_WPS_SEEKFWD)) | 649 | if ((last_action == ACTION_WPS_SEEKBACK || last_action == ACTION_WPS_SEEKFWD)) |
612 | return ACTION_WPS_STOPSEEK; | 650 | return ACTION_WPS_STOPSEEK; |
613 | last_action = ACTION_TOUCHSCREEN; | 651 | last_action = ACTION_TOUCHSCREEN; |