Skip to content

Commit

Permalink
fix(color): full screen widget may not exit cleanly after calling lcd…
Browse files Browse the repository at this point in the history
….exitFullScreen() (#5544)
  • Loading branch information
philmoz authored and pfeerick committed Sep 19, 2024
1 parent 6b192e9 commit f4a6123
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions radio/src/gui/colorlcd/widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class Widget : public Button

// Set/unset fullscreen mode
void setFullscreen(bool enable);
void closeFullscreen() { closeFS = true; }

// Disable setting fullscreen mode
void disableFullscreen();
Expand All @@ -115,6 +116,7 @@ class Widget : public Button
uint32_t focusGainedTS = 0;
bool fullscreen = false;
bool fsAllowed = true;
bool closeFS = false;

void onCancel() override;
void onLongPress() override;
Expand Down
7 changes: 2 additions & 5 deletions radio/src/lua/api_colorlcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1412,11 +1412,8 @@ Exit full screen widget mode.
*/
static int luaLcdExitFullScreen(lua_State *L)
{
if (runningFS) {
Widget* rfs = runningFS;
runningFS = nullptr;
rfs->setFullscreen(false);
}
if (runningFS)
runningFS->closeFullscreen();
return 0;
}

Expand Down
5 changes: 5 additions & 0 deletions radio/src/lua/lua_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ void LuaWidget::checkEvents()
{
Widget::checkEvents();

if (closeFS) {
closeFS = false;
setFullscreen(false);
}

// paint has not been called
if (!refreshed) {
background();
Expand Down

0 comments on commit f4a6123

Please sign in to comment.