From e15238729e2a4deb3a365430f7697ffe1f944b51 Mon Sep 17 00:00:00 2001 From: Augtons <79037928+Augtons@users.noreply.github.com> Date: Sat, 30 Mar 2024 21:41:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E4=B8=8A=EF=BC=8C=E7=AA=97=E5=8F=A3=E4=BB=8E?= =?UTF-8?q?=E6=9C=80=E5=B0=8F=E5=8C=96=E6=81=A2=E5=A4=8D=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E7=9B=B4=E5=88=B0=20lvgl=20=E7=94=BB=E9=9D=A2=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E6=9B=B4=E6=96=B0=E5=89=8D=E9=83=BD=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lvglsim.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/lvglsim.cpp b/src/lvglsim.cpp index ea6db87..36a73e1 100644 --- a/src/lvglsim.cpp +++ b/src/lvglsim.cpp @@ -153,6 +153,25 @@ void displays_loop() controller.erase(windowId); continue; } + if (event.window.event == SDL_WINDOWEVENT_EXPOSED) { + auto windowId = event.window.windowID; + auto it = windows.find(windowId); + if (it == windows.end()) { + continue; + } + auto& [_, window_ptr] = *it; + auto root = lv_disp_get_scr_act(window_ptr->getDisplay()); + // 强制刷新一次全屏 (由于 lv_refr_now() 在部分平台上仍然导致画面无变化) + std::lock_guard locker { lock }; + auto root_hide = lv_obj_has_flag(root, LV_OBJ_FLAG_HIDDEN); + if (root_hide) { + lv_obj_clear_flag(root, LV_OBJ_FLAG_HIDDEN); + lv_obj_add_flag(root, LV_OBJ_FLAG_HIDDEN); + } else { + lv_obj_add_flag(root, LV_OBJ_FLAG_HIDDEN); + lv_obj_clear_flag(root, LV_OBJ_FLAG_HIDDEN); + } + } } if (event.type == SDL_MOUSEBUTTONDOWN || event.type == SDL_MOUSEMOTION || event.type == SDL_MOUSEBUTTONUP) {