mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-12-24 09:16:45 +08:00
[fix] fix DPI scaling issues
This commit is contained in:
@@ -32,34 +32,41 @@ int LossRateDisplay(float loss_rate) {
|
||||
}
|
||||
|
||||
int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f * dpi_scale_);
|
||||
|
||||
if (props->control_bar_expand_) {
|
||||
ImGui::SetCursorPosX(props->is_control_bar_in_left_
|
||||
? (props->control_window_width_ + 5.0f)
|
||||
: 38.0f);
|
||||
float button_width = 25.0f * dpi_scale_;
|
||||
float button_height = 25.0f * dpi_scale_;
|
||||
|
||||
ImGui::SetCursorPosX(
|
||||
props->is_control_bar_in_left_
|
||||
? (props->control_window_width_ + 5.0f * dpi_scale_)
|
||||
: 50.0f * dpi_scale_);
|
||||
// mouse control button
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
|
||||
if (props->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 +
|
||||
props->control_window_height_),
|
||||
IM_COL32(178, 178, 178, 255), 1.0f);
|
||||
draw_list->AddLine(
|
||||
ImVec2(ImGui::GetCursorScreenPos().x - 5.0f * dpi_scale_,
|
||||
ImGui::GetCursorScreenPos().y - 7.0f * dpi_scale_),
|
||||
ImVec2(ImGui::GetCursorScreenPos().x - 5.0f * dpi_scale_,
|
||||
ImGui::GetCursorScreenPos().y - 7.0f * dpi_scale_ +
|
||||
props->control_window_height_),
|
||||
IM_COL32(178, 178, 178, 255), 1.0f);
|
||||
}
|
||||
|
||||
std::string display = ICON_FA_DISPLAY;
|
||||
if (ImGui::Button(display.c_str(), ImVec2(25, 25))) {
|
||||
ImGui::SetWindowFontScale(0.9f);
|
||||
if (ImGui::Button(display.c_str(), ImVec2(button_width, button_height))) {
|
||||
ImGui::OpenPopup("display");
|
||||
}
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
|
||||
ImVec2 btn_min = ImGui::GetItemRectMin();
|
||||
ImVec2 btn_size_actual = ImGui::GetItemRectSize();
|
||||
|
||||
if (ImGui::BeginPopup("display")) {
|
||||
ImGui::SetWindowFontScale(0.5f);
|
||||
ImGui::SetWindowFontScale(0.8f);
|
||||
for (int i = 0; i < props->display_info_list_.size(); i++) {
|
||||
if (ImGui::Selectable(props->display_info_list_[i].name.c_str())) {
|
||||
props->selected_display_ = i;
|
||||
@@ -75,7 +82,6 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
}
|
||||
props->display_selectable_hovered_ = ImGui::IsWindowHovered();
|
||||
}
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
@@ -96,7 +102,8 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
std::string mouse = props->mouse_control_button_pressed_
|
||||
? ICON_FA_COMPUTER_MOUSE
|
||||
: ICON_FA_COMPUTER_MOUSE;
|
||||
if (ImGui::Button(mouse.c_str(), ImVec2(25, 25))) {
|
||||
ImGui::SetWindowFontScale(0.9f);
|
||||
if (ImGui::Button(mouse.c_str(), ImVec2(button_width, button_height))) {
|
||||
if (props->connection_established_) {
|
||||
start_keyboard_capturer_ = !start_keyboard_capturer_;
|
||||
props->control_mouse_ = !props->control_mouse_;
|
||||
@@ -108,17 +115,20 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
: localization::control_mouse[localization_language_index_];
|
||||
}
|
||||
}
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
if (!props->mouse_control_button_pressed_) {
|
||||
draw_list->AddLine(ImVec2(disable_mouse_x, disable_mouse_y),
|
||||
ImVec2(disable_mouse_x + button_width * 0.75f,
|
||||
disable_mouse_y + button_height * 0.75f),
|
||||
IM_COL32(0, 0, 0, 255), 2.0f * dpi_scale_);
|
||||
draw_list->AddLine(
|
||||
ImVec2(disable_mouse_x, disable_mouse_y),
|
||||
ImVec2(disable_mouse_x + 16.0f, disable_mouse_y + 14.2f),
|
||||
IM_COL32(0, 0, 0, 255), 2.0f);
|
||||
draw_list->AddLine(
|
||||
ImVec2(disable_mouse_x - 1.2f, disable_mouse_y + 1.2f),
|
||||
ImVec2(disable_mouse_x + 15.3f, disable_mouse_y + 15.4f),
|
||||
ImVec2(disable_mouse_x - 1.2f * dpi_scale_,
|
||||
disable_mouse_y + 1.2f * dpi_scale_),
|
||||
ImVec2(disable_mouse_x + button_width * 0.75f - 1.2f * dpi_scale_,
|
||||
disable_mouse_y + button_height * 0.75f + 1.2f * dpi_scale_),
|
||||
ImGui::IsItemHovered() ? IM_COL32(66, 150, 250, 255)
|
||||
: IM_COL32(179, 213, 253, 255),
|
||||
2.0f);
|
||||
2.0f * dpi_scale_);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
@@ -131,7 +141,8 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
std::string audio = props->audio_capture_button_pressed_
|
||||
? ICON_FA_VOLUME_HIGH
|
||||
: ICON_FA_VOLUME_HIGH;
|
||||
if (ImGui::Button(audio.c_str(), ImVec2(25, 25))) {
|
||||
ImGui::SetWindowFontScale(0.9f);
|
||||
if (ImGui::Button(audio.c_str(), ImVec2(button_width, button_height))) {
|
||||
if (props->connection_established_) {
|
||||
props->audio_capture_button_pressed_ =
|
||||
!props->audio_capture_button_pressed_;
|
||||
@@ -148,17 +159,20 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
props->data_label_.c_str());
|
||||
}
|
||||
}
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
if (!props->audio_capture_button_pressed_) {
|
||||
draw_list->AddLine(ImVec2(disable_audio_x, disable_audio_y),
|
||||
ImVec2(disable_audio_x + button_width * 0.75f,
|
||||
disable_audio_y + button_height * 0.75f),
|
||||
IM_COL32(0, 0, 0, 255), 2.0f * dpi_scale_);
|
||||
draw_list->AddLine(
|
||||
ImVec2(disable_audio_x, disable_audio_y),
|
||||
ImVec2(disable_audio_x + 16.0f, disable_audio_y + 14.2f),
|
||||
IM_COL32(0, 0, 0, 255), 2.0f);
|
||||
draw_list->AddLine(
|
||||
ImVec2(disable_audio_x - 1.2f, disable_audio_y + 1.2f),
|
||||
ImVec2(disable_audio_x + 15.3f, disable_audio_y + 15.4f),
|
||||
ImVec2(disable_audio_x - 1.2f * dpi_scale_,
|
||||
disable_audio_y + 1.2f * dpi_scale_),
|
||||
ImVec2(disable_audio_x + button_width * 0.75f - 1.2f * dpi_scale_,
|
||||
disable_audio_y + button_height * 0.75f + 1.2f * dpi_scale_),
|
||||
ImGui::IsItemHovered() ? IM_COL32(66, 150, 250, 255)
|
||||
: IM_COL32(179, 213, 253, 255),
|
||||
2.0f);
|
||||
2.0f * dpi_scale_);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
@@ -170,7 +184,9 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
button_color_style_pushed = true;
|
||||
}
|
||||
std::string net_traffic_stats = ICON_FA_SIGNAL;
|
||||
if (ImGui::Button(net_traffic_stats.c_str(), ImVec2(25, 25))) {
|
||||
ImGui::SetWindowFontScale(0.9f);
|
||||
if (ImGui::Button(net_traffic_stats.c_str(),
|
||||
ImVec2(button_width, button_height))) {
|
||||
props->net_traffic_stats_button_pressed_ =
|
||||
!props->net_traffic_stats_button_pressed_;
|
||||
props->control_window_height_is_changing_ = true;
|
||||
@@ -182,6 +198,7 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
: localization::show_net_traffic_stats
|
||||
[localization_language_index_];
|
||||
}
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
if (button_color_style_pushed) {
|
||||
ImGui::PopStyleColor();
|
||||
button_color_style_pushed = false;
|
||||
@@ -191,7 +208,9 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
// fullscreen button
|
||||
std::string fullscreen =
|
||||
fullscreen_button_pressed_ ? ICON_FA_COMPRESS : ICON_FA_EXPAND;
|
||||
if (ImGui::Button(fullscreen.c_str(), ImVec2(25, 25))) {
|
||||
ImGui::SetWindowFontScale(0.9f);
|
||||
if (ImGui::Button(fullscreen.c_str(),
|
||||
ImVec2(button_width, button_height))) {
|
||||
fullscreen_button_pressed_ = !fullscreen_button_pressed_;
|
||||
props->fullscreen_button_label_ =
|
||||
fullscreen_button_pressed_
|
||||
@@ -205,13 +224,17 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
}
|
||||
props->reset_control_bar_pos_ = true;
|
||||
}
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
|
||||
ImGui::SameLine();
|
||||
// close button
|
||||
std::string close_button = ICON_FA_XMARK;
|
||||
if (ImGui::Button(close_button.c_str(), ImVec2(25, 25))) {
|
||||
ImGui::SetWindowFontScale(0.9f);
|
||||
if (ImGui::Button(close_button.c_str(),
|
||||
ImVec2(button_width, button_height))) {
|
||||
CleanupPeer(props);
|
||||
}
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
@@ -225,9 +248,10 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::SetCursorPosX(props->is_control_bar_in_left_
|
||||
? (props->control_window_width_ * 2 - 20.0f)
|
||||
: 5.0f);
|
||||
ImGui::SetCursorPosX(
|
||||
props->is_control_bar_in_left_
|
||||
? (props->control_window_width_ * 2 - 20.0f * dpi_scale_)
|
||||
: 5.0f * dpi_scale_);
|
||||
|
||||
std::string control_bar =
|
||||
props->control_bar_expand_
|
||||
@@ -235,16 +259,19 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
: ICON_FA_ANGLE_RIGHT)
|
||||
: (props->is_control_bar_in_left_ ? ICON_FA_ANGLE_RIGHT
|
||||
: ICON_FA_ANGLE_LEFT);
|
||||
if (ImGui::Button(control_bar.c_str(), ImVec2(15, 25))) {
|
||||
ImGui::SetWindowFontScale(0.9f);
|
||||
if (ImGui::Button(control_bar.c_str(),
|
||||
ImVec2(15.0f * dpi_scale_, 25.0f * dpi_scale_))) {
|
||||
props->control_bar_expand_ = !props->control_bar_expand_;
|
||||
props->control_bar_button_pressed_time_ = ImGui::GetTime();
|
||||
props->control_window_width_is_changing_ = true;
|
||||
|
||||
if (!props->control_bar_expand_) {
|
||||
props->control_window_height_ = 40;
|
||||
props->control_window_height_ = 35 * dpi_scale_;
|
||||
props->net_traffic_stats_button_pressed_ = false;
|
||||
}
|
||||
}
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
|
||||
if (props->net_traffic_stats_button_pressed_ && props->control_bar_expand_) {
|
||||
NetTrafficStats(props);
|
||||
@@ -259,8 +286,7 @@ int Render::NetTrafficStats(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
ImGui::SetCursorPos(ImVec2(props->is_control_bar_in_left_
|
||||
? (props->control_window_width_ + 5.0f)
|
||||
: 5.0f,
|
||||
40.0f));
|
||||
|
||||
35.0f * dpi_scale_));
|
||||
if (ImGui::BeginTable("NetTrafficStats", 4, ImGuiTableFlags_BordersH,
|
||||
ImVec2(props->control_window_max_width_ - 10.0f,
|
||||
props->control_window_max_height_ - 60.0f))) {
|
||||
|
||||
@@ -7,7 +7,7 @@ int Render::StatusBar() {
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
static bool a, b, c, d, e;
|
||||
ImGui::SetNextWindowPos(
|
||||
ImVec2(0, main_window_height_default_ - status_bar_height_ - 1),
|
||||
ImVec2(0, main_window_height_ - status_bar_height_ - 1),
|
||||
ImGuiCond_Always);
|
||||
|
||||
ImGui::BeginChild(
|
||||
@@ -15,18 +15,20 @@ int Render::StatusBar() {
|
||||
ImGuiChildFlags_Border,
|
||||
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoBringToFrontOnFocus);
|
||||
|
||||
ImVec2 dot_pos =
|
||||
ImVec2(13, main_window_height_default_ - status_bar_height_ + 11.0f);
|
||||
ImVec2 dot_pos = ImVec2(13.0f * dpi_scale_,
|
||||
(main_window_height_ - status_bar_height_) * 1.025f);
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
draw_list->AddCircleFilled(dot_pos, 5.0f,
|
||||
draw_list->AddCircleFilled(dot_pos, 5.0f * dpi_scale_,
|
||||
ImColor(signal_connected_ ? 0.0f : 1.0f,
|
||||
signal_connected_ ? 1.0f : 0.0f, 0.0f),
|
||||
100);
|
||||
draw_list->AddCircle(dot_pos, 6.0f, ImColor(1.0f, 1.0f, 1.0f), 100);
|
||||
draw_list->AddCircle(dot_pos, 6.0f * dpi_scale_, ImColor(1.0f, 1.0f, 1.0f),
|
||||
100);
|
||||
|
||||
ImGui::SetWindowFontScale(0.6f);
|
||||
draw_list->AddText(
|
||||
ImVec2(25, main_window_height_default_ - status_bar_height_ + 3.0f),
|
||||
ImVec2(25.0f * dpi_scale_,
|
||||
(main_window_height_ - status_bar_height_) * 1.003f),
|
||||
ImColor(0.0f, 0.0f, 0.0f),
|
||||
signal_connected_
|
||||
? localization::signal_connected[localization_language_index_].c_str()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "rd_log.h"
|
||||
#include "render.h"
|
||||
|
||||
#define BUTTON_PADDING 36.0f
|
||||
#define BUTTON_PADDING 36.0f * dpi_scale_
|
||||
#define NEW_VERSION_ICON_RENDER_TIME_INTERVAL 2000
|
||||
|
||||
namespace crossdesk {
|
||||
@@ -11,7 +11,6 @@ int Render::TitleBar(bool main_window) {
|
||||
ImGui::PushStyleColor(ImGuiCol_MenuBarBg, ImVec4(1.0f, 1.0f, 1.0f, 0.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
|
||||
ImGui::SetWindowFontScale(0.8f);
|
||||
ImGui::BeginChild(
|
||||
main_window ? "MainTitleBar" : "StreamTitleBar",
|
||||
ImVec2(main_window ? main_window_width_ : stream_window_width_,
|
||||
@@ -19,23 +18,24 @@ int Render::TitleBar(bool main_window) {
|
||||
ImGuiChildFlags_Border,
|
||||
ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDecoration |
|
||||
ImGuiWindowFlags_NoBringToFrontOnFocus);
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
if (ImGui::BeginMenuBar()) {
|
||||
ImGui::SetWindowFontScale(0.8f);
|
||||
ImGui::SetCursorPosX(
|
||||
(main_window ? main_window_width_ : stream_window_width_) -
|
||||
(BUTTON_PADDING * 3 - 3));
|
||||
(BUTTON_PADDING * 3 - 3.0f * dpi_scale_));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0, 0, 0, 0.1f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive,
|
||||
ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
if (main_window) {
|
||||
float bar_pos_x = ImGui::GetCursorPosX() + 6;
|
||||
float bar_pos_y = ImGui::GetCursorPosY() + 15;
|
||||
float bar_pos_x = ImGui::GetCursorPosX() + 6 * dpi_scale_;
|
||||
float bar_pos_y = ImGui::GetCursorPosY() + 15 * dpi_scale_;
|
||||
std::string menu_button = " "; // ICON_FA_BARS;
|
||||
if (ImGui::BeginMenu(menu_button.c_str())) {
|
||||
ImGui::SetWindowFontScale(0.5f);
|
||||
ImGui::SetWindowFontScale(0.6f);
|
||||
if (ImGui::MenuItem(
|
||||
localization::settings[localization_language_index_].c_str())) {
|
||||
show_settings_window_ = true;
|
||||
@@ -77,7 +77,7 @@ int Render::TitleBar(bool main_window) {
|
||||
|
||||
if (update_available_ && ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::SetWindowFontScale(0.5f);
|
||||
ImGui::SetWindowFontScale(0.5f * dpi_scale_);
|
||||
std::string new_version_available_str =
|
||||
localization::new_version_available
|
||||
[localization_language_index_] +
|
||||
@@ -87,13 +87,12 @@ int Render::TitleBar(bool main_window) {
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
ImGui::EndMenu();
|
||||
} else {
|
||||
show_new_version_icon_in_menu_ = true;
|
||||
}
|
||||
|
||||
float menu_bar_line_size = 15.0f;
|
||||
float menu_bar_line_size = 15.0f * dpi_scale_;
|
||||
draw_list->AddLine(ImVec2(bar_pos_x, bar_pos_y - 6),
|
||||
ImVec2(bar_pos_x + menu_bar_line_size, bar_pos_y - 6),
|
||||
IM_COL32(0, 0, 0, 255));
|
||||
@@ -136,6 +135,8 @@ int Render::TitleBar(bool main_window) {
|
||||
SelfHostedServerWindow();
|
||||
AboutWindow();
|
||||
}
|
||||
} else {
|
||||
ImGui::SetWindowFontScale(1.2f);
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(2);
|
||||
@@ -148,15 +149,15 @@ int Render::TitleBar(bool main_window) {
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive,
|
||||
ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
float minimize_pos_x = ImGui::GetCursorPosX() + 12;
|
||||
float minimize_pos_y = ImGui::GetCursorPosY() + 15;
|
||||
float minimize_pos_x = ImGui::GetCursorPosX() + 12.0f * dpi_scale_;
|
||||
float minimize_pos_y = ImGui::GetCursorPosY() + 15.0f * dpi_scale_;
|
||||
std::string window_minimize_button = "##minimize"; // ICON_FA_MINUS;
|
||||
if (ImGui::Button(window_minimize_button.c_str(),
|
||||
ImVec2(BUTTON_PADDING, 30))) {
|
||||
ImVec2(BUTTON_PADDING, 30.0f * dpi_scale_))) {
|
||||
SDL_MinimizeWindow(main_window ? main_window_ : stream_window_);
|
||||
}
|
||||
draw_list->AddLine(ImVec2(minimize_pos_x, minimize_pos_y),
|
||||
ImVec2(minimize_pos_x + 12, minimize_pos_y),
|
||||
ImVec2(minimize_pos_x + 12 * dpi_scale_, minimize_pos_y),
|
||||
IM_COL32(0, 0, 0, 255));
|
||||
ImGui::PopStyleColor(2);
|
||||
|
||||
@@ -167,33 +168,36 @@ int Render::TitleBar(bool main_window) {
|
||||
ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
if (window_maximized_) {
|
||||
float pos_x_top = ImGui::GetCursorPosX() + 11;
|
||||
float pos_y_top = ImGui::GetCursorPosY() + 11;
|
||||
float pos_x_bottom = ImGui::GetCursorPosX() + 13;
|
||||
float pos_y_bottom = ImGui::GetCursorPosY() + 9;
|
||||
float pos_x_top = ImGui::GetCursorPosX() + 11 * dpi_scale_;
|
||||
float pos_y_top = ImGui::GetCursorPosY() + 11 * dpi_scale_;
|
||||
float pos_x_bottom = ImGui::GetCursorPosX() + 13 * dpi_scale_;
|
||||
float pos_y_bottom = ImGui::GetCursorPosY() + 9 * dpi_scale_;
|
||||
std::string window_restore_button =
|
||||
"##restore"; // ICON_FA_WINDOW_RESTORE;
|
||||
if (ImGui::Button(window_restore_button.c_str(),
|
||||
ImVec2(BUTTON_PADDING, 30))) {
|
||||
ImVec2(BUTTON_PADDING, 30.0f * dpi_scale_))) {
|
||||
SDL_RestoreWindow(stream_window_);
|
||||
window_maximized_ = false;
|
||||
}
|
||||
draw_list->AddRect(ImVec2(pos_x_top, pos_y_top),
|
||||
ImVec2(pos_x_top + 12, pos_y_top + 12),
|
||||
IM_COL32(0, 0, 0, 255));
|
||||
draw_list->AddRect(
|
||||
ImVec2(pos_x_top, pos_y_top),
|
||||
ImVec2(pos_x_top + 12 * dpi_scale_, pos_y_top + 12 * dpi_scale_),
|
||||
IM_COL32(0, 0, 0, 255));
|
||||
draw_list->AddRect(ImVec2(pos_x_bottom, pos_y_bottom),
|
||||
ImVec2(pos_x_bottom + 12, pos_y_bottom + 12),
|
||||
ImVec2(pos_x_bottom + 12 * dpi_scale_,
|
||||
pos_y_bottom + 12 * dpi_scale_),
|
||||
IM_COL32(0, 0, 0, 255));
|
||||
draw_list->AddRectFilled(ImVec2(pos_x_top + 1, pos_y_top + 1),
|
||||
ImVec2(pos_x_top + 11, pos_y_top + 11),
|
||||
IM_COL32(255, 255, 255, 255));
|
||||
draw_list->AddRectFilled(
|
||||
ImVec2(pos_x_top + 1 * dpi_scale_, pos_y_top + 1 * dpi_scale_),
|
||||
ImVec2(pos_x_top + 11 * dpi_scale_, pos_y_top + 11 * dpi_scale_),
|
||||
IM_COL32(255, 255, 255, 255));
|
||||
} else {
|
||||
float maximize_pos_x = ImGui::GetCursorPosX() + 12;
|
||||
float maximize_pos_y = ImGui::GetCursorPosY() + 10;
|
||||
float maximize_pos_x = ImGui::GetCursorPosX() + 12 * dpi_scale_;
|
||||
float maximize_pos_y = ImGui::GetCursorPosY() + 10 * dpi_scale_;
|
||||
std::string window_maximize_button =
|
||||
"##maximize"; // ICON_FA_SQUARE_FULL;
|
||||
if (ImGui::Button(window_maximize_button.c_str(),
|
||||
ImVec2(BUTTON_PADDING, 30))) {
|
||||
ImVec2(BUTTON_PADDING, 30.0f * dpi_scale_))) {
|
||||
SDL_MaximizeWindow(stream_window_);
|
||||
window_maximized_ = !window_maximized_;
|
||||
}
|
||||
@@ -210,11 +214,12 @@ int Render::TitleBar(bool main_window) {
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.0f, 0, 0, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(1.0f, 0, 0, 0.5f));
|
||||
|
||||
float xmark_pos_x = ImGui::GetCursorPosX() + 18;
|
||||
float xmark_pos_y = ImGui::GetCursorPosY() + 16;
|
||||
float xmark_size = 12.0f;
|
||||
float xmark_pos_x = ImGui::GetCursorPosX() + 18 * dpi_scale_;
|
||||
float xmark_pos_y = ImGui::GetCursorPosY() + 16 * dpi_scale_;
|
||||
float xmark_size = 12.0f * dpi_scale_;
|
||||
std::string close_button = "##xmark"; // ICON_FA_XMARK;
|
||||
if (ImGui::Button(close_button.c_str(), ImVec2(BUTTON_PADDING, 30))) {
|
||||
if (ImGui::Button(close_button.c_str(),
|
||||
ImVec2(BUTTON_PADDING, 30.0f * dpi_scale_))) {
|
||||
#if _WIN32
|
||||
if (enable_minimize_to_tray_) {
|
||||
tray_->MinimizeToTray();
|
||||
|
||||
Reference in New Issue
Block a user