diff --git a/src/main_window/main_window.cpp b/src/main_window/main_window.cpp index 0e8e5f2..8d765de 100644 --- a/src/main_window/main_window.cpp +++ b/src/main_window/main_window.cpp @@ -347,7 +347,7 @@ int MainWindow::Run() { ImGui_ImplSDL2_NewFrame(); ImGui::NewFrame(); - if (connection_established_ && !menu_hovered_) { + if (connection_established_ && !subwindow_hovered_) { ImGui::SetMouseCursor(ImGuiMouseCursor_None); } @@ -374,7 +374,7 @@ int MainWindow::Run() { } { - menu_hovered_ = ImGui::IsWindowHovered(); + subwindow_hovered_ = ImGui::IsWindowHovered(); // local { @@ -569,6 +569,7 @@ int MainWindow::Run() { settings_window_pos_reset_ = false; } + // Settings ImGui::Begin( localization::settings[localization_language_index_].c_str(), nullptr, @@ -576,6 +577,8 @@ int MainWindow::Run() { ImGuiWindowFlags_NoSavedSettings); { + subwindow_hovered_ = ImGui::IsWindowHovered(); + const char *language_items[] = { localization::language_zh[localization_language_index_].c_str(), localization::language_en[localization_language_index_].c_str()}; diff --git a/src/main_window/main_window.h b/src/main_window/main_window.h index a470674..a36afd6 100644 --- a/src/main_window/main_window.h +++ b/src/main_window/main_window.h @@ -120,7 +120,7 @@ class MainWindow { bool exit_ = false; bool connection_established_ = false; - bool menu_hovered_ = false; + bool subwindow_hovered_ = false; bool connect_button_pressed_ = false; bool fullscreen_button_pressed_ = false; bool settings_button_pressed_ = false; diff --git a/src/main_window/main_window_callback_func.cpp b/src/main_window/main_window_callback_func.cpp index 0d86a28..86a871c 100644 --- a/src/main_window/main_window_callback_func.cpp +++ b/src/main_window/main_window_callback_func.cpp @@ -40,6 +40,9 @@ int MainWindow::ProcessMouseKeyEven(SDL_Event &ev) { } else if (SDL_BUTTON_RIGHT == ev.button.button) { remote_action.m.flag = MouseFlag::right_down; } + if (subwindow_hovered_) { + remote_action.m.flag = MouseFlag::move; + } SendData(peer_, DATA_TYPE::DATA, (const char *)&remote_action, sizeof(remote_action)); } else if (SDL_MOUSEBUTTONUP == ev.type) { @@ -49,6 +52,9 @@ int MainWindow::ProcessMouseKeyEven(SDL_Event &ev) { } else if (SDL_BUTTON_RIGHT == ev.button.button) { remote_action.m.flag = MouseFlag::right_up; } + if (subwindow_hovered_) { + remote_action.m.flag = MouseFlag::move; + } SendData(peer_, DATA_TYPE::DATA, (const char *)&remote_action, sizeof(remote_action)); } else if (SDL_MOUSEMOTION == ev.type) {