diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index a9afa8082..d26bdc5d5 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -2673,3 +2673,7 @@ typedef SDL_cond, SDL_Condition; - SDL_GetDisplayOrientation + SDL_GetDisplayCurrentOrientation (...) +@@ +@@ +- SDL_WINDOW_SKIP_TASKBAR ++ SDL_WINDOW_UTILITY diff --git a/docs/README-migration.md b/docs/README-migration.md index 4c34f365e..5ccbf47c9 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1096,6 +1096,8 @@ The SDL_WINDOWPOS_UNDEFINED_DISPLAY() and SDL_WINDOWPOS_CENTERED_DISPLAY() macro The SDL_WINDOW_SHOWN flag has been removed. Windows are shown by default and can be created hidden by using the SDL_WINDOW_HIDDEN flag. +The SDL_WINDOW_SKIP_TASKBAR flag has been replaced by the SDL_WINDOW_UTILITY flag, which has the same functionality. + SDL_DisplayMode now includes the pixel density which can be greater than 1.0 for display modes that have a higher pixel size than the mode size. You should use SDL_GetWindowSizeInPixels() to get the actual pixel size of the window back buffer. The refresh rate in SDL_DisplayMode is now a float. diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index 04dfe5f5d..9ea45877a 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -475,6 +475,7 @@ #define SDL_SetWindowDisplayMode SDL_SetWindowFullscreenMode #define SDL_WINDOW_ALLOW_HIGHDPI SDL_WINDOW_HIGH_PIXEL_DENSITY #define SDL_WINDOW_INPUT_GRABBED SDL_WINDOW_MOUSE_GRABBED +#define SDL_WINDOW_SKIP_TASKBAR SDL_WINDOW_UTILITY #elif !defined(SDL_DISABLE_OLD_NAMES) @@ -912,6 +913,7 @@ #define SDL_SetWindowDisplayMode SDL_SetWindowDisplayMode_renamed_SDL_SetWindowFullscreenMode #define SDL_WINDOW_ALLOW_HIGHDPI SDL_WINDOW_ALLOW_HIGHDPI_renamed_SDL_WINDOW_HIGH_PIXEL_DENSITY #define SDL_WINDOW_INPUT_GRABBED SDL_WINDOW_INPUT_GRABBED_renamed_SDL_WINDOW_MOUSE_GRABBED +#define SDL_WINDOW_SKIP_TASKBAR SDL_WINDOW_SKIP_TASKBAR_renamed_SDL_WINDOW_UTILITY #endif /* SDL_ENABLE_OLD_NAMES */ diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index e9bcfe072..bb9200e89 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -144,10 +144,10 @@ typedef enum SDL_WINDOW_HIGH_PIXEL_DENSITY = 0x00002000, /**< window uses high pixel density back buffer if possible */ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to MOUSE_GRABBED) */ SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */ - SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */ - SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */ - SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */ - SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */ + /* 0x00010000 was SDL_WINDOW_SKIP_TASKBAR in SDL2, please reserve this bit for sdl-compat */ + SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window, not showing in the task bar and window list */ + SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip and must be created using SDL_CreatePopupWindow() */ + SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu and must be created using SDL_CreatePopupWindow() */ SDL_WINDOW_KEYBOARD_GRABBED = 0x00100000, /**< window has grabbed keyboard input */ SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */ SDL_WINDOW_METAL = 0x20000000, /**< window usable for Metal view */ diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index dcd91e0a5..f7c1a3371 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -29,21 +29,43 @@ static const char *common_usage[] = { }; static const char *video_usage[] = { - "[--video driver]", "[--renderer driver]", "[--gldebug]", "[--display N]", + "[--always-on-top]", + "[--auto-scale-content]", + "[--center | --position X,Y]", + "[--confine-cursor X,Y,W,H]", + "[--depth N]", + "[--display N]", + "[--flash-on-focus-loss]", + "[--fullscreen | --fullscreen-desktop | --windows N]", + "[--geometry WxH]", + "[--gldebug]", + "[--grab]", + "[--hidden]", + "[--high-pixel-density]", + "[--icon icon.bmp]", "[--info all|video|modes|render|event|event_motion]", - "[--metal-window | --opengl-window | --vulkan-window]", - "[--fullscreen | --fullscreen-desktop | --windows N]", "[--title title]", - "[--icon icon.bmp]", "[--center | --position X,Y]", "[--geometry WxH]", - "[--min-geometry WxH]", "[--max-geometry WxH]", "[--logical WxH]", - "[--high-pixel-density]", "[--auto-scale-content]", + "[--input-focus]", + "[--keyboard-grab]", "[--logical-presentation disabled|match|stretch|letterbox|overscan|integer_scale]", "[--logical-scale-quality nearest|linear|best]", - "[--scale N]", "[--depth N]", "[--refresh R]", "[--vsync]", "[--noframe]", - "[--resizable]", "[--transparent]", "[--skip-taskbar]", "[--always-on-top]", - "[--minimize]", "[--maximize]", "[--grab]", "[--keyboard-grab]", - "[--hidden]", "[--input-focus]", "[--mouse-focus]", - "[--flash-on-focus-loss]", "[--confine-cursor X,Y,W,H]", - "[--usable-bounds]" + "[--logical WxH]", + "[--max-geometry WxH]", + "[--maximize]", + "[--metal-window | --opengl-window | --vulkan-window]", + "[--min-geometry WxH]", + "[--minimize]", + "[--mouse-focus]", + "[--noframe]", + "[--refresh R]", + "[--renderer driver]", + "[--resizable]", + "[--scale N]", + "[--title title]", + "[--transparent]", + "[--usable-bounds]", + "[--utility]", + "[--video driver]", + "[--vsync]" }; /* !!! FIXME: Float32? Sint32? */ @@ -525,10 +547,6 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index) state->window_flags |= SDL_WINDOW_TRANSPARENT; return 1; } - if (SDL_strcasecmp(argv[index], "--skip-taskbar") == 0) { - state->window_flags |= SDL_WINDOW_SKIP_TASKBAR; - return 1; - } if (SDL_strcasecmp(argv[index], "--always-on-top") == 0) { state->window_flags |= SDL_WINDOW_ALWAYS_ON_TOP; return 1; @@ -565,6 +583,10 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index) state->window_flags |= SDL_WINDOW_KEYBOARD_GRABBED; return 1; } + if (SDL_strcasecmp(argv[index], "--utility") == 0) { + state->window_flags |= SDL_WINDOW_UTILITY; + return 1; + } } if (state->flags & SDL_INIT_AUDIO) { @@ -755,9 +777,6 @@ static void SDLTest_PrintWindowFlag(char *text, size_t maxlen, Uint32 flag) case SDL_WINDOW_ALWAYS_ON_TOP: SDL_snprintfcat(text, maxlen, "ALWAYS_ON_TOP"); break; - case SDL_WINDOW_SKIP_TASKBAR: - SDL_snprintfcat(text, maxlen, "SKIP_TASKBAR"); - break; case SDL_WINDOW_UTILITY: SDL_snprintfcat(text, maxlen, "UTILITY"); break; @@ -802,7 +821,6 @@ static void SDLTest_PrintWindowFlags(char *text, size_t maxlen, Uint32 flags) SDL_WINDOW_HIGH_PIXEL_DENSITY, SDL_WINDOW_MOUSE_CAPTURE, SDL_WINDOW_ALWAYS_ON_TOP, - SDL_WINDOW_SKIP_TASKBAR, SDL_WINDOW_UTILITY, SDL_WINDOW_TOOLTIP, SDL_WINDOW_POPUP_MENU, diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index eb8f6a4bf..04dd087d0 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1732,7 +1732,7 @@ Uint32 SDL_GetWindowPixelFormat(SDL_Window *window) } #define CREATE_FLAGS \ - (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL | SDL_WINDOW_TRANSPARENT) + (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL | SDL_WINDOW_TRANSPARENT) static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void) { @@ -2053,7 +2053,7 @@ SDL_Window *SDL_CreatePopupWindow(SDL_Window *parent, int offset_x, int offset_y } /* Remove invalid flags */ - flags &= ~(SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS | SDL_WINDOW_SKIP_TASKBAR); + flags &= ~(SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS); return SDL_CreateWindowInternal(NULL, offset_x, offset_y, w, h, parent, flags); } diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index e1f9d0eda..130261c4b 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -122,6 +122,8 @@ static DWORD GetWindowStyleEx(SDL_Window *window) if (SDL_WINDOW_IS_POPUP(window)) { style = WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE; + } else if (window->flags & SDL_WINDOW_UTILITY) { + style = WS_EX_TOOLWINDOW; } return style; } @@ -532,7 +534,7 @@ int WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window) if (SDL_WINDOW_IS_POPUP(window)) { parent = window->parent->driverdata->hwnd; - } else if (window->flags & SDL_WINDOW_SKIP_TASKBAR) { + } else if (window->flags & SDL_WINDOW_UTILITY) { parent = CreateWindow(SDL_Appname, TEXT(""), STYLE_BASIC, 0, 0, 32, 32, NULL, NULL, SDL_Instance, NULL); } diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 211096c7c..291eb87cf 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -140,10 +140,6 @@ void X11_SetNetWMState(SDL_VideoDevice *_this, Window xwindow, Uint32 flags) if (flags & SDL_WINDOW_ALWAYS_ON_TOP) { atoms[count++] = _NET_WM_STATE_ABOVE; } - if (flags & SDL_WINDOW_SKIP_TASKBAR) { - atoms[count++] = _NET_WM_STATE_SKIP_TASKBAR; - atoms[count++] = _NET_WM_STATE_SKIP_PAGER; - } if (flags & SDL_WINDOW_INPUT_FOCUS) { atoms[count++] = _NET_WM_STATE_FOCUSED; }