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;