1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

fix Main Thread Checker warnings on Apple platforms

This commit is contained in:
Andrey Filipenkov
2023-01-21 16:07:35 +03:00
parent 919c592e67
commit 7b2540517b

View File

@@ -16,6 +16,10 @@
#include "CAnimation.h"
#include "../../lib/CConfigHandler.h"
#ifdef VCMI_APPLE
#include <dispatch/dispatch.h>
#endif
std::unique_ptr<ICursor> CursorHandler::createCursor()
{
if (settings["video"]["cursor"].String() == "auto")
@@ -401,10 +405,16 @@ CursorHardware::~CursorHardware()
void CursorHardware::setVisible(bool on)
{
#ifdef VCMI_APPLE
dispatch_async(dispatch_get_main_queue(), ^{
#endif
if (on)
SDL_ShowCursor(SDL_ENABLE);
else
SDL_ShowCursor(SDL_DISABLE);
#ifdef VCMI_APPLE
});
#endif
}
void CursorHardware::setImage(std::shared_ptr<IImage> image, const Point & pivotOffset)
@@ -422,10 +432,16 @@ void CursorHardware::setImage(std::shared_ptr<IImage> image, const Point & pivot
logGlobal->error("Failed to set cursor! SDL says %s", SDL_GetError());
SDL_FreeSurface(cursorSurface);
#ifdef VCMI_APPLE
dispatch_async(dispatch_get_main_queue(), ^{
#endif
SDL_SetCursor(cursor);
if (oldCursor)
SDL_FreeCursor(oldCursor);
#ifdef VCMI_APPLE
});
#endif
}
void CursorHardware::setCursorPosition( const Point & newPos )