SDL_WindowFlags is now 64-bit

Fixes https://github.com/libsdl-org/SDL/issues/7321
This commit is contained in:
Sam Lantinga 2024-05-09 10:11:44 -07:00
parent 895586c928
commit 54fb629da5
5 changed files with 35 additions and 35 deletions

View File

@ -1759,7 +1759,7 @@ SDL_GL_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be us
The SDL_WINDOW_TOOLTIP and SDL_WINDOW_POPUP_MENU window flags are now supported on Windows, Mac (Cocoa), X11, and Wayland. Creating windows with these flags must happen via the `SDL_CreatePopupWindow()` function. This function requires passing in the handle to a valid parent window for the popup, and the popup window is positioned relative to the parent.
SDL_WindowFlags is used instead of Uint32 for API functions that refer to window flags.
SDL_WindowFlags is used instead of Uint32 for API functions that refer to window flags, and has been extended to 64 bits.
The following functions have been renamed:
* SDL_GetClosestDisplayMode() => SDL_GetClosestFullscreenDisplayMode()

View File

@ -131,32 +131,32 @@ typedef struct SDL_Window SDL_Window;
*
* \sa SDL_GetWindowFlags
*/
typedef Uint32 SDL_WindowFlags;
typedef Uint64 SDL_WindowFlags;
#define SDL_WINDOW_FULLSCREEN 0x00000001u /**< window is in fullscreen mode */
#define SDL_WINDOW_OPENGL 0x00000002u /**< window usable with OpenGL context */
#define SDL_WINDOW_OCCLUDED 0x00000004u /**< window is occluded */
#define SDL_WINDOW_HIDDEN 0x00000008u /**< window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible */
#define SDL_WINDOW_BORDERLESS 0x00000010u /**< no window decoration */
#define SDL_WINDOW_RESIZABLE 0x00000020u /**< window can be resized */
#define SDL_WINDOW_MINIMIZED 0x00000040u /**< window is minimized */
#define SDL_WINDOW_MAXIMIZED 0x00000080u /**< window is maximized */
#define SDL_WINDOW_MOUSE_GRABBED 0x00000100u /**< window has grabbed mouse input */
#define SDL_WINDOW_INPUT_FOCUS 0x00000200u /**< window has input focus */
#define SDL_WINDOW_MOUSE_FOCUS 0x00000400u /**< window has mouse focus */
#define SDL_WINDOW_EXTERNAL 0x00000800u /**< window not created by SDL */
#define SDL_WINDOW_MODAL 0x00001000u /**< window is modal */
#define SDL_WINDOW_HIGH_PIXEL_DENSITY 0x00002000u /**< window uses high pixel density back buffer if possible */
#define SDL_WINDOW_MOUSE_CAPTURE 0x00004000u /**< window has mouse captured (unrelated to MOUSE_GRABBED) */
#define SDL_WINDOW_ALWAYS_ON_TOP 0x00008000u /**< window should always be above others */
#define SDL_WINDOW_UTILITY 0x00020000u /**< window should be treated as a utility window, not showing in the task bar and window list */
#define SDL_WINDOW_TOOLTIP 0x00040000u /**< window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window */
#define SDL_WINDOW_POPUP_MENU 0x00080000u /**< window should be treated as a popup menu, requires a parent window */
#define SDL_WINDOW_KEYBOARD_GRABBED 0x00100000u /**< window has grabbed keyboard input */
#define SDL_WINDOW_VULKAN 0x10000000u /**< window usable for Vulkan surface */
#define SDL_WINDOW_METAL 0x20000000u /**< window usable for Metal view */
#define SDL_WINDOW_TRANSPARENT 0x40000000u /**< window with transparent buffer */
#define SDL_WINDOW_NOT_FOCUSABLE 0x80000000u /**< window should not be focusable */
#define SDL_WINDOW_FULLSCREEN SDL_UINT64_C(0x0000000000000001) /**< window is in fullscreen mode */
#define SDL_WINDOW_OPENGL SDL_UINT64_C(0x0000000000000002) /**< window usable with OpenGL context */
#define SDL_WINDOW_OCCLUDED SDL_UINT64_C(0x0000000000000004) /**< window is occluded */
#define SDL_WINDOW_HIDDEN SDL_UINT64_C(0x0000000000000008) /**< window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible */
#define SDL_WINDOW_BORDERLESS SDL_UINT64_C(0x0000000000000010) /**< no window decoration */
#define SDL_WINDOW_RESIZABLE SDL_UINT64_C(0x0000000000000020) /**< window can be resized */
#define SDL_WINDOW_MINIMIZED SDL_UINT64_C(0x0000000000000040) /**< window is minimized */
#define SDL_WINDOW_MAXIMIZED SDL_UINT64_C(0x0000000000000080) /**< window is maximized */
#define SDL_WINDOW_MOUSE_GRABBED SDL_UINT64_C(0x0000000000000100) /**< window has grabbed mouse input */
#define SDL_WINDOW_INPUT_FOCUS SDL_UINT64_C(0x0000000000000200) /**< window has input focus */
#define SDL_WINDOW_MOUSE_FOCUS SDL_UINT64_C(0x0000000000000400) /**< window has mouse focus */
#define SDL_WINDOW_EXTERNAL SDL_UINT64_C(0x0000000000000800) /**< window not created by SDL */
#define SDL_WINDOW_MODAL SDL_UINT64_C(0x0000000000001000) /**< window is modal */
#define SDL_WINDOW_HIGH_PIXEL_DENSITY SDL_UINT64_C(0x0000000000002000) /**< window uses high pixel density back buffer if possible */
#define SDL_WINDOW_MOUSE_CAPTURE SDL_UINT64_C(0x0000000000004000) /**< window has mouse captured (unrelated to MOUSE_GRABBED) */
#define SDL_WINDOW_ALWAYS_ON_TOP SDL_UINT64_C(0x0000000000008000) /**< window should always be above others */
#define SDL_WINDOW_UTILITY SDL_UINT64_C(0x0000000000020000) /**< window should be treated as a utility window, not showing in the task bar and window list */
#define SDL_WINDOW_TOOLTIP SDL_UINT64_C(0x0000000000040000) /**< window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window */
#define SDL_WINDOW_POPUP_MENU SDL_UINT64_C(0x0000000000080000) /**< window should be treated as a popup menu, requires a parent window */
#define SDL_WINDOW_KEYBOARD_GRABBED SDL_UINT64_C(0x0000000000100000) /**< window has grabbed keyboard input */
#define SDL_WINDOW_VULKAN SDL_UINT64_C(0x0000000010000000) /**< window usable for Vulkan surface */
#define SDL_WINDOW_METAL SDL_UINT64_C(0x0000000020000000) /**< window usable for Metal view */
#define SDL_WINDOW_TRANSPARENT SDL_UINT64_C(0x0000000040000000) /**< window with transparent buffer */
#define SDL_WINDOW_NOT_FOCUSABLE SDL_UINT64_C(0x0000000080000000) /**< window should not be focusable */
/**

View File

@ -135,7 +135,7 @@ SDL_DYNAPI_PROC(int,SDL_CreateHapticEffect,(SDL_Haptic *a, const SDL_HapticEffec
SDL_DYNAPI_PROC(SDL_Mutex*,SDL_CreateMutex,(void),(),return)
SDL_DYNAPI_PROC(SDL_Palette*,SDL_CreatePalette,(int a),(a),return)
SDL_DYNAPI_PROC(SDL_PixelFormat*,SDL_CreatePixelFormat,(SDL_PixelFormatEnum a),(a),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreatePopupWindow,(SDL_Window *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreatePopupWindow,(SDL_Window *a, int b, int c, int d, int e, SDL_WindowFlags f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_CreateProperties,(void),(),return)
SDL_DYNAPI_PROC(SDL_RWLock*,SDL_CreateRWLock,(void),(),return)
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, const char *b, SDL_RendererFlags c),(a,b,c),return)
@ -150,8 +150,8 @@ SDL_DYNAPI_PROC(SDL_TLSID,SDL_CreateTLS,(void),(),return)
SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTexture,(SDL_Renderer *a, SDL_PixelFormatEnum b, int c, int d, int e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTextureFromSurface,(SDL_Renderer *a, SDL_Surface *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTextureWithProperties,(SDL_Renderer *a, SDL_PropertiesID b),(a,b),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindow,(const char *a, int b, int c, Uint32 d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_CreateWindowAndRenderer,(const char *a, int b, int c, Uint32 d, SDL_Window **e, SDL_Renderer **f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindow,(const char *a, int b, int c, SDL_WindowFlags d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_CreateWindowAndRenderer,(const char *a, int b, int c, SDL_WindowFlags d, SDL_Window **e, SDL_Renderer **f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindowWithProperties,(SDL_PropertiesID a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_CursorVisible,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_DXGIGetOutputInfo,(SDL_DisplayID a, int *b, int *c),(a,b,c),return)
@ -515,7 +515,7 @@ SDL_DYNAPI_PROC(int,SDL_GetVersion,(SDL_Version *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetVideoDriver,(int a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(Uint32,SDL_GetWindowFlags,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(SDL_WindowFlags,SDL_GetWindowFlags,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromID,(Uint32 a),(a),return)
SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetWindowFullscreenMode,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(void*,SDL_GetWindowICCProfile,(SDL_Window *a, size_t *b),(a,b),return)

View File

@ -104,7 +104,7 @@ struct SDL_WindowData
SDL_HitTestResult hit_test_result;
};
extern void X11_SetNetWMState(SDL_VideoDevice *_this, Window xwindow, Uint32 flags);
extern void X11_SetNetWMState(SDL_VideoDevice *_this, Window xwindow, SDL_WindowFlags flags);
extern Uint32 X11_GetNetWMState(SDL_VideoDevice *_this, SDL_Window *window, Window xwindow);
extern int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props);

View File

@ -25,7 +25,7 @@ static SDL_Window *createVideoSuiteTestWindow(const char *title)
flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_BORDERLESS;
window = SDL_CreateWindow(title, w, h, flags);
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%" SDL_PRIu32 ")", w, h, flags);
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%" SDL_PRIu64 ")", w, h, flags);
SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
/* Wayland and XWayland windows require that a frame be presented before they are fully mapped and visible onscreen.
@ -256,7 +256,7 @@ static int video_createWindowVariousFlags(void *arg)
}
window = SDL_CreateWindow(title, w, h, flags);
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%" SDL_PRIu32 ")", w, h, flags);
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%" SDL_PRIu64 ")", w, h, flags);
SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
/* Clean up */
@ -274,7 +274,7 @@ static int video_getWindowFlags(void *arg)
SDL_Window *window;
const char *title = "video_getWindowFlags Test Window";
SDL_WindowFlags flags;
Uint32 actualFlags;
SDL_WindowFlags actualFlags;
/* Reliable flag set always set in test window */
flags = 0;
@ -284,7 +284,7 @@ static int video_getWindowFlags(void *arg)
if (window != NULL) {
actualFlags = SDL_GetWindowFlags(window);
SDLTest_AssertPass("Call to SDL_GetWindowFlags()");
SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %" SDL_PRIu32 " set, got: %" SDL_PRIu32, flags, actualFlags);
SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %" SDL_PRIu64 " set, got: %" SDL_PRIu64, flags, actualFlags);
}
/* Clean up */