[fix] fix mouse click event sending when control bar hovered

This commit is contained in:
dijunkun
2024-08-16 15:06:42 +08:00
parent c8602b0d89
commit 06a7243ac1
3 changed files with 4 additions and 3 deletions

View File

@@ -114,6 +114,7 @@ int Render::ControlWindow() {
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ControlBar(); ControlBar();
control_bar_hovered_ = ImGui::IsWindowHovered();
ImGui::EndChild(); ImGui::EndChild();
ImGui::End(); ImGui::End();

View File

@@ -181,7 +181,7 @@ class Render {
bool exit_ = false; bool exit_ = false;
bool exit_video_window_ = false; bool exit_video_window_ = false;
bool connection_established_ = false; bool connection_established_ = false;
bool subwindow_hovered_ = false; bool control_bar_hovered_ = false;
bool connect_button_pressed_ = false; bool connect_button_pressed_ = false;
bool password_validating_ = false; bool password_validating_ = false;
uint32_t password_validating_time_ = 0; uint32_t password_validating_time_ = 0;

View File

@@ -45,7 +45,7 @@ int Render::ProcessMouseKeyEven(SDL_Event &ev) {
} else if (SDL_BUTTON_RIGHT == ev.button.button) { } else if (SDL_BUTTON_RIGHT == ev.button.button) {
remote_action.m.flag = MouseFlag::right_down; remote_action.m.flag = MouseFlag::right_down;
} }
if (subwindow_hovered_) { if (control_bar_hovered_) {
remote_action.m.flag = MouseFlag::move; remote_action.m.flag = MouseFlag::move;
} }
SendData(peer_, DATA_TYPE::DATA, (const char *)&remote_action, SendData(peer_, DATA_TYPE::DATA, (const char *)&remote_action,
@@ -57,7 +57,7 @@ int Render::ProcessMouseKeyEven(SDL_Event &ev) {
} else if (SDL_BUTTON_RIGHT == ev.button.button) { } else if (SDL_BUTTON_RIGHT == ev.button.button) {
remote_action.m.flag = MouseFlag::right_up; remote_action.m.flag = MouseFlag::right_up;
} }
if (subwindow_hovered_) { if (control_bar_hovered_) {
remote_action.m.flag = MouseFlag::move; remote_action.m.flag = MouseFlag::move;
} }
SendData(peer_, DATA_TYPE::DATA, (const char *)&remote_action, SendData(peer_, DATA_TYPE::DATA, (const char *)&remote_action,