From 3b0925b912246a8b1c0dc2ecc62e09a5c9ae7788 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Wed, 17 Jun 2020 00:41:37 +0300 Subject: [PATCH] touch: Check if init failed and stop parsing if yes --- nyx/nyx_gui/frontend/gui.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nyx/nyx_gui/frontend/gui.c b/nyx/nyx_gui/frontend/gui.c index c1d4549..aef5991 100644 --- a/nyx/nyx_gui/frontend/gui.c +++ b/nyx/nyx_gui/frontend/gui.c @@ -316,11 +316,15 @@ static void _disp_fb_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const } static touch_event touchpad; +static bool touch_enabled; static bool console_enabled = false; static bool _fts_touch_read(lv_indev_data_t *data) { - touch_poll(&touchpad); + if (touch_enabled) + touch_poll(&touchpad); + else + return false; // Take a screenshot if 3 fingers. if (touchpad.fingers > 2) @@ -2232,7 +2236,7 @@ void nyx_load_and_run() close_btn = NULL; // Initialize touch. - touch_power_on(); + touch_enabled = touch_power_on(); lv_indev_drv_t indev_drv_touch; lv_indev_drv_init(&indev_drv_touch); indev_drv_touch.type = LV_INDEV_TYPE_POINTER;