mirror of
https://github.com/encounter/SDL.git
synced 2025-06-26 08:23:40 +00:00
video: simplify window-type check in SDL_CreateWindow
This commit is contained in:
parent
85aa9b8b6f
commit
22354b4142
@ -1597,7 +1597,7 @@ SDL_Window *
|
|||||||
SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
||||||
{
|
{
|
||||||
SDL_Window *window;
|
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) {
|
if (!_this) {
|
||||||
/* Initialize the video system if needed */
|
/* 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");
|
SDL_SetError("Conflicting window flags specified");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user