Update some internal files to use `SDL_WindowFlags`

main
Susko3 2024-03-03 20:30:57 +01:00 committed by Sam Lantinga
parent ce44eff3d2
commit 641b911d38
16 changed files with 44 additions and 44 deletions

View File

@ -819,7 +819,7 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event)
return 0;
}
int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer)
int SDL_CreateWindowAndRenderer(int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer)
{
*window = SDL_CreateWindow(NULL, width, height, window_flags);
if (!*window) {

View File

@ -1643,7 +1643,7 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, SDL_PropertiesID crea
SDL_Renderer *renderer;
GL_RenderData *data;
GLint value;
Uint32 window_flags;
SDL_WindowFlags window_flags;
int profile_mask = 0, major = 0, minor = 0;
SDL_bool changed_window = SDL_FALSE;
const char *hint;

View File

@ -2037,7 +2037,7 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, SDL_PropertiesID c
{
SDL_Renderer *renderer;
GLES2_RenderData *data;
Uint32 window_flags = 0; /* -Wconditional-uninitialized */
SDL_WindowFlags window_flags = 0; /* -Wconditional-uninitialized */
GLint window_framebuffer;
GLint value;
int profile_mask = 0, major = 0, minor = 0;

View File

@ -822,7 +822,7 @@ static void SDLTest_PrintWindowFlag(char *text, size_t maxlen, Uint32 flag)
static void SDLTest_PrintWindowFlags(char *text, size_t maxlen, Uint32 flags)
{
const Uint32 window_flags[] = {
const SDL_WindowFlags window_flags[] = {
SDL_WINDOW_FULLSCREEN,
SDL_WINDOW_OPENGL,
SDL_WINDOW_HIDDEN,
@ -1993,7 +1993,7 @@ static void FullscreenTo(SDLTest_CommonState *state, int index, int windowId)
int num_displays;
SDL_DisplayID *displays;
SDL_Window *window;
Uint32 flags;
SDL_WindowFlags flags;
const SDL_DisplayMode *mode;
struct SDL_Rect rect = { 0, 0, 0, 0 };
@ -2297,7 +2297,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
/* Ctrl-M maximize */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) {
Uint32 flags = SDL_GetWindowFlags(window);
SDL_WindowFlags flags = SDL_GetWindowFlags(window);
if (flags & SDL_WINDOW_MAXIMIZED) {
SDL_RestoreWindow(window);
} else {
@ -2325,7 +2325,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
/* Ctrl-T toggle topmost mode */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) {
Uint32 flags = SDL_GetWindowFlags(window);
SDL_WindowFlags flags = SDL_GetWindowFlags(window);
if (flags & SDL_WINDOW_ALWAYS_ON_TOP) {
SDL_SetWindowAlwaysOnTop(window, SDL_FALSE);
} else {
@ -2348,7 +2348,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
/* Ctrl-Enter toggle fullscreen */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) {
Uint32 flags = SDL_GetWindowFlags(window);
SDL_WindowFlags flags = SDL_GetWindowFlags(window);
if (!(flags & SDL_WINDOW_FULLSCREEN) ||
!SDL_GetWindowFullscreenMode(window)) {
SDL_SetWindowFullscreenMode(window, &state->fullscreen_mode);
@ -2361,7 +2361,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
/* Alt-Enter toggle fullscreen desktop */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) {
Uint32 flags = SDL_GetWindowFlags(window);
SDL_WindowFlags flags = SDL_GetWindowFlags(window);
if (!(flags & SDL_WINDOW_FULLSCREEN) ||
SDL_GetWindowFullscreenMode(window)) {
SDL_SetWindowFullscreenMode(window, NULL);
@ -2378,7 +2378,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
/* Ctrl-B toggle window border */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) {
const Uint32 flags = SDL_GetWindowFlags(window);
const SDL_WindowFlags flags = SDL_GetWindowFlags(window);
const SDL_bool b = (flags & SDL_WINDOW_BORDERLESS) ? SDL_TRUE : SDL_FALSE;
SDL_SetWindowBordered(window, b);
}

View File

@ -46,8 +46,8 @@ struct SDL_Window
int min_w, min_h;
int max_w, max_h;
int last_pixel_w, last_pixel_h;
Uint32 flags;
Uint32 pending_flags;
SDL_WindowFlags flags;
SDL_WindowFlags pending_flags;
float display_scale;
SDL_bool external_graphics_context;
SDL_bool fullscreen_exclusive; /* The window is currently fullscreen exclusive */
@ -509,7 +509,7 @@ extern int SDL_GetMessageBoxCount(void);
extern void SDL_GL_DeduceMaxSupportedESProfile(int *major, int *minor);
extern int SDL_RecreateWindow(SDL_Window *window, Uint32 flags);
extern int SDL_RecreateWindow(SDL_Window *window, SDL_WindowFlags flags);
extern SDL_bool SDL_HasWindows(void);
extern void SDL_RelativeToGlobalForWindow(SDL_Window *window, int rel_x, int rel_y, int *abs_x, int *abs_y);
extern void SDL_GlobalToRelativeForWindow(SDL_Window *window, int abs_x, int abs_y, int *rel_x, int *rel_y);

View File

@ -1555,7 +1555,7 @@ static void SDL_CheckWindowDisplayScaleChanged(SDL_Window *window)
}
#ifdef SDL_PLATFORM_WINRT
extern Uint32 WINRT_DetectWindowFlags(SDL_Window *window);
extern SDL_WindowFlags WINRT_DetectWindowFlags(SDL_Window *window);
#endif
static void SDL_RestoreMousePosition(SDL_Window *window)
@ -1908,7 +1908,7 @@ void SDL_ToggleDragAndDropSupport(void)
}
}
static void ApplyWindowFlags(SDL_Window *window, Uint32 flags)
static void ApplyWindowFlags(SDL_Window *window, SDL_WindowFlags flags)
{
if (!(flags & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) {
SDL_RestoreWindow(window);
@ -1936,7 +1936,7 @@ static void ApplyWindowFlags(SDL_Window *window, Uint32 flags)
}
}
static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
static void SDL_FinishWindowCreation(SDL_Window *window, SDL_WindowFlags flags)
{
PrepareDragAndDropSupport(window);
ApplyWindowFlags(window, flags);
@ -1961,7 +1961,7 @@ static int SDL_DllNotSupported(const char *name)
static struct {
const char *property_name;
Uint32 flag;
SDL_WindowFlags flag;
SDL_bool invert_value;
} SDL_WindowFlagProperties[] = {
{ SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN, SDL_WINDOW_ALWAYS_ON_TOP, SDL_FALSE },
@ -1986,7 +1986,7 @@ static struct {
static Uint32 SDL_GetWindowFlagProperties(SDL_PropertiesID props)
{
unsigned i;
Uint32 flags = (Uint32)SDL_GetNumberProperty(props, "flags", 0);
SDL_WindowFlags flags = (Uint32)SDL_GetNumberProperty(props, "flags", 0);
for (i = 0; i < SDL_arraysize(SDL_WindowFlagProperties); ++i) {
if (SDL_WindowFlagProperties[i].invert_value) {
@ -2011,8 +2011,8 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props)
int w = (int)SDL_GetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, 0);
int h = (int)SDL_GetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, 0);
SDL_Window *parent = SDL_GetProperty(props, SDL_PROP_WINDOW_CREATE_PARENT_POINTER, NULL);
Uint32 flags = SDL_GetWindowFlagProperties(props);
Uint32 type_flags, graphics_flags;
SDL_WindowFlags flags = SDL_GetWindowFlagProperties(props);
SDL_WindowFlags type_flags, graphics_flags;
SDL_bool undefined_x = SDL_FALSE;
SDL_bool undefined_y = SDL_FALSE;
SDL_bool external_graphics_context = SDL_GetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN, SDL_FALSE);
@ -2255,7 +2255,7 @@ SDL_Window *SDL_CreatePopupWindow(SDL_Window *parent, int offset_x, int offset_y
return window;
}
int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
int SDL_RecreateWindow(SDL_Window *window, SDL_WindowFlags flags)
{
SDL_bool loaded_opengl = SDL_FALSE;
SDL_bool need_gl_unload = SDL_FALSE;
@ -2263,7 +2263,7 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
SDL_bool loaded_vulkan = SDL_FALSE;
SDL_bool need_vulkan_unload = SDL_FALSE;
SDL_bool need_vulkan_load = SDL_FALSE;
Uint32 graphics_flags;
SDL_WindowFlags graphics_flags;
/* ensure no more than one of these flags is set */
graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN);

View File

@ -1410,7 +1410,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_NCCALCSIZE:
{
Uint32 window_flags = SDL_GetWindowFlags(data->window);
SDL_WindowFlags window_flags = SDL_GetWindowFlags(data->window);
if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) {
/* When borderless, need to tell windows that the size of the non-client area is 0 */
if (!(window_flags & SDL_WINDOW_RESIZABLE)) {

View File

@ -472,12 +472,12 @@ void WINRT_VideoQuit(SDL_VideoDevice *_this)
WINRT_QuitMouse(_this);
}
static const Uint32 WINRT_DetectableFlags = SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_HIDDEN | SDL_WINDOW_MOUSE_FOCUS;
static const SDL_WindowFlags WINRT_DetectableFlags = SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_HIDDEN | SDL_WINDOW_MOUSE_FOCUS;
extern "C" Uint32
extern "C" SDL_WindowFlags
WINRT_DetectWindowFlags(SDL_Window *window)
{
Uint32 latestFlags = 0;
SDL_WindowFlags latestFlags = 0;
SDL_WindowData *data = window->driverdata;
bool is_fullscreen = false;
@ -543,7 +543,7 @@ WINRT_DetectWindowFlags(SDL_Window *window)
}
// TODO, WinRT: consider removing WINRT_UpdateWindowFlags, and just calling WINRT_DetectWindowFlags as-appropriate (with appropriate calls to SDL_SendWindowEvent)
void WINRT_UpdateWindowFlags(SDL_Window *window, Uint32 mask)
void WINRT_UpdateWindowFlags(SDL_Window *window, SDL_WindowFlags mask)
{
mask &= WINRT_DetectableFlags;
if (window) {

View File

@ -67,8 +67,8 @@ extern SDL_Window *WINRT_GlobalSDLWindow;
/* Updates one or more SDL_Window flags, by querying the OS' native windowing APIs.
SDL_Window flags that can be updated should be specified in 'mask'.
*/
extern void WINRT_UpdateWindowFlags(SDL_Window *window, Uint32 mask);
extern "C" Uint32 WINRT_DetectWindowFlags(SDL_Window *window); /* detects flags w/o applying them */
extern void WINRT_UpdateWindowFlags(SDL_Window *window, SDL_WindowFlags mask);
extern "C" SDL_WindowFlags WINRT_DetectWindowFlags(SDL_Window *window); /* detects flags w/o applying them */
/* Display mode internals */
// typedef struct

View File

@ -1636,8 +1636,8 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
without ever mapping / unmapping them, so we handle that here,
because they use the NETWM protocol to notify us of changes.
*/
const Uint32 flags = X11_GetNetWMState(_this, data->window, xevent->xproperty.window);
const Uint32 changed = flags ^ data->window->flags;
const SDL_WindowFlags flags = X11_GetNetWMState(_this, data->window, xevent->xproperty.window);
const SDL_WindowFlags changed = flags ^ data->window->flags;
if ((changed & (SDL_WINDOW_HIDDEN | SDL_WINDOW_FULLSCREEN)) != 0) {
if (flags & SDL_WINDOW_HIDDEN) {

View File

@ -124,7 +124,7 @@ static SDL_bool X11_IsActionAllowed(SDL_Window *window, Atom action)
}
#endif /* 0 */
void X11_SetNetWMState(SDL_VideoDevice *_this, Window xwindow, Uint32 flags)
void X11_SetNetWMState(SDL_VideoDevice *_this, Window xwindow, SDL_WindowFlags flags)
{
SDL_VideoData *videodata = _this->driverdata;
Display *display = videodata->display;
@ -245,7 +245,7 @@ Uint32 X11_GetNetWMState(SDL_VideoDevice *_this, SDL_Window *window, Window xwin
unsigned long i, numItems, bytesAfter;
unsigned char *propertyValue = NULL;
long maxLength = 1024;
Uint32 flags = 0;
SDL_WindowFlags flags = 0;
if (X11_XGetWindowProperty(display, xwindow, _NET_WM_STATE,
0l, maxLength, False, XA_ATOM, &actualType,
@ -1620,7 +1620,7 @@ static int X11_SetWindowFullscreenViaWM(SDL_VideoDevice *_this, SDL_Window *wind
SubstructureNotifyMask | SubstructureRedirectMask, &e);
}
} else {
Uint32 flags;
SDL_WindowFlags flags;
flags = window->flags;
if (fullscreen) {

View File

@ -15,7 +15,7 @@ static SDL_Window *createVideoSuiteTestWindow(const char *title)
SDL_Window *window;
SDL_Event event;
int w, h;
Uint32 flags;
SDL_WindowFlags flags;
SDL_bool needs_renderer = SDL_FALSE;
SDL_bool needs_events_pumped = SDL_FALSE;
@ -197,7 +197,7 @@ static int video_createWindowVariousFlags(void *arg)
const char *title = "video_createWindowVariousFlags Test Window";
int w, h;
int fVariation;
Uint32 flags;
SDL_WindowFlags flags;
/* Standard window */
w = SDLTest_RandomIntegerInRange(320, 1024);
@ -269,7 +269,7 @@ static int video_getWindowFlags(void *arg)
{
SDL_Window *window;
const char *title = "video_getWindowFlags Test Window";
Uint32 flags;
SDL_WindowFlags flags;
Uint32 actualFlags;
/* Reliable flag set always set in test window */
@ -1931,14 +1931,14 @@ static int video_getSetWindowState(void *arg)
SDL_Window *window;
int result;
SDL_Rect display;
Uint32 flags;
SDL_WindowFlags flags;
int windowedX, windowedY;
int currentX, currentY;
int desiredX = 0, desiredY = 0;
int windowedW, windowedH;
int currentW, currentH;
int desiredW = 0, desiredH = 0;
Uint32 skipFlags = 0;
SDL_WindowFlags skipFlags = 0;
const SDL_bool restoreHint = SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", SDL_TRUE);
const SDL_bool skipPos = SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0;

View File

@ -92,7 +92,7 @@ struct SwsContextContainer
static const char *SWS_CONTEXT_CONTAINER_PROPERTY = "SWS_CONTEXT_CONTAINER";
static int done;
static SDL_bool CreateWindowAndRenderer(Uint32 window_flags, const char *driver)
static SDL_bool CreateWindowAndRenderer(SDL_WindowFlags window_flags, const char *driver)
{
SDL_PropertiesID props;
SDL_RendererInfo info;
@ -1066,7 +1066,7 @@ int main(int argc, char *argv[])
int i;
int result;
int return_code = -1;
Uint32 window_flags;
SDL_WindowFlags window_flags;
SDL_bool flushing = SDL_FALSE;
SDL_bool decoded = SDL_FALSE;
SDLTest_CommonState *state;

View File

@ -95,7 +95,7 @@ static SDL_bool create_popup(struct PopupWindow *new_popup, SDL_bool is_menu)
const int w = is_menu ? MENU_WIDTH : TOOLTIP_WIDTH;
const int h = is_menu ? MENU_HEIGHT : TOOLTIP_HEIGHT;
const int v_off = is_menu ? 0 : 32;
const Uint32 flags = is_menu ? SDL_WINDOW_POPUP_MENU : SDL_WINDOW_TOOLTIP;
const SDL_WindowFlags flags = is_menu ? SDL_WINDOW_POPUP_MENU : SDL_WINDOW_TOOLTIP;
float x, y;
focus = SDL_GetMouseFocus();

View File

@ -36,7 +36,7 @@ int main(int argc, char *argv[])
SDL_Renderer *renderer = NULL;
SDL_Surface *shape = NULL;
SDL_bool resizable = SDL_FALSE;
Uint32 flags;
SDL_WindowFlags flags;
SDL_bool done = SDL_FALSE;
SDL_Event event;
int i;

View File

@ -612,7 +612,7 @@ static SDL_bool createSwapchain(void)
int w, h;
VkSwapchainCreateInfoKHR createInfo = { 0 };
VkResult result;
Uint32 flags;
SDL_WindowFlags flags;
// pick an image count
vulkanContext->swapchainDesiredImageCount = vulkanContext->surfaceCapabilities.minImageCount + 1;