[fix] fix title bar icon error when leaves maximized state

This commit is contained in:
dijunkun
2024-08-19 14:16:21 +08:00
parent 72fda8a728
commit 9ea67df0fd
2 changed files with 5 additions and 1 deletions

View File

@@ -553,6 +553,10 @@ int Render::Run() {
LOG_INFO("Quit program"); LOG_INFO("Quit program");
exit_ = true; exit_ = true;
} }
} else if (event.window.event == SDL_WINDOWEVENT_MAXIMIZED) {
} else if (event.window.event == SDL_WINDOWEVENT_MINIMIZED) {
} else if (event.window.event == SDL_WINDOWEVENT_RESTORED) {
window_maximized_ = false;
} else if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { } else if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
SDL_GetWindowSize(main_window_, &main_window_width_, SDL_GetWindowSize(main_window_, &main_window_width_,
&main_window_height_); &main_window_height_);

View File

@@ -94,7 +94,7 @@ int Render::TitleBar() {
if (ImGui::Button(window_restore_button.c_str(), if (ImGui::Button(window_restore_button.c_str(),
ImVec2(BUTTON_PADDING, 30))) { ImVec2(BUTTON_PADDING, 30))) {
SDL_RestoreWindow(main_window_); SDL_RestoreWindow(main_window_);
window_maximized_ = !window_maximized_; window_maximized_ = false;
} }
draw_list->AddRect(ImVec2(pos_x_top, pos_y_top), draw_list->AddRect(ImVec2(pos_x_top, pos_y_top),
ImVec2(pos_x_top + 12, pos_y_top + 12), ImVec2(pos_x_top + 12, pos_y_top + 12),