mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
Fix stream render with menu bar
This commit is contained in:
82
src/single_window/remote_peer_window.cpp
Normal file
82
src/single_window/remote_peer_window.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
#include "IconsFontAwesome6.h"
|
||||
#include "layout_style.h"
|
||||
#include "localization.h"
|
||||
#include "log.h"
|
||||
#include "render.h"
|
||||
|
||||
int Render::RemoteWindow() {
|
||||
// if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) {
|
||||
// ImGui::SetNextWindowSize(
|
||||
// ImVec2(main_window_width_ - MENU_WINDOW_WIDTH_CN,
|
||||
// main_window_height_ - menu_window_height_));
|
||||
// } else {
|
||||
// ImGui::SetNextWindowSize(
|
||||
// ImVec2(MENU_WINDOW_WIDTH_EN, MENU_WINDOW_HEIGHT_EN));
|
||||
// }
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(local_window_width_, menu_window_height_),
|
||||
ImGuiCond_Always);
|
||||
|
||||
ImGui::BeginChild(
|
||||
"test",
|
||||
ImVec2(main_window_width_ - local_window_width_, main_window_height_),
|
||||
ImGuiChildFlags_Border,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar);
|
||||
|
||||
ImGui::SetWindowFontScale(0.5f);
|
||||
ImGui::Text(u8"Զ<EFBFBD>̿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 10.0f);
|
||||
ImGui::BeginChild(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>2", ImVec2(330, 180), ImGuiChildFlags_Border);
|
||||
{
|
||||
ImGui::SetWindowFontScale(0.5f);
|
||||
|
||||
ImGui::Text(localization::remote_id[localization_language_index_].c_str());
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::SetNextItemWidth(IPUT_WINDOW_WIDTH);
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
ImGui::InputText(
|
||||
"##remote_id_", remote_id_, IM_ARRAYSIZE(remote_id_),
|
||||
ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank);
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(ICON_FA_ARROW_RIGHT_LONG, ImVec2(55, 35)) || rejoin_) {
|
||||
int ret = -1;
|
||||
if ("SignalConnected" == signal_status_str_) {
|
||||
if (!connection_established_ && strlen(remote_id_)) {
|
||||
if (remote_id_ == local_id_ && !peer_reserved_) {
|
||||
peer_reserved_ = CreatePeer(¶ms_);
|
||||
if (peer_reserved_) {
|
||||
LOG_INFO("Create peer[reserved] instance successful");
|
||||
std::string local_id = "C-" + mac_addr_str_;
|
||||
Init(peer_reserved_, local_id.c_str());
|
||||
LOG_INFO("Peer[reserved] init finish");
|
||||
} else {
|
||||
LOG_INFO("Create peer[reserved] instance failed");
|
||||
}
|
||||
}
|
||||
ret = JoinConnection(peer_reserved_ ? peer_reserved_ : peer_,
|
||||
remote_id_, client_password_);
|
||||
if (0 == ret) {
|
||||
if (!peer_reserved_) {
|
||||
is_client_mode_ = true;
|
||||
}
|
||||
rejoin_ = false;
|
||||
} else {
|
||||
rejoin_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::EndChild();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user