diff --git a/Source/3rdParty/rt64/src/api/rt64_api_plugin.cpp b/Source/3rdParty/rt64/src/api/rt64_api_plugin.cpp index c5981ac4e..3d3f1df3b 100644 --- a/Source/3rdParty/rt64/src/api/rt64_api_plugin.cpp +++ b/Source/3rdParty/rt64/src/api/rt64_api_plugin.cpp @@ -243,7 +243,7 @@ DLLEXPORT void CALL MouseMove(int x, int y) event.motion.y = y; if (RT64::API.app->presentQueue->inspector != nullptr) { - printf("MouseMove x = %i, y = %i\n", x,y); + //printf("MouseMove x = %i, y = %i\n", x,y); ImGui_ImplSDL2_ProcessEvent(&event); } } @@ -253,9 +253,14 @@ DLLEXPORT void CALL MouseButton(int left, int right) if (RT64::API.app->presentQueue->inspector != nullptr) { printf("MouseButton left = %i\n", left); SDL_Event event; + event.type = left ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP; event.button.button = SDL_BUTTON_LEFT; ImGui_ImplSDL2_ProcessEvent(&event); + + event.type = right ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP; + event.button.button = SDL_BUTTON_RIGHT; + ImGui_ImplSDL2_ProcessEvent(&event); } } diff --git a/Source/RMG/UserInterface/MainWindow.cpp b/Source/RMG/UserInterface/MainWindow.cpp index 711892548..793117d62 100644 --- a/Source/RMG/UserInterface/MainWindow.cpp +++ b/Source/RMG/UserInterface/MainWindow.cpp @@ -1281,7 +1281,10 @@ void MainWindow::on_EventFilter_MouseButtonPressed(QMouseEvent *event) return; } - CoreSetMouseButton((event->button() == Qt::MouseButton::LeftButton ? 1 : 0), (event->button() == Qt::MouseButton::RightButton ? 1 : 0)); + this->ui_LeftMouseButtonState = (event->button() == Qt::MouseButton::LeftButton ? 1 : this->ui_LeftMouseButtonState); + this->ui_RightMouseButtonState = (event->button() == Qt::MouseButton::RightButton ? 1 : this->ui_RightMouseButtonState); + + CoreSetMouseButton(this->ui_LeftMouseButtonState, this->ui_RightMouseButtonState); } void MainWindow::on_EventFilter_MouseButtonReleased(QMouseEvent *event) @@ -1292,7 +1295,10 @@ void MainWindow::on_EventFilter_MouseButtonReleased(QMouseEvent *event) return; } - CoreSetMouseButton((event->button() == Qt::MouseButton::LeftButton ? 0 : 1), (event->button() == Qt::MouseButton::RightButton ? 0 : 1)); + this->ui_LeftMouseButtonState = (event->button() == Qt::MouseButton::LeftButton ? 0 : this->ui_LeftMouseButtonState); + this->ui_RightMouseButtonState = (event->button() == Qt::MouseButton::RightButton ? 0 : this->ui_RightMouseButtonState); + + CoreSetMouseButton(this->ui_LeftMouseButtonState, this->ui_RightMouseButtonState); } void MainWindow::on_EventFilter_FileDropped(QDropEvent *event) diff --git a/Source/RMG/UserInterface/MainWindow.hpp b/Source/RMG/UserInterface/MainWindow.hpp index e0d3fe173..fda265bcc 100644 --- a/Source/RMG/UserInterface/MainWindow.hpp +++ b/Source/RMG/UserInterface/MainWindow.hpp @@ -116,6 +116,9 @@ class MainWindow : public QMainWindow, private Ui::MainWindow int ui_LoadSaveStateSlotCounter = 0; int ui_LoadSaveStateSlotTimerId = -1; + int ui_LeftMouseButtonState = 0; + int ui_RightMouseButtonState = 0; + QString ui_WindowTitle; Dialog::LogDialog logDialog;