1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

Replaced SDL user events list with dispatching of arbitrary functors

This commit is contained in:
Ivan Savenko
2023-06-26 21:51:10 +03:00
parent 7fc66c2797
commit 0f8d53e978
15 changed files with 176 additions and 177 deletions

View File

@@ -87,7 +87,9 @@ void CGuiHandler::handleEvents()
void CGuiHandler::fakeMouseMove()
{
pushUserEvent(EUserEvent::FAKE_MOUSE_MOVE);
dispatchMainThread([](){
GH.events().dispatchMouseMoved(Point(0, 0), GH.getCursorPosition());
});
}
void CGuiHandler::startTextInput(const Rect & whereInput)
@@ -203,14 +205,9 @@ bool CGuiHandler::amIGuiThread()
return inGuiThread.get() && *inGuiThread;
}
void CGuiHandler::pushUserEvent(EUserEvent usercode)
void CGuiHandler::dispatchMainThread(const std::function<void()> & functor)
{
inputHandlerInstance->pushUserEvent(usercode, nullptr);
}
void CGuiHandler::pushUserEvent(EUserEvent usercode, void * userdata)
{
inputHandlerInstance->pushUserEvent(usercode, userdata);
inputHandlerInstance->dispatchMainThread(functor);
}
IScreenHandler & CGuiHandler::screenHandler()