summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-07-25 20:39:03 +0300
committerAndrei Karas <akaras@inbox.ru>2017-07-25 20:39:03 +0300
commitfe64e7204c8ab7b91f36c305cce9f82e92792cb9 (patch)
tree47ac13448093d099d205b370740dc7952354799a
parent529335b0e534c86cb1e4d735d9f4ffd576da728b (diff)
downloadmv-fe64e7204c8ab7b91f36c305cce9f82e92792cb9.tar.gz
mv-fe64e7204c8ab7b91f36c305cce9f82e92792cb9.tar.bz2
mv-fe64e7204c8ab7b91f36c305cce9f82e92792cb9.tar.xz
mv-fe64e7204c8ab7b91f36c305cce9f82e92792cb9.zip
Update mouse cursor each 10 seconds if was no mouse move events.
-rw-r--r--src/gui/gui.cpp1
-rw-r--r--src/gui/sdlinput.cpp9
-rw-r--r--src/gui/sdlinput.h1
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;