From c2dc252d5885fa0e4cfd27f6e044ad0259b4739d Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 12 Feb 2025 07:37:00 +0300
Subject: [PATCH] exclude Android from X11EventHook / SysWMmsg stuff.
---
src/sdl2_compat.c | 6 +++---
src/sdl2_compat.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 5646bd83..edfd9e0a 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -8768,7 +8768,7 @@ SDL_SetWindowsMessageHook(SDL2_WindowsMessageHook callback, void *userdata)
}
#endif /* SDL_PLATFORM_WINDOWS */
-#ifdef SDL_PLATFORM_UNIX
+#if defined(SDL_PLATFORM_UNIX) && !defined(SDL_PLATFORM_ANDROID)
static bool SDLCALL SDL2COMPAT_X11EventHook(void *userdata, XEvent *xevent)
{
SDL2_Event event;
@@ -8796,7 +8796,7 @@ SDL_EventState(Uint32 type, int state)
#ifdef SDL_PLATFORM_WINDOWS
SDL3_SetWindowsMessageHook(SDL3to2_WindowsMessageHook, NULL);
#endif
-#ifdef SDL_PLATFORM_UNIX
+#if defined(SDL_PLATFORM_UNIX) && !defined(SDL_PLATFORM_ANDROID)
SDL3_SetX11EventHook(SDL2COMPAT_X11EventHook, NULL);
#endif
}
@@ -8808,7 +8808,7 @@ SDL_EventState(Uint32 type, int state)
SDL_SetWindowsMessageHook(NULL, NULL);
}
#endif
-#ifdef SDL_PLATFORM_UNIX
+#if defined(SDL_PLATFORM_UNIX) && !defined(SDL_PLATFORM_ANDROID)
SDL3_SetX11EventHook(NULL, NULL);
#endif
}
diff --git a/src/sdl2_compat.h b/src/sdl2_compat.h
index c4df737c..2aad6c23 100644
--- a/src/sdl2_compat.h
+++ b/src/sdl2_compat.h
@@ -1275,7 +1275,7 @@ typedef struct _NSWindow NSWindow;
typedef struct _UIWindow UIWindow;
#endif
-#ifdef SDL_PLATFORM_UNIX
+#if defined(SDL_PLATFORM_UNIX) && !defined(SDL_PLATFORM_ANDROID)
#include <X11/Xlib.h>
#endif
@@ -1293,7 +1293,7 @@ typedef struct SDL2_SysWMmsg
LPARAM lParam; /**< LONG message parameter */
} win;
#endif
-#ifdef SDL_PLATFORM_UNIX
+#if defined(SDL_PLATFORM_UNIX) && !defined(SDL_PLATFORM_ANDROID)
struct {
XEvent event;
} x11;