fix(color): full screen widget may not exit cleanly after calling lcd.exitFullScreen() (#5544)

This commit is contained in:
philmoz
2024-09-19 18:05:08 +10:00
committed by GitHub
parent 6563cd20d0
commit edb04cc833
3 changed files with 9 additions and 5 deletions
+2
View File
@@ -75,6 +75,7 @@ class Widget : public ButtonBase
// Set/unset fullscreen mode // Set/unset fullscreen mode
void setFullscreen(bool enable); void setFullscreen(bool enable);
void closeFullscreen() { closeFS = true; }
// Called when the widget options have changed // Called when the widget options have changed
virtual void update(); virtual void update();
@@ -95,6 +96,7 @@ class Widget : public ButtonBase
PersistentData* persistentData; PersistentData* persistentData;
bool fullscreen = false; bool fullscreen = false;
bool fsAllowed = true; bool fsAllowed = true;
bool closeFS = false;
lv_obj_t* focusBorder = nullptr; lv_obj_t* focusBorder = nullptr;
lv_style_t borderStyle; lv_style_t borderStyle;
lv_point_t borderPts[5]; lv_point_t borderPts[5];
+2 -5
View File
@@ -1410,11 +1410,8 @@ Exit full screen widget mode.
*/ */
static int luaLcdExitFullScreen(lua_State *L) static int luaLcdExitFullScreen(lua_State *L)
{ {
if (runningFS) { if (runningFS)
auto rfs = runningFS; runningFS->closeFullscreen();
runningFS = nullptr;
rfs->setFullscreen(false);
}
return 0; return 0;
} }
+5
View File
@@ -260,6 +260,11 @@ void LuaWidget::checkEvents()
{ {
Widget::checkEvents(); Widget::checkEvents();
if (closeFS) {
closeFS = false;
setFullscreen(false);
}
// Call update once after widget first created // Call update once after widget first created
if (!created) { if (!created) {
created = true; created = true;