Compare commits

...

7 Commits

Author SHA1 Message Date
dijunkun
1f6a2182be [fix] resolve tab bar dragging issue 2025-12-06 18:46:04 +08:00
dijunkun
1a883f0d6c [fix] fix menu BeginPopup & EndPopup pairing 2025-12-05 17:53:17 +08:00
dijunkun
a560b4ca70 [feat] make thumbnail save asynchronous to prevent UI blocking 2025-12-05 17:07:55 +08:00
dijunkun
46f45ed216 [fix] fix tab close button not working in stream window 2025-12-05 15:18:35 +08:00
dijunkun
5c23f1c5e8 [fix] correct tab bar scaling and layout 2025-12-05 15:17:07 +08:00
dijunkun
70ae02549f [fix] correct title bar display 2025-12-05 04:28:33 +08:00
dijunkun
68de995c64 [fix] correct hardware codec setting item display 2025-12-05 00:57:33 +08:00
7 changed files with 182 additions and 120 deletions

View File

@@ -189,12 +189,12 @@ int Render::ConnectTo(const std::string& remote_id, const char* password,
props->params_.user_id = props->local_id_.c_str();
props->peer_ = CreatePeer(&props->params_);
props->control_window_width_ = title_bar_button_height_ * 7.5f;
props->control_window_height_ = title_bar_button_height_ * 1.16f;
props->control_window_min_width_ = title_bar_button_height_ * 0.65f;
props->control_window_min_height_ = title_bar_button_height_ * 1.16f;
props->control_window_max_width_ = title_bar_button_height_ * 7.5f;
props->control_window_max_height_ = title_bar_button_height_ * 6.0f;
props->control_window_width_ = title_bar_height_ * 8.0f;
props->control_window_height_ = title_bar_height_ * 1.3f;
props->control_window_min_width_ = title_bar_height_ * 0.65f;
props->control_window_min_height_ = title_bar_height_ * 1.3f;
props->control_window_max_width_ = title_bar_height_ * 8.0f;
props->control_window_max_height_ = title_bar_height_ * 6.0f;
if (!props->peer_) {
LOG_INFO("Create peer [{}] instance failed", props->local_id_);

View File

@@ -6,6 +6,7 @@
#include <fstream>
#include <iostream>
#include <string>
#include <thread>
#include "OPPOSans_Regular.h"
#include "device_controller_factory.h"
@@ -20,8 +21,6 @@
#define NV12_BUFFER_SIZE 1280 * 720 * 3 / 2
#define MOUSE_GRAB_PADDING 5
namespace crossdesk {
std::vector<char> Render::SerializeRemoteAction(const RemoteAction& action) {
@@ -133,9 +132,39 @@ SDL_HitTestResult Render::HitTestCallback(SDL_Window* window,
int window_width, window_height;
SDL_GetWindowSize(window, &window_width, &window_height);
if (area->y < 30 * render->dpi_scale_ && area->y > MOUSE_GRAB_PADDING &&
area->x < window_width - 120 * render->dpi_scale_ &&
area->x > MOUSE_GRAB_PADDING && !render->is_tab_bar_hovered_) {
// check if curosor is in tab bar
if (render->stream_window_inited_ && render->stream_window_created_ &&
!render->fullscreen_button_pressed_ && render->stream_ctx_) {
ImGuiContext* prev_ctx = ImGui::GetCurrentContext();
ImGui::SetCurrentContext(render->stream_ctx_);
ImGuiWindow* tab_bar_window = ImGui::FindWindowByName("TabBar");
if (tab_bar_window && tab_bar_window->Active) {
ImGuiIO& io = ImGui::GetIO();
float scale_x = io.DisplayFramebufferScale.x;
float scale_y = io.DisplayFramebufferScale.y;
float tab_bar_x = tab_bar_window->Pos.x * scale_x;
float tab_bar_y = tab_bar_window->Pos.y * scale_y;
float tab_bar_width = tab_bar_window->Size.x * scale_x;
float tab_bar_height = tab_bar_window->Size.y * scale_y;
ImGui::SetCurrentContext(prev_ctx);
if (area->x >= tab_bar_x && area->x <= tab_bar_x + tab_bar_width &&
area->y >= tab_bar_y && area->y <= tab_bar_y + tab_bar_height) {
return SDL_HITTEST_NORMAL;
}
} else {
ImGui::SetCurrentContext(prev_ctx);
}
}
float mouse_grab_padding = render->title_bar_button_width_ * 0.16f;
if (area->y < render->title_bar_button_width_ &&
area->y > mouse_grab_padding &&
area->x < window_width - render->title_bar_button_width_ * 4.0f &&
area->x > mouse_grab_padding) {
return SDL_HITTEST_DRAGGABLE;
}
@@ -143,25 +172,25 @@ SDL_HitTestResult Render::HitTestCallback(SDL_Window* window,
// return SDL_HITTEST_NORMAL;
// }
if (area->y < MOUSE_GRAB_PADDING) {
if (area->x < MOUSE_GRAB_PADDING) {
if (area->y < mouse_grab_padding) {
if (area->x < mouse_grab_padding) {
return SDL_HITTEST_RESIZE_TOPLEFT;
} else if (area->x > window_width - MOUSE_GRAB_PADDING) {
} else if (area->x > window_width - mouse_grab_padding) {
return SDL_HITTEST_RESIZE_TOPRIGHT;
} else {
return SDL_HITTEST_RESIZE_TOP;
}
} else if (area->y > window_height - MOUSE_GRAB_PADDING) {
if (area->x < MOUSE_GRAB_PADDING) {
} else if (area->y > window_height - mouse_grab_padding) {
if (area->x < mouse_grab_padding) {
return SDL_HITTEST_RESIZE_BOTTOMLEFT;
} else if (area->x > window_width - MOUSE_GRAB_PADDING) {
} else if (area->x > window_width - mouse_grab_padding) {
return SDL_HITTEST_RESIZE_BOTTOMRIGHT;
} else {
return SDL_HITTEST_RESIZE_BOTTOM;
}
} else if (area->x < MOUSE_GRAB_PADDING) {
} else if (area->x < mouse_grab_padding) {
return SDL_HITTEST_RESIZE_LEFT;
} else if (area->x > window_width - MOUSE_GRAB_PADDING) {
} else if (area->x > window_width - mouse_grab_padding) {
return SDL_HITTEST_RESIZE_RIGHT;
}
@@ -207,7 +236,7 @@ int Render::LoadSettingsFromCacheFile() {
memset(aes128_iv_, 0, sizeof(aes128_iv_));
thumbnail_.reset();
thumbnail_ = std::make_unique<Thumbnail>(cache_path_ + "/thumbnails/");
thumbnail_ = std::make_shared<Thumbnail>(cache_path_ + "/thumbnails/");
thumbnail_->GetKeyAndIv(aes128_key_, aes128_iv_);
thumbnail_->DeleteAllFilesInDirectory();
@@ -248,7 +277,7 @@ int Render::LoadSettingsFromCacheFile() {
memcpy(aes128_iv_, cd_cache_.iv, sizeof(cd_cache_.iv));
thumbnail_.reset();
thumbnail_ = std::make_unique<Thumbnail>(cache_path_ + "/thumbnails/",
thumbnail_ = std::make_shared<Thumbnail>(cache_path_ + "/thumbnails/",
aes128_key_, aes128_iv_);
language_button_value_ = (int)config_center_->GetLanguage();
@@ -605,53 +634,6 @@ void Render::UpdateInteractions() {
}
}
int Render::UpdateWindowSizeWithDpiScale(float dpi_scale) {
main_window_width_ = (int)(main_window_width_default_ * dpi_scale);
main_window_height_ = (int)(main_window_height_default_ * dpi_scale);
stream_window_width_ = (int)(stream_window_width_default_ * dpi_scale);
stream_window_height_ = (int)(stream_window_height_default_ * dpi_scale);
local_window_width_ = (int)(local_window_width_ * dpi_scale);
local_window_height_ = (int)(local_window_height_ * dpi_scale);
remote_window_width_ = (int)(remote_window_width_ * dpi_scale);
remote_window_height_ = (int)(remote_window_height_ * dpi_scale);
local_child_window_width_ = (int)(local_child_window_width_ * dpi_scale);
local_child_window_height_ = (int)(local_child_window_height_ * dpi_scale);
remote_child_window_width_ = (int)(remote_child_window_width_ * dpi_scale);
remote_child_window_height_ = (int)(remote_child_window_height_ * dpi_scale);
main_window_text_y_padding_ = (int)(main_window_text_y_padding_ * dpi_scale);
main_child_window_x_padding_ =
(int)(main_child_window_x_padding_ * dpi_scale);
main_child_window_y_padding_ =
(int)(main_child_window_y_padding_ * dpi_scale);
title_bar_width_ = (int)(title_bar_width_ * dpi_scale);
title_bar_height_ = (int)(title_bar_height_ * dpi_scale);
status_bar_height_ = (int)(status_bar_height_ * dpi_scale);
connection_status_window_width_ =
(int)(connection_status_window_width_ * dpi_scale);
connection_status_window_height_ =
(int)(connection_status_window_height_ * dpi_scale);
notification_window_width_ = (int)(notification_window_width_ * dpi_scale);
notification_window_height_ = (int)(notification_window_height_ * dpi_scale);
about_window_width_ = (int)(about_window_width_ * dpi_scale);
about_window_height_ = (int)(about_window_height_ * dpi_scale);
update_notification_window_width_ =
(int)(update_notification_window_width_ * dpi_scale);
update_notification_window_height_ =
(int)(update_notification_window_height_ * dpi_scale);
recent_connection_image_width_ =
(int)(recent_connection_image_width_ * dpi_scale);
recent_connection_image_height_ =
(int)(recent_connection_image_height_ * dpi_scale);
if (thumbnail_) {
thumbnail_->SetThumbnailDpiScale(dpi_scale);
}
return 0;
}
int Render::CreateMainWindow() {
main_ctx_ = ImGui::CreateContext();
if (!main_ctx_) {
@@ -759,6 +741,10 @@ int Render::CreateStreamWindow() {
SetupFontAndStyle(false);
ImGuiStyle& style = ImGui::GetStyle();
style.ScaleAllSizes(dpi_scale_);
style.FontScaleDpi = dpi_scale_;
ImGui_ImplSDL3_InitForSDLRenderer(stream_window_, stream_renderer_);
ImGui_ImplSDLRenderer3_Init(stream_renderer_);
@@ -924,9 +910,9 @@ int Render::DrawMainWindow() {
ImGui::SetNextWindowSize(ImVec2(io.DisplaySize.x, io.DisplaySize.y),
ImGuiCond_Always);
ImGui::Begin("MainRender", nullptr,
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar |
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar |
ImGuiWindowFlags_NoBringToFrontOnFocus);
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration |
ImGuiWindowFlags_NoBringToFrontOnFocus |
ImGuiWindowFlags_NoDocking);
ImGui::PopStyleColor();
TitleBar(true);
@@ -968,24 +954,31 @@ int Render::DrawStreamWindow() {
StreamWindow();
if (!fullscreen_button_pressed_) {
ImGuiIO& io = ImGui::GetIO();
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
ImGui::SetNextWindowSize(
ImVec2(io.DisplaySize.x,
fullscreen_button_pressed_ ? 0 : title_bar_button_height_),
ImGuiCond_Always);
ImGui::Begin("StreamWindowTitleBar", nullptr,
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration |
ImGuiWindowFlags_NoBringToFrontOnFocus |
ImGuiWindowFlags_NoDocking);
ImGuiIO& io = ImGui::GetIO();
float stream_title_window_height =
fullscreen_button_pressed_ ? 0 : title_bar_height_;
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
// Set minimum window size to 0 to allow exact height control
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(io.DisplaySize.x, stream_title_window_height),
ImGuiCond_Always);
ImGui::Begin("StreamTitleWindow", nullptr,
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration |
ImGuiWindowFlags_NoBringToFrontOnFocus |
ImGuiWindowFlags_NoDocking);
ImGui::PopStyleVar(2);
ImGui::PopStyleColor();
if (!fullscreen_button_pressed_) {
TitleBar(false);
ImGui::End();
}
ImGui::End();
// Rendering
ImGuiIO& io = ImGui::GetIO();
(void)io;
ImGui::Render();
SDL_SetRenderScale(stream_renderer_, io.DisplayFramebufferScale.x,
@@ -1273,6 +1266,9 @@ void Render::Cleanup() {
CleanupFactories();
CleanupPeers();
WaitForThumbnailSaveTasks();
AudioDeviceDestroy();
DestroyMainWindowContext();
DestroyMainWindow();
@@ -1300,10 +1296,29 @@ void Render::CleanupPeer(std::shared_ptr<SubStreamWindowProperties> props) {
SDL_FlushEvent(STREAM_REFRESH_EVENT);
if (props->dst_buffer_) {
thumbnail_->SaveToThumbnail(
(char*)props->dst_buffer_, props->video_width_, props->video_height_,
props->remote_id_, props->remote_host_name_,
props->remember_password_ ? props->remote_password_ : "");
size_t buffer_size = props->dst_buffer_capacity_;
std::vector<unsigned char> buffer_copy(buffer_size);
memcpy(buffer_copy.data(), props->dst_buffer_, buffer_size);
int video_width = props->video_width_;
int video_height = props->video_height_;
std::string remote_id = props->remote_id_;
std::string remote_host_name = props->remote_host_name_;
std::string password =
props->remember_password_ ? props->remote_password_ : "";
std::thread save_thread([buffer_copy, video_width, video_height, remote_id,
remote_host_name, password,
thumbnail = thumbnail_]() {
thumbnail->SaveToThumbnail((char*)buffer_copy.data(), video_width,
video_height, remote_id, remote_host_name,
password);
});
{
std::lock_guard<std::mutex> lock(thumbnail_save_threads_mutex_);
thumbnail_save_threads_.emplace_back(std::move(save_thread));
}
}
if (props->peer_) {
@@ -1341,6 +1356,25 @@ void Render::CleanupPeers() {
}
}
void Render::WaitForThumbnailSaveTasks() {
std::vector<std::thread> threads_to_join;
{
std::lock_guard<std::mutex> lock(thumbnail_save_threads_mutex_);
threads_to_join.swap(thumbnail_save_threads_);
}
if (threads_to_join.empty()) {
return;
}
for (auto& thread : threads_to_join) {
if (thread.joinable()) {
thread.join();
}
}
}
void Render::CleanSubStreamWindowProperties(
std::shared_ptr<SubStreamWindowProperties> props) {
if (props->stream_texture_) {

View File

@@ -18,6 +18,7 @@
#include <shared_mutex>
#include <string>
#include <unordered_map>
#include <vector>
#include "IconsFontAwesome6.h"
#include "config_center.h"
@@ -175,7 +176,6 @@ class Render {
private:
int ConnectTo(const std::string& remote_id, const char* password,
bool remember_password);
int UpdateWindowSizeWithDpiScale(float dpi_scale);
int CreateMainWindow();
int DestroyMainWindow();
int CreateStreamWindow();
@@ -302,7 +302,7 @@ class Render {
// thumbnail
unsigned char aes128_key_[16];
unsigned char aes128_iv_[16];
std::unique_ptr<Thumbnail> thumbnail_;
std::shared_ptr<Thumbnail> thumbnail_;
// recent connections
std::vector<std::pair<std::string, Thumbnail::RecentConnection>>
@@ -513,6 +513,11 @@ class Render {
void CloseTab(decltype(client_properties_)::iterator& it);
/* ------ stream window property end ------ */
/* ------ async thumbnail save tasks ------ */
std::vector<std::thread> thumbnail_save_threads_;
std::mutex thumbnail_save_threads_mutex_;
void WaitForThumbnailSaveTasks();
/* ------ server mode ------ */
std::unordered_map<std::string, ConnectionStatus> connection_status_;
};

View File

@@ -32,29 +32,29 @@ int LossRateDisplay(float loss_rate) {
}
int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
float button_width = title_bar_button_height_ * 0.8f;
float button_height = title_bar_button_height_ * 0.8f;
float line_padding = title_bar_button_height_ * 0.12f;
float line_thickness = title_bar_button_height_ * 0.07f;
float button_width = title_bar_height_ * 0.8f;
float button_height = title_bar_height_ * 0.8f;
float line_padding = title_bar_height_ * 0.12f;
float line_thickness = title_bar_height_ * 0.07f;
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
if (props->control_bar_expand_) {
ImGui::SetCursorPosX(props->is_control_bar_in_left_
? props->control_window_width_ * 1.02f
: props->control_window_width_ * 0.23f);
? props->control_window_width_ * 1.03f
: props->control_window_width_ * 0.2f);
ImDrawList* draw_list = ImGui::GetWindowDrawList();
if (!props->is_control_bar_in_left_) {
draw_list->AddLine(
ImVec2(ImGui::GetCursorScreenPos().x - button_height * 0.48f,
ImVec2(ImGui::GetCursorScreenPos().x - button_height * 0.56f,
ImGui::GetCursorScreenPos().y + button_height * 0.2f),
ImVec2(ImGui::GetCursorScreenPos().x - button_height * 0.48f,
ImVec2(ImGui::GetCursorScreenPos().x - button_height * 0.56f,
ImGui::GetCursorScreenPos().y + button_height * 0.8f),
IM_COL32(178, 178, 178, 255), 2.0f);
}
std::string display = ICON_FA_DISPLAY;
ImGui::SetWindowFontScale(0.8f);
ImGui::SetWindowFontScale(0.5f);
if (ImGui::Button(display.c_str(), ImVec2(button_width, button_height))) {
ImGui::OpenPopup("display");
}
@@ -63,7 +63,7 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
ImVec2 btn_size_actual = ImGui::GetItemRectSize();
if (ImGui::BeginPopup("display")) {
ImGui::SetWindowFontScale(0.8f);
ImGui::SetWindowFontScale(0.5f);
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;
@@ -100,7 +100,7 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
std::string mouse = props->mouse_control_button_pressed_
? ICON_FA_COMPUTER_MOUSE
: ICON_FA_COMPUTER_MOUSE;
ImGui::SetWindowFontScale(0.8f);
ImGui::SetWindowFontScale(0.5f);
if (ImGui::Button(mouse.c_str(), ImVec2(button_width, button_height))) {
if (props->connection_established_) {
start_keyboard_capturer_ = !start_keyboard_capturer_;
@@ -140,7 +140,7 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
std::string audio = props->audio_capture_button_pressed_
? ICON_FA_VOLUME_HIGH
: ICON_FA_VOLUME_HIGH;
ImGui::SetWindowFontScale(0.8f);
ImGui::SetWindowFontScale(0.5f);
if (ImGui::Button(audio.c_str(), ImVec2(button_width, button_height))) {
if (props->connection_established_) {
props->audio_capture_button_pressed_ =
@@ -184,7 +184,7 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
button_color_style_pushed = true;
}
std::string net_traffic_stats = ICON_FA_SIGNAL;
ImGui::SetWindowFontScale(0.8f);
ImGui::SetWindowFontScale(0.5f);
if (ImGui::Button(net_traffic_stats.c_str(),
ImVec2(button_width, button_height))) {
props->net_traffic_stats_button_pressed_ =
@@ -208,7 +208,7 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
// fullscreen button
std::string fullscreen =
fullscreen_button_pressed_ ? ICON_FA_COMPRESS : ICON_FA_EXPAND;
ImGui::SetWindowFontScale(0.8f);
ImGui::SetWindowFontScale(0.5f);
if (ImGui::Button(fullscreen.c_str(),
ImVec2(button_width, button_height))) {
fullscreen_button_pressed_ = !fullscreen_button_pressed_;
@@ -228,7 +228,7 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
ImGui::SameLine();
// close button
std::string close_button = ICON_FA_XMARK;
ImGui::SetWindowFontScale(0.8f);
ImGui::SetWindowFontScale(0.5f);
if (ImGui::Button(close_button.c_str(),
ImVec2(button_width, button_height))) {
CleanupPeer(props);
@@ -250,7 +250,7 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
float expand_button_pos_x =
props->control_bar_expand_ ? (props->is_control_bar_in_left_
? props->control_window_width_ * 1.9f
? props->control_window_width_ * 1.91f
: props->control_window_width_ * 0.03f)
: (props->is_control_bar_in_left_
? props->control_window_width_ * 1.02f
@@ -290,7 +290,7 @@ int Render::NetTrafficStats(std::shared_ptr<SubStreamWindowProperties>& props) {
? props->control_window_width_ * 1.02f
: props->control_window_width_ * 0.02f,
props->control_window_min_height_));
ImGui::SetWindowFontScale(0.8f);
ImGui::SetWindowFontScale(0.5f);
if (ImGui::BeginTable("NetTrafficStats", 4, ImGuiTableFlags_BordersH,
ImVec2(props->control_window_max_width_ * 0.9f,
props->control_window_max_height_ - 0.9f))) {

View File

@@ -11,11 +11,13 @@ int Render::TitleBar(bool main_window) {
ImGuiIO& io = ImGui::GetIO();
float title_bar_width = title_bar_width_;
float title_bar_height = title_bar_height_;
float title_bar_height_padding = title_bar_height_;
float title_bar_button_width = title_bar_button_width_;
float title_bar_button_height = title_bar_button_height_;
if (main_window) {
title_bar_width = io.DisplaySize.x;
title_bar_height = io.DisplaySize.y * (TITLE_BAR_HEIGHT + 0.01f);
title_bar_height = io.DisplaySize.y * TITLE_BAR_HEIGHT;
title_bar_height_padding = io.DisplaySize.y * (TITLE_BAR_HEIGHT + 0.01f);
title_bar_button_width = io.DisplaySize.x * TITLE_BAR_BUTTON_WIDTH;
title_bar_button_height = io.DisplaySize.y * TITLE_BAR_BUTTON_HEIGHT;
title_bar_height_ = title_bar_height;
@@ -32,7 +34,7 @@ int Render::TitleBar(bool main_window) {
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
ImGui::BeginChild(main_window ? "MainTitleBar" : "StreamTitleBar",
ImVec2(title_bar_width, title_bar_height),
ImVec2(title_bar_width, title_bar_height_padding),
ImGuiChildFlags_Border,
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoBringToFrontOnFocus);
@@ -120,7 +122,7 @@ int Render::TitleBar(bool main_window) {
if (update_available_ && ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::SetWindowFontScale(0.5f * dpi_scale_);
ImGui::SetWindowFontScale(0.5f);
std::string new_version_available_str =
localization::new_version_available[localization_language_index_] +
": " + latest_version_;
@@ -129,7 +131,7 @@ int Render::TitleBar(bool main_window) {
ImGui::EndTooltip();
}
ImGui::EndMenu();
ImGui::EndPopup();
} else {
show_new_version_icon_in_menu_ = true;
}
@@ -150,7 +152,9 @@ int Render::TitleBar(bool main_window) {
// render for 1 second
if (show_new_version_icon_) {
ImGui::SetWindowFontScale(0.6f);
ImGui::SetCursorPos(ImVec2(bar_pos_x + 10, bar_pos_y - 17));
ImGui::SetCursorPos(
ImVec2(bar_pos_x + title_bar_button_width * 0.15f,
bar_pos_y - title_bar_button_width * 0.325f));
ImGui::Text(ICON_FA_TRIANGLE_EXCLAMATION);
ImGui::SetWindowFontScale(1.0f);

View File

@@ -11,7 +11,9 @@ int Render::SettingWindow() {
if (settings_window_pos_reset_) {
const ImGuiViewport* viewport = ImGui::GetMainViewport();
if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) {
#if USE_CUDA && !defined(__aarch64__) && !defined(__arm__)
#if (((defined(_WIN32) || defined(__linux__)) && !defined(__aarch64__) && \
!defined(__arm__) && USE_CUDA) || \
defined(__APPLE__))
ImGui::SetNextWindowPos(
ImVec2(io.DisplaySize.x * 0.343f, io.DisplaySize.y * 0.07f));
ImGui::SetNextWindowSize(
@@ -23,7 +25,9 @@ int Render::SettingWindow() {
ImVec2(io.DisplaySize.x * 0.315f, io.DisplaySize.y * 0.8f));
#endif
} else {
#if USE_CUDA && !defined(__aarch64__) && !defined(__arm__)
#if (((defined(_WIN32) || defined(__linux__)) && !defined(__aarch64__) && \
!defined(__arm__) && USE_CUDA) || \
defined(__APPLE__))
ImGui::SetNextWindowPos(
ImVec2(io.DisplaySize.x * 0.297f, io.DisplaySize.y * 0.07f));
ImGui::SetNextWindowSize(
@@ -197,7 +201,9 @@ int Render::SettingWindow() {
}
}
#if USE_CUDA && !defined(__aarch64__) && !defined(__arm__)
#if (((defined(_WIN32) || defined(__linux__)) && !defined(__aarch64__) && \
!defined(__arm__) && USE_CUDA) || \
defined(__APPLE__))
ImGui::Separator();
{

View File

@@ -70,11 +70,10 @@ int Render::StreamWindow() {
if (!fullscreen_button_pressed_) {
ImGui::SetNextWindowPos(
ImVec2(title_bar_height_ * 0.2f, title_bar_height_ * 0.2f),
ImGuiCond_Always);
ImGui::SetNextWindowSize(
ImVec2(title_bar_height_ * 4.0f, title_bar_height_ * 0.8f),
ImVec2(title_bar_button_width_ * 0.8f, title_bar_button_width_ * 0.1f),
ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(0, title_bar_button_width_ * 0.8f),
ImGuiCond_Always);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0.0f));
@@ -115,7 +114,7 @@ int Render::StreamWindow() {
: props->remote_id_;
if (ImGui::BeginTabItem(tab_label.c_str(), &props->tab_opened_)) {
props->tab_selected_ = true;
ImGui::SetWindowFontScale(0.6f * dpi_scale_);
ImGui::SetWindowFontScale(0.6f);
ImGui::SetNextWindowSize(
ImVec2(stream_window_width_, stream_window_height_),
@@ -171,6 +170,20 @@ int Render::StreamWindow() {
ImGui::EndTabItem();
} else {
props->tab_selected_ = false;
if (!props->tab_opened_) {
std::string remote_id_to_close = props->remote_id_;
// lock.unlock();
{
// std::unique_lock unique_lock(client_properties_mutex_);
auto close_it = client_properties_.find(remote_id_to_close);
if (close_it != client_properties_.end()) {
CloseTab(close_it);
}
}
// lock.lock();
it = client_properties_.begin();
continue;
}
++it;
}
}