From d05899f95c5d7e7e2d8eee40ddf3815e53a3bddf Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Thu, 16 Dec 2021 14:00:32 +0300
Subject: [PATCH] Restrict X11_KeyToUnicode to unix builds.
Reference issue #153.
---
src/SDL12_compat.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 6647bc7..ef62faa 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -8102,13 +8102,14 @@ SDL_GL_EnableContext_Thread(void)
As this isn't X11-specific, we supply it globally, so x11 binaries can transition
to Wayland, and if there's some wildly-misbuilt win32 software, they can call it
too. :) */
-
+#if !(defined(_WIN32) || defined(__OS2__)) /* #if defined(__unix__) || defined(__APPLE__) ?? */
DECLSPEC Uint16 SDLCALL
X11_KeyToUnicode(SDL12Key key, SDL12Mod mod)
{
if (((int) key) >= 127) {
return 0;
- } else if ((key >= SDLK12_a) && (key <= SDLK12_z)) {
+ }
+ if ((key >= SDLK12_a) && (key <= SDLK12_z)) {
const int shifted = ((mod & (KMOD12_LSHIFT|KMOD12_RSHIFT)) != 0) ? 1 : 0;
int capital = ((mod & KMOD12_CAPS) != 0) ? 1 : 0;
if (shifted) {
@@ -8119,6 +8120,7 @@ X11_KeyToUnicode(SDL12Key key, SDL12Mod mod)
return (Uint16) key;
}
+#endif
#ifdef __cplusplus
}