From 69420e796c4008b8923b8241ab3e154442735678 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Tue, 10 Aug 2021 21:27:28 +0100 Subject: 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 --- apps/gui/yesno.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'apps/gui/yesno.c') 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, gui_yesno_draw(&(yn[i])); } +#ifdef HAVE_TOUCHSCREEN + /* switch to point mode because that's more intuitive */ + enum touchscreen_mode tsm = touchscreen_get_mode(); + touchscreen_set_mode(TOUCHSCREEN_POINT); +#endif + /* make sure to eat any extranous keypresses */ action_wait_for_release(); button_clear_queue(); @@ -211,12 +217,23 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, /* ignore some SYS events that can happen */ continue; default: - if(default_event_handler(button) == SYS_USB_CONNECTED) - return(YESNO_USB); + if(default_event_handler(button) == SYS_USB_CONNECTED) { +#ifdef HAVE_TOUCHSCREEN + /* restore old touchscreen mode */ + touchscreen_set_mode(tsm); +#endif + return YESNO_USB; + } + result = YESNO_NO; } } +#ifdef HAVE_TOUCHSCREEN + /* restore old touchscreen mode */ + touchscreen_set_mode(tsm); +#endif + FOR_NB_SCREENS(i) result_displayed=gui_yesno_draw_result(&(yn[i]), result); -- cgit v1.2.3