From d64b02438161ee9cf7a98c01df724e9a88cd15c5 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 19 Apr 2022 10:43:49 +0200 Subject: [PATCH] button: set focus before onPress() onPress() might create a new window or change the focus. --- radio/src/thirdparty/libopenui/src/button.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/radio/src/thirdparty/libopenui/src/button.cpp b/radio/src/thirdparty/libopenui/src/button.cpp index 8a6ea8dc6..cf69bb42f 100644 --- a/radio/src/thirdparty/libopenui/src/button.cpp +++ b/radio/src/thirdparty/libopenui/src/button.cpp @@ -78,12 +78,11 @@ void Button::onEvent(lv_event_t* event) TRACE_WINDOWS("%s received lvgl event code 0x%X", getWindowDebugString("Button").c_str(), code); if (enabled && code == LV_EVENT_CLICKED) { - onKeyPress(); - onPress(); - if (!(windowFlags & NO_FOCUS)) { setFocus(SET_FOCUS_DEFAULT); } + onKeyPress(); + onPress(); } }