mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 12:15:34 +08:00
[fix] fix control bar border color
This commit is contained in:
@@ -5,16 +5,24 @@
|
|||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
|
||||||
int Render::ControlBar() {
|
int Render::ControlBar() {
|
||||||
ImVec2 bar_pos = ImGui::GetWindowPos();
|
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||||
|
|
||||||
if (control_bar_expand_) {
|
if (control_bar_expand_) {
|
||||||
ImGui::SetCursorPosX(is_control_bar_in_left_ ? (control_window_width_ + 5)
|
ImGui::SetCursorPosX(
|
||||||
: 53);
|
is_control_bar_in_left_ ? (control_window_width_ + 5.0f) : 53.0f);
|
||||||
// Mouse control
|
// Mouse control
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
float disable_mouse_x = ImGui::GetCursorScreenPos().x + 4;
|
|
||||||
|
if (is_control_bar_in_left_) {
|
||||||
|
draw_list->AddLine(
|
||||||
|
ImVec2(ImGui::GetCursorScreenPos().x - 5.0f,
|
||||||
|
ImGui::GetCursorScreenPos().y - 7.0f),
|
||||||
|
ImVec2(ImGui::GetCursorScreenPos().x - 5.0f,
|
||||||
|
ImGui::GetCursorScreenPos().y - 7.0f + control_window_height_),
|
||||||
|
IM_COL32(178, 178, 178, 255), 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
float disable_mouse_x = ImGui::GetCursorScreenPos().x + 4.0f;
|
||||||
float disable_mouse_y = ImGui::GetCursorScreenPos().y + 4.0f;
|
float disable_mouse_y = ImGui::GetCursorScreenPos().y + 4.0f;
|
||||||
std::string mouse = mouse_control_button_pressed_ ? ICON_FA_COMPUTER_MOUSE
|
std::string mouse = mouse_control_button_pressed_ ? ICON_FA_COMPUTER_MOUSE
|
||||||
: ICON_FA_COMPUTER_MOUSE;
|
: ICON_FA_COMPUTER_MOUSE;
|
||||||
@@ -96,10 +104,19 @@ int Render::ControlBar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
if (!is_control_bar_in_left_) {
|
||||||
|
draw_list->AddLine(
|
||||||
|
ImVec2(ImGui::GetCursorScreenPos().x - 3.0f,
|
||||||
|
ImGui::GetCursorScreenPos().y - 7.0f),
|
||||||
|
ImVec2(ImGui::GetCursorScreenPos().x - 3.0f,
|
||||||
|
ImGui::GetCursorScreenPos().y - 7.0f + control_window_height_),
|
||||||
|
IM_COL32(178, 178, 178, 255), 1.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SetCursorPosX(
|
ImGui::SetCursorPosX(
|
||||||
is_control_bar_in_left_ ? (control_window_width_ * 2 - 18) : 3);
|
is_control_bar_in_left_ ? (control_window_width_ * 2 - 18.0f) : 3.0f);
|
||||||
|
|
||||||
std::string control_bar =
|
std::string control_bar =
|
||||||
control_bar_expand_
|
control_bar_expand_
|
||||||
|
|||||||
@@ -121,5 +121,19 @@ int Render::ControlWindow() {
|
|||||||
ImGui::PopStyleVar(4);
|
ImGui::PopStyleVar(4);
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
|
ImGui::SetNextWindowPos(ImVec2(0, title_bar_height_), ImGuiCond_Always);
|
||||||
|
ImGui::SetNextWindowSize(
|
||||||
|
ImVec2(main_window_width_, main_window_height_ - title_bar_height_),
|
||||||
|
ImGuiCond_Always);
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Border,
|
||||||
|
ImVec4(178 / 255.0f, 178 / 255.0f, 178 / 255.0f, 1.0f));
|
||||||
|
ImGui::Begin("VideoBg", nullptr,
|
||||||
|
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar |
|
||||||
|
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar |
|
||||||
|
ImGuiWindowFlags_NoBringToFrontOnFocus);
|
||||||
|
ImGui::PopStyleColor(2);
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -328,7 +328,7 @@ int Render::Run() {
|
|||||||
stream_render_rect_.x = 0;
|
stream_render_rect_.x = 0;
|
||||||
stream_render_rect_.y = title_bar_height_;
|
stream_render_rect_.y = title_bar_height_;
|
||||||
stream_render_rect_.w = main_window_width_;
|
stream_render_rect_.w = main_window_width_;
|
||||||
stream_render_rect_.h = main_window_height_;
|
stream_render_rect_.h = main_window_height_ - title_bar_height_;
|
||||||
|
|
||||||
SDL_DisplayMode DM;
|
SDL_DisplayMode DM;
|
||||||
SDL_GetCurrentDisplayMode(0, &DM);
|
SDL_GetCurrentDisplayMode(0, &DM);
|
||||||
@@ -491,7 +491,6 @@ int Render::Run() {
|
|||||||
ImGui::PushStyleColor(
|
ImGui::PushStyleColor(
|
||||||
ImGuiCol_WindowBg,
|
ImGuiCol_WindowBg,
|
||||||
ImVec4(1.0f, 1.0f, 1.0f, fullscreen_button_pressed_ ? 0 : 1.0f));
|
ImVec4(1.0f, 1.0f, 1.0f, fullscreen_button_pressed_ ? 0 : 1.0f));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0);
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
|
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
|
||||||
ImGui::SetNextWindowSize(
|
ImGui::SetNextWindowSize(
|
||||||
ImVec2(main_window_width_,
|
ImVec2(main_window_width_,
|
||||||
@@ -502,7 +501,6 @@ int Render::Run() {
|
|||||||
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar |
|
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar |
|
||||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar |
|
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar |
|
||||||
ImGuiWindowFlags_NoBringToFrontOnFocus);
|
ImGuiWindowFlags_NoBringToFrontOnFocus);
|
||||||
ImGui::PopStyleVar();
|
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
if (!fullscreen_button_pressed_) {
|
if (!fullscreen_button_pressed_) {
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ class Render {
|
|||||||
int main_window_width_default_ = 960;
|
int main_window_width_default_ = 960;
|
||||||
int main_window_height_default_ = 570;
|
int main_window_height_default_ = 570;
|
||||||
int main_window_width_ = 960;
|
int main_window_width_ = 960;
|
||||||
int main_window_height_ = 540;
|
int main_window_height_ = 570;
|
||||||
int main_window_width_last_ = 960;
|
int main_window_width_last_ = 960;
|
||||||
int main_window_height_last_ = 540;
|
int main_window_height_last_ = 540;
|
||||||
int stream_window_width_ = 1280;
|
int stream_window_width_ = 1280;
|
||||||
|
|||||||
@@ -5,13 +5,11 @@
|
|||||||
#define BUTTON_PADDING 36.0f
|
#define BUTTON_PADDING 36.0f
|
||||||
|
|
||||||
int Render::TitleBar() {
|
int Render::TitleBar() {
|
||||||
// ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1);
|
|
||||||
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_MenuBarBg, ImVec4(1, 1, 1, 0.0f));
|
ImGui::PushStyleColor(ImGuiCol_MenuBarBg, ImVec4(1, 1, 1, 0.0f));
|
||||||
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
|
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
|
||||||
ImGui::SetWindowFontScale(0.8f);
|
ImGui::SetWindowFontScale(0.8f);
|
||||||
ImGui::BeginChild("TitleBar", ImVec2(main_window_width_, title_bar_height_),
|
ImGui::BeginChild("TitleBar", ImVec2(main_window_width_, title_bar_height_),
|
||||||
ImGuiChildFlags_Border,
|
ImGuiChildFlags_None,
|
||||||
ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDecoration |
|
ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDecoration |
|
||||||
ImGuiWindowFlags_NoBringToFrontOnFocus);
|
ImGuiWindowFlags_NoBringToFrontOnFocus);
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
@@ -154,6 +152,5 @@ int Render::TitleBar() {
|
|||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleColor(2);
|
ImGui::PopStyleColor(2);
|
||||||
// ImGui::PopStyleVar();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user