mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[fix] fix the issue where the title bar is displayed incorrectly when in fullscreen mode
This commit is contained in:
@@ -31,13 +31,16 @@ int Render::ControlWindow() {
|
|||||||
control_window_width_is_changing_) {
|
control_window_width_is_changing_) {
|
||||||
if (control_winodw_pos_.x <= main_window_width_ / 2) {
|
if (control_winodw_pos_.x <= main_window_width_ / 2) {
|
||||||
int pos_x = 0;
|
int pos_x = 0;
|
||||||
int pos_y = (control_winodw_pos_.y >= title_bar_height_ &&
|
int pos_y =
|
||||||
control_winodw_pos_.y <=
|
(control_winodw_pos_.y >=
|
||||||
main_window_height_ - control_window_height_)
|
(fullscreen_button_pressed_ ? 0 : title_bar_height_) &&
|
||||||
? control_winodw_pos_.y
|
control_winodw_pos_.y <=
|
||||||
: (control_winodw_pos_.y < title_bar_height_
|
main_window_height_ - control_window_height_)
|
||||||
? title_bar_height_
|
? control_winodw_pos_.y
|
||||||
: (main_window_height_ - control_window_height_));
|
: (control_winodw_pos_.y <
|
||||||
|
(fullscreen_button_pressed_ ? 0 : title_bar_height_)
|
||||||
|
? (fullscreen_button_pressed_ ? 0 : title_bar_height_)
|
||||||
|
: (main_window_height_ - control_window_height_));
|
||||||
|
|
||||||
if (control_bar_expand_) {
|
if (control_bar_expand_) {
|
||||||
if (control_window_width_ >= control_window_max_width_) {
|
if (control_window_width_ >= control_window_max_width_) {
|
||||||
@@ -58,13 +61,16 @@ int Render::ControlWindow() {
|
|||||||
is_control_bar_in_left_ = true;
|
is_control_bar_in_left_ = true;
|
||||||
} else if (control_winodw_pos_.x > main_window_width_ / 2) {
|
} else if (control_winodw_pos_.x > main_window_width_ / 2) {
|
||||||
int pos_x = 0;
|
int pos_x = 0;
|
||||||
int pos_y = (control_winodw_pos_.y >= title_bar_height_ &&
|
int pos_y =
|
||||||
control_winodw_pos_.y <=
|
(control_winodw_pos_.y >=
|
||||||
main_window_height_ - control_window_height_)
|
(fullscreen_button_pressed_ ? 0 : title_bar_height_) &&
|
||||||
? control_winodw_pos_.y
|
control_winodw_pos_.y <=
|
||||||
: (control_winodw_pos_.y < title_bar_height_
|
main_window_height_ - control_window_height_)
|
||||||
? title_bar_height_
|
? control_winodw_pos_.y
|
||||||
: (main_window_height_ - control_window_height_));
|
: (control_winodw_pos_.y <
|
||||||
|
(fullscreen_button_pressed_ ? 0 : title_bar_height_)
|
||||||
|
? (fullscreen_button_pressed_ ? 0 : title_bar_height_)
|
||||||
|
: (main_window_height_ - control_window_height_));
|
||||||
|
|
||||||
if (control_bar_expand_) {
|
if (control_bar_expand_) {
|
||||||
if (control_window_width_ >= control_window_max_width_) {
|
if (control_window_width_ >= control_window_max_width_) {
|
||||||
@@ -121,13 +127,18 @@ int Render::ControlWindow() {
|
|||||||
ImGui::PopStyleVar(4);
|
ImGui::PopStyleVar(4);
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(0, title_bar_height_), ImGuiCond_Always);
|
ImGui::SetNextWindowPos(
|
||||||
|
ImVec2(0, fullscreen_button_pressed_ ? 0 : title_bar_height_),
|
||||||
|
ImGuiCond_Always);
|
||||||
ImGui::SetNextWindowSize(
|
ImGui::SetNextWindowSize(
|
||||||
ImVec2(main_window_width_, main_window_height_ - title_bar_height_),
|
ImVec2(main_window_width_,
|
||||||
|
main_window_height_ -
|
||||||
|
(fullscreen_button_pressed_ ? 0 : title_bar_height_)),
|
||||||
ImGuiCond_Always);
|
ImGuiCond_Always);
|
||||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
|
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
|
||||||
ImGui::PushStyleColor(ImGuiCol_Border,
|
ImGui::PushStyleColor(ImGuiCol_Border,
|
||||||
ImVec4(178 / 255.0f, 178 / 255.0f, 178 / 255.0f, 1.0f));
|
ImVec4(178 / 255.0f, 178 / 255.0f, 178 / 255.0f,
|
||||||
|
fullscreen_button_pressed_ ? 0 : 1.0f));
|
||||||
ImGui::Begin("VideoBg", nullptr,
|
ImGui::Begin("VideoBg", nullptr,
|
||||||
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar |
|
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar |
|
||||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar |
|
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar |
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ SDL_HitTestResult Render::HitTestCallback(SDL_Window *window,
|
|||||||
return SDL_HITTEST_NORMAL;
|
return SDL_HITTEST_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (render->fullscreen_button_pressed_) {
|
||||||
|
return SDL_HITTEST_NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
int window_width, window_height;
|
int window_width, window_height;
|
||||||
SDL_GetWindowSize(window, &window_width, &window_height);
|
SDL_GetWindowSize(window, &window_width, &window_height);
|
||||||
|
|
||||||
@@ -497,23 +501,22 @@ int Render::Run() {
|
|||||||
ImGui_ImplSDL2_NewFrame();
|
ImGui_ImplSDL2_NewFrame();
|
||||||
ImGui::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_) {
|
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();
|
TitleBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,7 +535,9 @@ int Render::Run() {
|
|||||||
MainWindow();
|
MainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::End();
|
if (!fullscreen_button_pressed_) {
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
// create connection
|
// create connection
|
||||||
if (SignalStatus::SignalConnected == signal_status_ &&
|
if (SignalStatus::SignalConnected == signal_status_ &&
|
||||||
|
|||||||
Reference in New Issue
Block a user