[feat] enable mouse control for multi-display

This commit is contained in:
dijunkun
2025-05-15 18:37:59 +08:00
parent 0a1014dded
commit 11358e0b60
6 changed files with 113 additions and 49 deletions

View File

@@ -58,9 +58,9 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
if (ImGui::BeginPopup("display")) {
ImGui::SetWindowFontScale(0.5f);
for (int i = 0; i < props->display_names_.size(); i++) {
if (ImGui::Selectable(props->display_names_[i].c_str())) {
selected_display_ = i + 1;
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 + 1;
RemoteAction remote_action;
remote_action.type = ControlType::display_id;
@@ -77,13 +77,13 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
ImGui::SetWindowFontScale(0.6f);
ImVec2 text_size =
ImGui::CalcTextSize(std::to_string(selected_display_).c_str());
ImGui::CalcTextSize(std::to_string(props->selected_display_).c_str());
ImVec2 text_pos =
ImVec2(btn_min.x + (btn_size_actual.x - text_size.x) * 0.5f,
btn_min.y + (btn_size_actual.y - text_size.y) * 0.5f - 2.0f);
ImGui::GetWindowDrawList()->AddText(
text_pos, IM_COL32(0, 0, 0, 255),
std::to_string(selected_display_).c_str());
std::to_string(props->selected_display_).c_str());
ImGui::SetWindowFontScale(1.0f);
ImGui::SameLine();