Skip to content

Commit

Permalink
fix: 修复部分平台上,窗口从最小化恢复后,直到 lvgl 画面出现更新前都无法正确显示的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Augtons committed Mar 30, 2024
1 parent eb7faf1 commit e152387
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/lvglsim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e152387

Please sign in to comment.