From 26c41f3f9add5773747518acd138594a8ce2ddec Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 31 Jul 2025 08:49:40 -0700
Subject: [PATCH] Fix Android build
- Android defines SDL_PLATFORM_UNIX but does not compile core/unix sources
so add checks for SDL_PLATFORM_ANDROID where SDL_gtk is used.
- Fix missing void parameter list in SDL_Gtk_EnterContext.
- Remove unneeded SDL_gtk.h include in SDL_events.c
---
src/SDL.c | 4 ++--
src/events/SDL_events.c | 4 ----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/SDL.c b/src/SDL.c
index f70b756083231..a104e955a79fd 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -30,7 +30,7 @@
// this checks for HAVE_DBUS_DBUS_H internally.
#include "core/linux/SDL_dbus.h"
-#ifdef SDL_PLATFORM_UNIX
+#if defined(SDL_PLATFORM_UNIX) && !defined(SDL_PLATFORM_ANDROID)
#include "core/unix/SDL_gtk.h"
#endif
@@ -667,7 +667,7 @@ void SDL_Quit(void)
SDL_DBus_Quit();
#endif
-#ifdef SDL_PLATFORM_UNIX
+#if defined(SDL_PLATFORM_UNIX) && !defined(SDL_PLATFORM_ANDROID)
SDL_Gtk_Quit();
#endif
diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c
index fc736b5e17f9f..19d3e37b47d86 100644
--- a/src/events/SDL_events.c
+++ b/src/events/SDL_events.c
@@ -42,10 +42,6 @@
#include "../video/android/SDL_androidevents.h"
#endif
-#ifdef SDL_PLATFORM_UNIX
-#include "../core/unix/SDL_gtk.h"
-#endif
-
// An arbitrary limit so we don't have unbounded growth
#define SDL_MAX_QUEUED_EVENTS 65535