diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-10 22:08:37 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-10 22:48:26 +0100 |
commit | b103b075034d74550bc77e8af4ba6f2b4e8a65df (patch) | |
tree | 7a13d42ea9744881f3b132e2236106608078482a /apps/menu.c | |
parent | 69420e796c4008b8923b8241ab3e154442735678 (diff) | |
download | rockbox-b103b075034d74550bc77e8af4ba6f2b4e8a65df.tar.gz rockbox-b103b075034d74550bc77e8af4ba6f2b4e8a65df.zip |
touchscreen: Fix annoying bug when switching touchscreen modes
Changing the touchscreen mode in the settings menu required a reboot
to fully apply because this code was trying to reapply old settings.
This is a hack. IMHO to fix it properly the behavior of touchscreen
mode needs to be changed so code that needs a specific mode doesn't
need to twiddle global state, but that's a bigger undertaking.
Change-Id: I55a46dbed721273ad78cb9df81fe60940665962b
Diffstat (limited to 'apps/menu.c')
-rw-r--r-- | apps/menu.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/menu.c b/apps/menu.c index 73cabea80a..c4f3024930 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -379,6 +379,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
379 | #ifdef HAVE_TOUCHSCREEN | 379 | #ifdef HAVE_TOUCHSCREEN |
380 | /* plugins possibly have grid mode active. force global settings in lists */ | 380 | /* plugins possibly have grid mode active. force global settings in lists */ |
381 | enum touchscreen_mode tsm = touchscreen_get_mode(); | 381 | enum touchscreen_mode tsm = touchscreen_get_mode(); |
382 | enum touchscreen_mode old_global_mode = global_settings.touch_mode; | ||
382 | touchscreen_set_mode(global_settings.touch_mode); | 383 | touchscreen_set_mode(global_settings.touch_mode); |
383 | #endif | 384 | #endif |
384 | 385 | ||
@@ -740,7 +741,12 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
740 | FOR_NB_SCREENS(i) | 741 | FOR_NB_SCREENS(i) |
741 | viewportmanager_theme_undo(i, false); | 742 | viewportmanager_theme_undo(i, false); |
742 | #ifdef HAVE_TOUCHSCREEN | 743 | #ifdef HAVE_TOUCHSCREEN |
743 | touchscreen_set_mode(tsm); | 744 | /* This is needed because this function runs the settings menu and we do |
745 | * not want to switch back to the old mode if the user intentionally went | ||
746 | * to a different one. This is a very hacky way to do this... */ | ||
747 | if(!(global_settings.touch_mode != (int)old_global_mode && | ||
748 | tsm == old_global_mode)) | ||
749 | touchscreen_set_mode(tsm); | ||
744 | #endif | 750 | #endif |
745 | 751 | ||
746 | return ret; | 752 | return ret; |