Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions radio/src/lua/lua_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions radio/src/lua/lua_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down