ensure that SDL2 does not set conflicting window flags (thanks @pionere!)

This commit is contained in:
Sam Lantinga 2022-11-16 17:39:55 -08:00
parent 4192d1a1c7
commit fcc994e132
1 changed files with 17 additions and 10 deletions

View File

@ -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) {