diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-10 21:27:28 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-10 22:48:26 +0100 |
commit | 69420e796c4008b8923b8241ab3e154442735678 (patch) | |
tree | a43ee2f15a1fa38faa8a1e0967d07b0d3e41b832 | |
parent | a8063054f90b6f134a8bac089667356b8e974a38 (diff) | |
download | rockbox-69420e796c4008b8923b8241ab3e154442735678.tar.gz rockbox-69420e796c4008b8923b8241ab3e154442735678.zip |
touchscreen: Use pointing mode in the yes/no screen
Seems to fix the unintuitive / inaccurate behavior of this screen.
Rejigger the generic touchscreen keymap because the 3x3 buttons are
no longer used. Also map physical keys for yes/no on the Q1.
Change-Id: I2ed633896b87030fa654d47d9d02929b849495da
-rw-r--r-- | apps/gui/yesno.c | 21 | ||||
-rw-r--r-- | apps/keymaps/keymap-shanlingq1.c | 9 | ||||
-rw-r--r-- | apps/keymaps/keymap-touchscreen.c | 2 |
3 files changed, 28 insertions, 4 deletions
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index 669f8ca09a..4098d630d0 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c | |||
@@ -164,6 +164,12 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, | |||
164 | gui_yesno_draw(&(yn[i])); | 164 | gui_yesno_draw(&(yn[i])); |
165 | } | 165 | } |
166 | 166 | ||
167 | #ifdef HAVE_TOUCHSCREEN | ||
168 | /* switch to point mode because that's more intuitive */ | ||
169 | enum touchscreen_mode tsm = touchscreen_get_mode(); | ||
170 | touchscreen_set_mode(TOUCHSCREEN_POINT); | ||
171 | #endif | ||
172 | |||
167 | /* make sure to eat any extranous keypresses */ | 173 | /* make sure to eat any extranous keypresses */ |
168 | action_wait_for_release(); | 174 | action_wait_for_release(); |
169 | button_clear_queue(); | 175 | button_clear_queue(); |
@@ -211,12 +217,23 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, | |||
211 | /* ignore some SYS events that can happen */ | 217 | /* ignore some SYS events that can happen */ |
212 | continue; | 218 | continue; |
213 | default: | 219 | default: |
214 | if(default_event_handler(button) == SYS_USB_CONNECTED) | 220 | if(default_event_handler(button) == SYS_USB_CONNECTED) { |
215 | return(YESNO_USB); | 221 | #ifdef HAVE_TOUCHSCREEN |
222 | /* restore old touchscreen mode */ | ||
223 | touchscreen_set_mode(tsm); | ||
224 | #endif | ||
225 | return YESNO_USB; | ||
226 | } | ||
227 | |||
216 | result = YESNO_NO; | 228 | result = YESNO_NO; |
217 | } | 229 | } |
218 | } | 230 | } |
219 | 231 | ||
232 | #ifdef HAVE_TOUCHSCREEN | ||
233 | /* restore old touchscreen mode */ | ||
234 | touchscreen_set_mode(tsm); | ||
235 | #endif | ||
236 | |||
220 | FOR_NB_SCREENS(i) | 237 | FOR_NB_SCREENS(i) |
221 | result_displayed=gui_yesno_draw_result(&(yn[i]), result); | 238 | result_displayed=gui_yesno_draw_result(&(yn[i]), result); |
222 | 239 | ||
diff --git a/apps/keymaps/keymap-shanlingq1.c b/apps/keymaps/keymap-shanlingq1.c index 4745139e7a..2c09a40f4b 100644 --- a/apps/keymaps/keymap-shanlingq1.c +++ b/apps/keymaps/keymap-shanlingq1.c | |||
@@ -57,6 +57,13 @@ static const struct button_mapping button_context_list[] = { | |||
57 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | 57 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) |
58 | }; /* button_context_list */ | 58 | }; /* button_context_list */ |
59 | 59 | ||
60 | static const struct button_mapping button_context_yesno[] = { | ||
61 | /* note: touchscreen buttons are usable in addition to physical keys */ | ||
62 | {ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE}, | ||
63 | {ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE}, | ||
64 | LAST_ITEM_IN_LIST | ||
65 | }; /* button_context_yesno */ | ||
66 | |||
60 | const struct button_mapping* target_get_context_mapping(int context) | 67 | const struct button_mapping* target_get_context_mapping(int context) |
61 | { | 68 | { |
62 | switch (context) | 69 | switch (context) |
@@ -73,5 +80,7 @@ const struct button_mapping* target_get_context_mapping(int context) | |||
73 | //return button_context_tree; | 80 | //return button_context_tree; |
74 | case CONTEXT_LIST: | 81 | case CONTEXT_LIST: |
75 | return button_context_list; | 82 | return button_context_list; |
83 | case CONTEXT_YESNOSCREEN: | ||
84 | return button_context_yesno; | ||
76 | } | 85 | } |
77 | } | 86 | } |
diff --git a/apps/keymaps/keymap-touchscreen.c b/apps/keymaps/keymap-touchscreen.c index 6163cb054c..c70aea2651 100644 --- a/apps/keymaps/keymap-touchscreen.c +++ b/apps/keymaps/keymap-touchscreen.c | |||
@@ -179,8 +179,6 @@ static const struct button_mapping button_context_mainmenu[] = | |||
179 | 179 | ||
180 | 180 | ||
181 | static const struct button_mapping button_context_yesno[] = { | 181 | static const struct button_mapping button_context_yesno[] = { |
182 | { ACTION_YESNO_ACCEPT, BUTTON_TOPRIGHT, BUTTON_NONE }, | ||
183 | { ACTION_YESNO_ACCEPT, BUTTON_BOTTOMLEFT, BUTTON_NONE }, | ||
184 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_YESNOSCREEN) | 182 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_YESNOSCREEN) |
185 | }; /* button_context_settings_yesno */ | 183 | }; /* button_context_settings_yesno */ |
186 | 184 | ||