From 9e7c1737f2a0055841e03b740f3e21bd2f5d573a Mon Sep 17 00:00:00 2001 From: Bryan Mayland Date: Thu, 16 Oct 2025 15:31:22 -0400 Subject: [PATCH] Allow doubletap of a main screen widget to fullscreen it --- radio/src/lua/lua_widget.cpp | 25 ++++++++++++++++++++++--- radio/src/lua/lua_widget.h | 3 +++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/radio/src/lua/lua_widget.cpp b/radio/src/lua/lua_widget.cpp index 455a295fb79..ce404850516 100644 --- a/radio/src/lua/lua_widget.cpp +++ b/radio/src/lua/lua_widget.cpp @@ -274,12 +274,31 @@ LuaWidget::~LuaWidget() void LuaWidget::onClicked() { - if (!fullscreen) { - ButtonBase::onClicked(); + if (fullscreen) { + LuaScriptManager::onClickedEvent(); return; } - LuaScriptManager::onClickedEvent(); + // DoubleClick to enter fullscreen mode + constexpr uint32_t DOUBLETAP_TIMEOUT_MS = 500; + + uint32_t now = time_get_ms(); + if (now - tapLastMs > DOUBLETAP_TIMEOUT_MS) { + tapCount = 0; + } + tapLastMs = now; + ++tapCount; + + if (tapCount < 2) { + Widget::onClicked(); + } else { + onDoubleClicked(); + } +} + +void LuaWidget::onDoubleClicked() +{ + setFullscreen(true); } void LuaWidget::onCancel() diff --git a/radio/src/lua/lua_widget.h b/radio/src/lua/lua_widget.h index 8efb3f6d9f2..ba574f5ff52 100644 --- a/radio/src/lua/lua_widget.h +++ b/radio/src/lua/lua_widget.h @@ -149,9 +149,12 @@ class LuaWidget : public Widget, public LuaScriptManager int optionsDataRef; char* errorMessage; bool refreshed = false; + uint32_t tapLastMs = 0; + uint32_t tapCount = 0; // Window interface void onClicked() override; + void onDoubleClicked(); void onCancel() override; void checkEvents() override; void onEvent(event_t event) override;