diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-06-16 13:55:35 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-06-22 21:37:02 +0100 |
commit | 02860d67c3c2807e3c9fd7d272ce9cc098c052ae (patch) | |
tree | 381e1c33279cc09215f585fdad0ac32748f7aca8 /apps/gui | |
parent | 8a6b2f3abc4ec3d6417cb3dc3a6040c977a6036a (diff) | |
download | rockbox-02860d67c3c2807e3c9fd7d272ce9cc098c052ae.tar.gz rockbox-02860d67c3c2807e3c9fd7d272ce9cc098c052ae.zip |
Touchscreen: adjust calculation of bar touch position
Increased the precision of the bar from 100 steps to 1000 steps so
it is possible to make finer adjustments, and made it possible to
pick the maximum value in a bar rather than just the maximum - 1.
Change-Id: I2e694d3e86e4a151e014da1bd15ab3ade4c4b95e
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/skin_engine/skin_touchsupport.c | 21 | ||||
-rw-r--r-- | apps/gui/wps.c | 4 |
2 files changed, 17 insertions, 8 deletions
diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c index 7a03e83c36..b92fd1e83e 100644 --- a/apps/gui/skin_engine/skin_touchsupport.c +++ b/apps/gui/skin_engine/skin_touchsupport.c | |||
@@ -109,12 +109,21 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset, | |||
109 | { | 109 | { |
110 | struct progressbar *bar = | 110 | struct progressbar *bar = |
111 | SKINOFFSETTOPTR(skin_buffer, r->bar); | 111 | SKINOFFSETTOPTR(skin_buffer, r->bar); |
112 | if(r->width > r->height) | 112 | if(r->width > r->height) { |
113 | *edge_offset = vx*100/r->width; | 113 | if(r->width > 1) |
114 | else /* vertical bars are bottom-up by default */ | 114 | *edge_offset = vx*1000/(r->width - 1); |
115 | *edge_offset = 100 - vy*100/r->height; | 115 | else |
116 | *edge_offset = 0; | ||
117 | } else { | ||
118 | /* vertical bars are bottom-up by default */ | ||
119 | if(r->height > 1) | ||
120 | *edge_offset = 1000 - vy*1000/(r->height - 1); | ||
121 | else | ||
122 | *edge_offset = 0; | ||
123 | } | ||
124 | |||
116 | if (r->reverse_bar || (bar && bar->invert_fill_direction)) | 125 | if (r->reverse_bar || (bar && bar->invert_fill_direction)) |
117 | *edge_offset = 100 - *edge_offset; | 126 | *edge_offset = 1000 - *edge_offset; |
118 | } | 127 | } |
119 | temp = r; | 128 | temp = r; |
120 | returncode = r->action; | 129 | returncode = r->action; |
@@ -294,7 +303,7 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset, | |||
294 | { | 303 | { |
295 | int val, count; | 304 | int val, count; |
296 | get_setting_info_for_bar(bar->setting_id, &count, &val); | 305 | get_setting_info_for_bar(bar->setting_id, &count, &val); |
297 | val = *edge_offset * count / 100; | 306 | val = *edge_offset * count / 1000; |
298 | update_setting_value_from_touch(bar->setting_id, val); | 307 | update_setting_value_from_touch(bar->setting_id, val); |
299 | } | 308 | } |
300 | } | 309 | } |
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 2c668998f0..35716087c2 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -182,7 +182,7 @@ static int skintouch_to_wps(struct wps_data *data) | |||
182 | return ACTION_WPS_HOTKEY; | 182 | return ACTION_WPS_HOTKEY; |
183 | #endif | 183 | #endif |
184 | case ACTION_TOUCH_SCROLLBAR: | 184 | case ACTION_TOUCH_SCROLLBAR: |
185 | skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->length*offset/100; | 185 | skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->length*offset/1000; |
186 | audio_pre_ff_rewind(); | 186 | audio_pre_ff_rewind(); |
187 | audio_ff_rewind(skin_get_global_state()->id3->elapsed); | 187 | audio_ff_rewind(skin_get_global_state()->id3->elapsed); |
188 | return ACTION_TOUCHSCREEN; | 188 | return ACTION_TOUCHSCREEN; |
@@ -191,7 +191,7 @@ static int skintouch_to_wps(struct wps_data *data) | |||
191 | const int min_vol = sound_min(SOUND_VOLUME); | 191 | const int min_vol = sound_min(SOUND_VOLUME); |
192 | const int max_vol = sound_max(SOUND_VOLUME); | 192 | const int max_vol = sound_max(SOUND_VOLUME); |
193 | const int step_vol = sound_steps(SOUND_VOLUME); | 193 | const int step_vol = sound_steps(SOUND_VOLUME); |
194 | global_settings.volume = (offset * (max_vol - min_vol)) / 100; | 194 | global_settings.volume = (offset * (max_vol - min_vol)) / 1000; |
195 | global_settings.volume += min_vol; | 195 | global_settings.volume += min_vol; |
196 | global_settings.volume -= (global_settings.volume % step_vol); | 196 | global_settings.volume -= (global_settings.volume % step_vol); |
197 | setvol(); | 197 | setvol(); |