touchscreen: Allow volume bars to be used in the .sbs

Move the volume bar input handling to skin_touchsupport.c so
volume bars can be used in the .sbs as well as the .wps skin.

Change-Id: I018fa1c84f93b64d676b68e3bea63ddb9141e492
This commit is contained in:
Aidan MacDonald 2021-08-21 17:48:48 +01:00
parent e3e0c7b73c
commit 9b5b9d6a6d
2 changed files with 13 additions and 11 deletions

View file

@ -203,6 +203,19 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset)
action = ACTION_TOUCH_SCROLLBAR_END; action = ACTION_TOUCH_SCROLLBAR_END;
break; break;
case ACTION_TOUCH_VOLUME:
{
const int min_vol = sound_min(SOUND_VOLUME);
const int max_vol = sound_max(SOUND_VOLUME);
const int step_vol = sound_steps(SOUND_VOLUME);
global_status.volume = from_normalized_volume(*edge_offset, min_vol, max_vol, 1000);
global_status.volume -= (global_status.volume % step_vol);
setvol();
action = ACTION_TOUCHSCREEN;
} break;
case ACTION_TOUCH_SOFTLOCK: case ACTION_TOUCH_SOFTLOCK:
data->touchscreen_locked = !data->touchscreen_locked; data->touchscreen_locked = !data->touchscreen_locked;
action = ACTION_NONE; action = ACTION_NONE;

View file

@ -205,17 +205,6 @@ static int skintouch_to_wps(void)
audio_pre_ff_rewind(); audio_pre_ff_rewind();
audio_ff_rewind(gstate->id3->elapsed); audio_ff_rewind(gstate->id3->elapsed);
return ACTION_TOUCHSCREEN; return ACTION_TOUCHSCREEN;
case ACTION_TOUCH_VOLUME:
{
const int min_vol = sound_min(SOUND_VOLUME);
const int max_vol = sound_max(SOUND_VOLUME);
const int step_vol = sound_steps(SOUND_VOLUME);
global_status.volume = from_normalized_volume(offset, min_vol, max_vol, 1000);
global_status.volume -= (global_status.volume % step_vol);
setvol();
}
return ACTION_TOUCHSCREEN;
} }
return button; return button;
} }