From 9b5b9d6a6dc2358d321bc4b5032d44dc515932e9 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 21 Aug 2021 17:48:48 +0100 Subject: [PATCH] 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 --- apps/gui/skin_engine/skin_touchsupport.c | 13 +++++++++++++ apps/gui/wps.c | 11 ----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c index 719e5513b6..edb1a7b1a2 100644 --- a/apps/gui/skin_engine/skin_touchsupport.c +++ b/apps/gui/skin_engine/skin_touchsupport.c @@ -203,6 +203,19 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset) action = ACTION_TOUCH_SCROLLBAR_END; 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: data->touchscreen_locked = !data->touchscreen_locked; action = ACTION_NONE; diff --git a/apps/gui/wps.c b/apps/gui/wps.c index c39d8afc4c..4e3fd2d6cb 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -205,17 +205,6 @@ static int skintouch_to_wps(void) audio_pre_ff_rewind(); audio_ff_rewind(gstate->id3->elapsed); 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; }