video: simplify window-type check in SDL_CreateWindow

main
pionere 2022-11-12 08:29:15 +01:00 committed by Sam Lantinga
parent 85aa9b8b6f
commit 22354b4142
1 changed files with 4 additions and 2 deletions

View File

@ -1597,7 +1597,7 @@ SDL_Window *
SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
{
SDL_Window *window;
Uint32 graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN);
Uint32 type_flags, graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN);
if (!_this) {
/* Initialize the video system if needed */
@ -1606,7 +1606,9 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
}
}
if ((((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1) {
/* ensure no more than one of these flags is set */
type_flags = flags & (SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_POPUP_MENU);
if ((type_flags & (type_flags - 1)) != 0) {
SDL_SetError("Conflicting window flags specified");
return NULL;
}