Commit 88b58830 authored by carnivoroussociety's avatar carnivoroussociety Committed by NY00123
Browse files

Fixed SDL1.2 legacy support

parent f54d7961
......@@ -48,16 +48,18 @@ static FORCE_INLINE void mutex_unlock(mutex_t *mutex)
#endif
}
#if SDL_MAJOR_VERSION != 1
static FORCE_INLINE bool mutex_try(mutex_t *mutex)
{
#if SDL_MAJOR_VERSION >= 2
return SDL_AtomicTryLock(mutex);
#elif defined _WIN32
return TryEnterCriticalSection(mutex);
#elif SDL_MAJOR_VERSION == 1
return SDL_TryLockMutex(*mutex);
#else
# error No mutex try implementation provided.
#endif
}
#endif
#ifdef __cplusplus
}
......
......@@ -1408,6 +1408,8 @@ void videoGetModes(int display)
modeschecked = 1;
}
#else
void videoGetModes(int display);
#endif
//
......@@ -1469,7 +1471,11 @@ int32_t videoCheckMode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t fo
char const *videoGetDisplayName(int display)
{
#if SDL_MAJOR_VERSION >= 2
return SDL_GetDisplayName(display);
#else
return "Primary display";
#endif
}
static void destroy_window_resources()
......@@ -1717,7 +1723,9 @@ void setvideomode_sdlcommonpost(int32_t x, int32_t y, int32_t c, int32_t fs, int
if (regrab)
mouseGrabInput(g_mouseLockedToWindow);
#if SDL_MAJOR_VERSION >= 2
g_displayindex = newdisplayindex;
#endif
}
#if SDL_MAJOR_VERSION >= 2
......@@ -2697,12 +2705,14 @@ int32_t handleevents(void)
}
#endif
#if SDL_MAJOR_VERSION >= 2
if (g_mouseBits & 2 && osd->flags & OSD_CAPTURE && SDL_HasClipboardText())
{
auto text = SDL_GetClipboardText();
OSD_HandleClipboard(text);
SDL_free(text);
}
#endif
if (inputchecked && g_mouseEnabled)
{
......@@ -2759,6 +2769,7 @@ int32_t handleevents(void)
}
#endif
#if SDL_MAJOR_VERSION >= 2
if (!frameplace && sdl_resize.x)
{
if (in3dmode())
......@@ -2768,6 +2779,7 @@ int32_t handleevents(void)
sdl_resize = {};
}
#endif
#ifndef _WIN32
startwin_idle(NULL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment