ensure that SDL2 does not set conflicting window flags (thanks @pionere!)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 45965e3..18b7bfc 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -202,6 +202,22 @@ typedef struct {
} SDL_WindowTextureData;
+static Uint32
+SDL_DefaultGraphicsBackends(SDL_VideoDevice *_this)
+{
+#if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__
+ if (_this->GL_CreateContext != NULL) {
+ return SDL_WINDOW_OPENGL;
+ }
+#endif
+#if SDL_VIDEO_METAL && (TARGET_OS_MACCATALYST || __MACOSX__ || __IPHONEOS__)
+ if (_this->Metal_CreateView != NULL) {
+ return SDL_WINDOW_METAL;
+ }
+#endif
+ return 0;
+}
+
static int
SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch)
{
@@ -1635,16 +1651,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
/* Some platforms have certain graphics backends enabled by default */
if (!graphics_flags && !SDL_IsVideoContextExternal()) {
-#if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__
- if (_this->GL_CreateContext != NULL) {
- flags |= SDL_WINDOW_OPENGL;
- }
-#endif
-#if SDL_VIDEO_METAL && (TARGET_OS_MACCATALYST || __MACOSX__ || __IPHONEOS__)
- if (_this->Metal_CreateView != NULL) {
- flags |= SDL_WINDOW_METAL;
- }
-#endif
+ flags |= SDL_DefaultGraphicsBackends(_this);
}
if (flags & SDL_WINDOW_OPENGL) {