1
0
Fork 0
forked from len0rd/rockbox

r22135 overwrote mcuelenaere's changes in r22068 to add slider-type regions for the touchscreen... so bring them back (spotted by kkurbjun)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22234 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2009-08-10 03:48:27 +00:00
parent e1a83b9e99
commit 1c0aeb18ca

View file

@ -599,15 +599,53 @@ int wps_get_touchaction(struct wps_data *data)
if (vx >= r->x && vx < r->x+r->width &&
vy >= r->y && vy < r->y+r->height)
{
if ((repeated && r->repeat) ||
(released && !r->repeat))
/* reposition the touch within the area */
vx -= r->x;
vy -= r->y;
switch(r->type)
{
last_action = r->action;
return r->action;
case WPS_TOUCHREGION_ACTION:
if ((repeated && r->repeat) || (released && !r->repeat))
{
last_action = r->action;
return r->action;
}
break;
case WPS_TOUCHREGION_SCROLLBAR:
if(r->width > r->height)
/* landscape */
wps_state.id3->elapsed = (vx *
wps_state.id3->length) / r->width;
else
/* portrait */
wps_state.id3->elapsed = (vy *
wps_state.id3->length) / r->height;
audio_ff_rewind(wps_state.id3->elapsed);
break;
case WPS_TOUCHREGION_VOLUME:
{
const int min_vol = sound_min(SOUND_VOLUME);
const int max_vol = sound_max(SOUND_VOLUME);
if(r->width > r->height)
/* landscape */
global_settings.volume = (vx *
(max_vol - min_vol)) / r->width;
else
/* portrait */
global_settings.volume = (vy *
(max_vol-min_vol)) / r->height;
global_settings.volume += min_vol;
setvol();
break;
}
}
}
}
}
if ((last_action == ACTION_WPS_SEEKBACK || last_action == ACTION_WPS_SEEKFWD))
return ACTION_WPS_STOPSEEK;
last_action = ACTION_TOUCHSCREEN;