diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui.cpp | 1 | ||||
-rw-r--r-- | src/gui/sdlinput.cpp | 9 | ||||
-rw-r--r-- | src/gui/sdlinput.h | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index d1424b445..28eef21dd 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -362,6 +362,7 @@ void Gui::slowLogic() { mTime10 = time + 10; ResourceManager::cleanOrphans(); + guiInput->simulateMouseMove(); } } diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 6fc15dcbf..1219ad247 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -91,11 +91,14 @@ PRAGMA48(GCC diagnostic pop) #include "debug.h" +extern volatile time_t cur_time; + SDLInput *guiInput = nullptr; SDLInput::SDLInput() : mKeyInputQueue(), mMouseInputQueue(), + mMouseMoveTime(0), mMouseDown(false), mMouseInWindow(true) { @@ -265,6 +268,7 @@ void SDLInput::pushInput(const SDL_Event &event) mouseInput.setType(MouseEventType::MOVED); mouseInput.setTimeStamp(SDL_GetTicks()); mMouseInputQueue.push(mouseInput); + mMouseMoveTime = cur_time; break; } #ifndef USE_SDL2 @@ -285,6 +289,7 @@ void SDLInput::pushInput(const SDL_Event &event) mouseInput.setButton(MouseButton::EMPTY); mouseInput.setType(MouseEventType::MOVED); mMouseInputQueue.push(mouseInput); + mMouseMoveTime = cur_time; } } @@ -354,6 +359,10 @@ void SDLInput::simulateMouseMove() if (gui == nullptr) return; + if (mMouseMoveTime == cur_time) + return; + + mMouseMoveTime = cur_time; int x, y; Gui::getMouseState(x, y); diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index d2b7847df..5910911ef 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -380,6 +380,7 @@ class SDLInput final std::queue<KeyInput> mKeyInputQueue; std::queue<MouseInput> mMouseInputQueue; + time_t mMouseMoveTime; bool mMouseDown; bool mMouseInWindow; |