[fix] fix the issue where the title bar is displayed incorrectly when in fullscreen mode

This commit is contained in:
dijunkun
2024-09-13 15:10:23 +08:00
parent a49ca813e0
commit d246b7a04d
2 changed files with 50 additions and 34 deletions

View File

@@ -28,6 +28,10 @@ SDL_HitTestResult Render::HitTestCallback(SDL_Window *window,
return SDL_HITTEST_NORMAL;
}
if (render->fullscreen_button_pressed_) {
return SDL_HITTEST_NORMAL;
}
int window_width, window_height;
SDL_GetWindowSize(window, &window_width, &window_height);
@@ -497,23 +501,22 @@ int Render::Run() {
ImGui_ImplSDL2_NewFrame();
ImGui::NewFrame();
ImGui::PushStyleColor(
ImGuiCol_WindowBg,
ImVec4(1.0f, 1.0f, 1.0f, fullscreen_button_pressed_ ? 0 : 1.0f));
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
ImGui::SetNextWindowSize(
ImVec2(main_window_width_,
(connection_established_ && streaming_ && is_client_mode_)
? (fullscreen_button_pressed_ ? 0 : title_bar_height_)
: main_window_height_default_),
ImGuiCond_Always);
ImGui::Begin("Render", nullptr,
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar |
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar |
ImGuiWindowFlags_NoBringToFrontOnFocus);
ImGui::PopStyleColor();
if (!fullscreen_button_pressed_) {
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
ImGui::SetNextWindowSize(
ImVec2(main_window_width_,
(connection_established_ && streaming_ && is_client_mode_)
? (fullscreen_button_pressed_ ? 0 : title_bar_height_)
: main_window_height_default_),
ImGuiCond_Always);
ImGui::Begin("Render", nullptr,
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar |
ImGuiWindowFlags_NoResize |
ImGuiWindowFlags_NoScrollbar |
ImGuiWindowFlags_NoBringToFrontOnFocus);
ImGui::PopStyleColor();
TitleBar();
}
@@ -532,7 +535,9 @@ int Render::Run() {
MainWindow();
}
ImGui::End();
if (!fullscreen_button_pressed_) {
ImGui::End();
}
// create connection
if (SignalStatus::SignalConnected == signal_status_ &&