SDL 3.0 is going to be high DPI aware and officially separates screen… (#7145)

* SDL 3.0 is going to be high DPI aware and officially separates screen coordinates from client pixel area

The public APIs to disable high DPI support have been removed

Work in progress on https://github.com/libsdl-org/SDL/issues/7134
This commit is contained in:
Sam Lantinga 2023-01-25 01:23:17 -08:00 committed by GitHub
parent 78cc95e34e
commit 4696c9556b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 158 additions and 289 deletions

View file

@ -92,7 +92,7 @@ extern "C" {
* By default this hint is not set and the APK expansion files are not searched.
*/
#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"
/**
* \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc.
*
@ -132,13 +132,13 @@ extern "C" {
* \brief A variable to control whether we trap the Android back button to handle it manually.
* This is necessary for the right mouse button to work on some Android devices, or
* to be able to trap the back button for use in your code reliably. If set to true,
* the back button will show up as an SDL_EVENT_KEY_DOWN / SDL_EVENT_KEY_UP pair with a keycode of
* the back button will show up as an SDL_EVENT_KEY_DOWN / SDL_EVENT_KEY_UP pair with a keycode of
* SDL_SCANCODE_AC_BACK.
*
* The variable can be set to the following values:
* "0" - Back button will be handled as usual for system. (default)
* "1" - Back button will be trapped, allowing you to handle the key press
* manually. (This will also let right mouse click work on systems
* manually. (This will also let right mouse click work on systems
* where the right mouse button functions as back.)
*
* The value of this hint is used at runtime, so it can be changed at any time.
@ -147,7 +147,7 @@ extern "C" {
/**
* \brief Specify an application name.
*
*
* This hint lets you specify the application name sent to the OS when
* required. For example, this will often appear in volume control applets for
* audio streams, and in lists of applications which are inhibiting the
@ -516,7 +516,7 @@ extern "C" {
/**
* \brief If set, game controller face buttons report their values according to their labels instead of their positional layout.
*
*
* For example, on Nintendo Switch controllers, normally you'd get:
*
* (Y)
@ -561,9 +561,9 @@ extern "C" {
*
* The variable can be set to the following values:
* "0" - SDL_EVENT_TEXT_EDITING events are sent, and it is the application's
* responsibility to render the text from these events and
* responsibility to render the text from these events and
* differentiate it somehow from committed text. (default)
* "1" - If supported by the IME then SDL_EVENT_TEXT_EDITING events are not sent,
* "1" - If supported by the IME then SDL_EVENT_TEXT_EDITING events are not sent,
* and text that is being composed will be rendered in its own UI.
*/
#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
@ -1147,10 +1147,10 @@ extern "C" {
* \brief A variable controlling whether relative mouse motion is affected by renderer scaling
*
* This variable can be set to the following values:
* "0" - Relative motion is unaffected by DPI or renderer's logical size
* "1" - Relative motion is scaled according to DPI scaling and logical size
* "0" - Relative motion is unaffected by display scale or renderer's logical size
* "1" - Relative motion is scaled according to display scale scaling and logical size
*
* By default relative mouse deltas are affected by DPI and renderer scaling
* By default relative mouse deltas are affected by display scale and renderer scaling
*/
#define SDL_HINT_MOUSE_RELATIVE_SCALING "SDL_MOUSE_RELATIVE_SCALING"
@ -1487,7 +1487,7 @@ extern "C" {
* disabled. You should use a string that describes what your program is doing
* (and, therefore, why the screensaver is disabled). For example, "Playing a
* game" or "Watching a video".
*
*
* Setting this to "" or leaving it unset will have SDL use a reasonable
* default: "Playing a game" or something similar.
*
@ -1501,13 +1501,13 @@ extern "C" {
* On some platforms, like Linux, a realtime priority thread may be subject to restrictions
* that require special handling by the application. This hint exists to let SDL know that
* the app is prepared to handle said restrictions.
*
*
* On Linux, SDL will apply the following configuration to any thread that becomes realtime:
* * The SCHED_RESET_ON_FORK bit will be set on the scheduling policy,
* * An RLIMIT_RTTIME budget will be configured to the rtkit specified limit.
* * Exceeding this limit will result in the kernel sending SIGKILL to the app,
* * Refer to the man pages for more information.
*
*
* This variable can be set to the following values:
* "0" - default platform specific behaviour
* "1" - Force SDL_THREAD_PRIORITY_TIME_CRITICAL to a realtime scheduling policy
@ -1595,7 +1595,7 @@ extern "C" {
#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK"
/**
* \brief A variable controlling whether the screensaver is enabled.
* \brief A variable controlling whether the screensaver is enabled.
*
* This variable can be set to the following values:
* "0" - Disable screensaver
@ -1608,7 +1608,7 @@ extern "C" {
/**
* \brief Tell the video driver that we only want a double buffer.
*
* By default, most lowlevel 2D APIs will use a triple buffer scheme that
* By default, most lowlevel 2D APIs will use a triple buffer scheme that
* wastes no CPU time on waiting for vsync after issuing a flip, but
* introduces a frame of latency. On the other hand, using a double buffer
* scheme instead is recommended for cases where low latency is an important
@ -1662,11 +1662,6 @@ extern "C" {
*/
#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT "SDL_VIDEO_EXTERNAL_CONTEXT"
/**
* \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
*/
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED"
/**
* \brief A variable that dictates policy for fullscreen Spaces on macOS.
*
@ -1751,9 +1746,9 @@ extern "C" {
/**
* \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p").
*
*
* If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has
* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly
* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly
* created SDL_Window:
*
* 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is
@ -1820,13 +1815,13 @@ extern "C" {
/**
* \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
*
*
* This variable can be set to the following values:
* "0" - Disable _NET_WM_BYPASS_COMPOSITOR
* "1" - Enable _NET_WM_BYPASS_COMPOSITOR
*
*
* By default SDL will use _NET_WM_BYPASS_COMPOSITOR
*
*
*/
#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
@ -1964,7 +1959,7 @@ extern "C" {
#define SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS "SDL_WINDOWS_ENABLE_MENU_MNEMONICS"
/**
* \brief A variable controlling whether the windows message loop is processed by SDL
* \brief A variable controlling whether the windows message loop is processed by SDL
*
* This variable can be set to the following values:
* "0" - The window message loop is not run
@ -2005,7 +2000,7 @@ extern "C" {
#define SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL "SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL"
/**
* \brief A variable to specify custom icon resource id from RC file on Windows platform
* \brief A variable to specify custom icon resource id from RC file on Windows platform
*/
#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON"
#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
@ -2040,58 +2035,7 @@ extern "C" {
#define SDL_HINT_WINDOWS_USE_D3D9EX "SDL_WINDOWS_USE_D3D9EX"
/**
* \brief Controls whether SDL will declare the process to be DPI aware.
*
* This hint must be set before initializing the video subsystem.
*
* The main purpose of declaring DPI awareness is to disable OS bitmap scaling of SDL windows on monitors with
* a DPI scale factor.
*
* This hint is equivalent to requesting DPI awareness via external means (e.g. calling SetProcessDpiAwarenessContext)
* and does not cause SDL to use a virtualized coordinate system, so it will generally give you 1 SDL coordinate = 1 pixel
* even on high-DPI displays.
*
* For more information, see:
* https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows
*
* This variable can be set to the following values:
* "" - Do not change the DPI awareness (default).
* "unaware" - Declare the process as DPI unaware. (Windows 8.1 and later).
* "system" - Request system DPI awareness. (Vista and later).
* "permonitor" - Request per-monitor DPI awareness. (Windows 8.1 and later).
* "permonitorv2" - Request per-monitor V2 DPI awareness. (Windows 10, version 1607 and later).
* The most visible difference from "permonitor" is that window title bar will be scaled
* to the visually correct size when dragging between monitors with different scale factors.
* This is the preferred DPI awareness level.
*
* If the requested DPI awareness is not available on the currently running OS, SDL will try to request the best
* available match.
*/
#define SDL_HINT_WINDOWS_DPI_AWARENESS "SDL_WINDOWS_DPI_AWARENESS"
/**
* \brief Uses DPI-scaled points as the SDL coordinate system on Windows.
*
* This changes the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere.
* This means windows will be appropriately sized, even when created on high-DPI displays with scaling.
*
* e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings,
* will create a window with an 800x600 client area (in pixels).
*
* Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary),
* and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows.
*
* This variable can be set to the following values:
* "0" - SDL coordinates equal Windows coordinates. No automatic window resizing when dragging
* between monitors with different scale factors (unless this is performed by
* Windows itself, which is the case when the process is DPI unaware).
* "1" - SDL coordinates are in DPI-scaled points. Automatically resize windows as needed on
* displays with non-100% scale factors.
*/
#define SDL_HINT_WINDOWS_DPI_SCALING "SDL_WINDOWS_DPI_SCALING"
/**
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
*
* This variable can be set to the following values:
* "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc)
@ -2102,7 +2046,7 @@ extern "C" {
#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
/**
* \brief A variable controlling whether the window is activated when the SDL_ShowWindow function is called
* \brief A variable controlling whether the window is activated when the SDL_ShowWindow function is called
*
* This variable can be set to the following values:
* "0" - The window is activated when the SDL_ShowWindow function is called

View file

@ -106,7 +106,7 @@ typedef enum
{
SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
/* 0x4 was SDL_WINDOW_SHOWN in SDL2, please reserve this bit for sdl2-compat. */
/* 0x00000004 was SDL_WINDOW_SHOWN in SDL2, please reserve this bit for sdl2-compat. */
SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */
SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */
SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */
@ -117,9 +117,7 @@ typedef enum
SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported.
On macOS NSHighResolutionCapable must be set true in the
application's Info.plist for this to have any effect. */
/* 0x00002000 was SDL_WINDOW_ALLOW_HIGHDPI in SDL2, please reserve this bit for sdl2-compat. */
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 */
@ -321,7 +319,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
*
* \sa SDL_GetNumVideoDisplays
*/
extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
extern DECLSPEC const char *SDLCALL SDL_GetDisplayName(int displayIndex);
/**
* Get the desktop area represented by a display.
@ -337,7 +335,7 @@ extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
*
* \sa SDL_GetNumVideoDisplays
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect);
/**
* Get the usable desktop area represented by a display.
@ -368,7 +366,7 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * re
* \sa SDL_GetDisplayBounds
* \sa SDL_GetNumVideoDisplays
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect);
extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect *rect);
/**
* Get the dots/pixels-per-inch for a display.
@ -403,7 +401,7 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rec
*
* \sa SDL_GetNumVideoDisplays
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayPhysicalDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
extern DECLSPEC int SDLCALL SDL_GetDisplayPhysicalDPI(int displayIndex, float *ddpi, float *hdpi, float *vdpi);
/**
* Get the orientation of a display.
@ -457,8 +455,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex);
*
* \sa SDL_GetNumDisplayModes
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
SDL_DisplayMode * mode);
extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, SDL_DisplayMode *mode);
/**
* Get information about the desktop's display mode.
@ -480,7 +477,7 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex,
* \sa SDL_GetDisplayMode
* \sa SDL_SetWindowDisplayMode
*/
extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode);
extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode *mode);
/**
* Get information about the current display mode.
@ -503,7 +500,7 @@ extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_Disp
* \sa SDL_GetNumVideoDisplays
* \sa SDL_SetWindowDisplayMode
*/
extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode);
extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode *mode);
/**
@ -529,7 +526,7 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_Disp
* \sa SDL_GetDisplayMode
* \sa SDL_GetNumDisplayModes
*/
extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest);
/**
* Get the index of the display containing a point
@ -543,7 +540,7 @@ extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayI
* \sa SDL_GetDisplayBounds
* \sa SDL_GetNumVideoDisplays
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayIndexForPoint(const SDL_Point * point);
extern DECLSPEC int SDLCALL SDL_GetDisplayIndexForPoint(const SDL_Point *point);
/**
* Get the index of the display primarily containing a rect
@ -558,7 +555,7 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayIndexForPoint(const SDL_Point * point)
* \sa SDL_GetDisplayBounds
* \sa SDL_GetNumVideoDisplays
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayIndexForRect(const SDL_Rect * rect);
extern DECLSPEC int SDLCALL SDL_GetDisplayIndexForRect(const SDL_Rect *rect);
/**
* Get the index of the display associated with a window.
@ -573,7 +570,7 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayIndexForRect(const SDL_Rect * rect);
* \sa SDL_GetDisplayBounds
* \sa SDL_GetNumVideoDisplays
*/
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window *window);
/**
* Set the display mode to use when a window is visible at fullscreen.
@ -594,8 +591,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
* \sa SDL_GetWindowDisplayMode
* \sa SDL_SetWindowFullscreen
*/
extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
const SDL_DisplayMode * mode);
extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window *window, const SDL_DisplayMode *mode);
/**
* Query the display mode to use when a window is visible at fullscreen.
@ -611,8 +607,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window,
* \sa SDL_SetWindowDisplayMode
* \sa SDL_SetWindowFullscreen
*/
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
SDL_DisplayMode * mode);
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window *window, SDL_DisplayMode *mode);
/**
* Get the raw ICC profile data for the screen the window is currently on.
@ -626,7 +621,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void* SDLCALL SDL_GetWindowICCProfile(SDL_Window * window, size_t* size);
extern DECLSPEC void *SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size);
/**
* Get the pixel format associated with the window.
@ -638,7 +633,7 @@ extern DECLSPEC void* SDLCALL SDL_GetWindowICCProfile(SDL_Window * window, size_
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window *window);
/**
* Create a window with the specified position, dimensions, and flags.
@ -656,22 +651,19 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
* - `SDL_WINDOW_MINIMIZED`: window is minimized
* - `SDL_WINDOW_MAXIMIZED`: window is maximized
* - `SDL_WINDOW_INPUT_GRABBED`: window has grabbed input focus
* - `SDL_WINDOW_ALLOW_HIGHDPI`: window should be created in high-DPI mode if
* supported (>= SDL 2.0.1)
*
* The SDL_Window is implicitly shown if SDL_WINDOW_HIDDEN is not set.
*
* On Apple's macOS, you **must** set the NSHighResolutionCapable Info.plist
* property to YES, otherwise you will not receive a High-DPI OpenGL canvas.
*
* If the window is created with the `SDL_WINDOW_ALLOW_HIGHDPI` flag, its size
* in pixels may differ from its size in screen coordinates on platforms with
* high-DPI support (e.g. iOS and macOS). Use SDL_GetWindowSize() to query the
* client area's size in screen coordinates, and SDL_GetWindowSizeInPixels() or
* SDL_GetRendererOutputSize() to query the drawable size in pixels. Note that
* when this flag is set, the drawable size can vary after the window is
* created and should be queried after major window events such as when the
* window is resized or moved between displays.
* The window size in pixels may differ from its size in screen coordinates if
* the window is on a high density display (one with an OS scaling factor).
* Use SDL_GetWindowSize() to query the client area's size in screen coordinates,
* and SDL_GetWindowSizeInPixels() or SDL_GetRendererOutputSize() to query the
* drawable size in pixels. Note that the drawable size can vary after the window
* is created and should be queried again when the window is resized or moved
* between displays.
*
* If the window is set fullscreen, the width and height parameters `w` and
* `h` will not be used. However, invalid size parameters (e.g. too large) may
@ -709,9 +701,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
* \sa SDL_CreateWindowFrom
* \sa SDL_DestroyWindow
*/
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
int x, int y, int w,
int h, Uint32 flags);
extern DECLSPEC SDL_Window *SDLCALL SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags);
/**
* Create an SDL window from an existing native window.
@ -730,7 +720,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
* \sa SDL_CreateWindow
* \sa SDL_DestroyWindow
*/
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
extern DECLSPEC SDL_Window *SDLCALL SDL_CreateWindowFrom(const void *data);
/**
* Get the numeric ID of a window.
@ -746,7 +736,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data);
*
* \sa SDL_GetWindowFromID
*/
extern DECLSPEC SDL_WindowID SDLCALL SDL_GetWindowID(SDL_Window * window);
extern DECLSPEC SDL_WindowID SDLCALL SDL_GetWindowID(SDL_Window *window);
/**
* Get a window from a stored ID.
@ -762,7 +752,7 @@ extern DECLSPEC SDL_WindowID SDLCALL SDL_GetWindowID(SDL_Window * window);
*
* \sa SDL_GetWindowID
*/
extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(SDL_WindowID id);
extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowFromID(SDL_WindowID id);
/**
* Get the window flags.
@ -780,7 +770,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(SDL_WindowID id);
* \sa SDL_SetWindowGrab
* \sa SDL_ShowWindow
*/
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window *window);
/**
* Set the title of a window.
@ -794,8 +784,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window);
*
* \sa SDL_GetWindowTitle
*/
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
const char *title);
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window *window, const char *title);
/**
* Get the title of a window.
@ -808,7 +797,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window,
*
* \sa SDL_SetWindowTitle
*/
extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window *window);
/**
* Set the icon for a window.
@ -818,8 +807,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
SDL_Surface * icon);
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon);
/**
* Associate an arbitrary named pointer with a window.
@ -835,9 +823,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
*
* \sa SDL_GetWindowData
*/
extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
const char *name,
void *userdata);
extern DECLSPEC void *SDLCALL SDL_SetWindowData(SDL_Window *window, const char *name, void *userdata);
/**
* Retrieve the data pointer associated with a window.
@ -850,101 +836,86 @@ extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window,
*
* \sa SDL_SetWindowData
*/
extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
const char *name);
extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window *window, const char *name);
/**
* Set the position of a window.
*
* The window coordinate origin is the upper left of the display.
* Set the position of a window, in screen coordinates.
*
* \param window the window to reposition
* \param x the x coordinate of the window in screen coordinates, or
* `SDL_WINDOWPOS_CENTERED` or `SDL_WINDOWPOS_UNDEFINED`
* \param y the y coordinate of the window in screen coordinates, or
* `SDL_WINDOWPOS_CENTERED` or `SDL_WINDOWPOS_UNDEFINED`
* \param x the x coordinate of the window, or `SDL_WINDOWPOS_CENTERED` or `SDL_WINDOWPOS_UNDEFINED`
* \param y the y coordinate of the window, or `SDL_WINDOWPOS_CENTERED` or `SDL_WINDOWPOS_UNDEFINED`
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetWindowPosition
*/
extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
int x, int y);
extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, int y);
/**
* Get the position of a window.
* Get the position of a window, in screen coordinates.
*
* If you do not need the value for one of the positions a NULL may be passed
* in the `x` or `y` parameter.
*
* \param window the window to query
* \param x a pointer filled in with the x position of the window, in screen
* coordinates, may be NULL
* \param y a pointer filled in with the y position of the window, in screen
* coordinates, may be NULL
* \param x a pointer filled in with the x position of the window, may be NULL
* \param y a pointer filled in with the y position of the window, may be NULL
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetWindowPosition
*/
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
int *x, int *y);
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window *window, int *x, int *y);
/**
* Set the size of a window's client area.
* Set the size of a window's client area, in screen coordinates.
*
* The window size in screen coordinates may differ from the size in pixels,
* if the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a platform
* with high-dpi support (e.g. iOS or macOS). Use SDL_GL_GetDrawableSize() or
* SDL_GetRendererOutputSize() to get the real client area size in pixels.
* The window size in screen coordinates may differ from the size in pixels if
* the window is on a high density display (one with an OS scaling factor).
*
* Fullscreen windows automatically match the size of the display mode, and
* you should use SDL_SetWindowDisplayMode() to change their size.
*
* \param window the window to change
* \param w the width of the window in pixels, in screen coordinates, must be
* > 0
* \param h the height of the window in pixels, in screen coordinates, must be
* > 0
* \param w the width of the window, must be > 0
* \param h the height of the window, must be > 0
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetWindowSize
* \sa SDL_SetWindowDisplayMode
*/
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
int h);
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h);
/**
* Get the size of a window's client area.
* Get the size of a window's client area, in screen coordinates.
*
* NULL can safely be passed as the `w` or `h` parameter if the width or
* height value is not desired.
*
* The window size in screen coordinates may differ from the size in pixels,
* if the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a platform
* with high-dpi support (e.g. iOS or macOS). Use SDL_GetWindowSizeInPixels(),
* SDL_GL_GetDrawableSize(), SDL_Vulkan_GetDrawableSize(), or
* SDL_GetRendererOutputSize() to get the real client area size in pixels.
* The window size in screen coordinates may differ from the size in pixels if
* the window is on a high density display (one with an OS scaling factor).
* Use SDL_GetWindowSizeInPixels(), SDL_GL_GetDrawableSize(),
* SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to get the
* real client area size in pixels.
*
* \param window the window to query the width and height from
* \param w a pointer filled in with the width of the window, in screen
* coordinates, may be NULL
* \param h a pointer filled in with the height of the window, in screen
* coordinates, may be NULL
* \param w a pointer filled in with the width of the window, may be NULL
* \param h a pointer filled in with the height of the window, may be NULL
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetWindowSizeInPixels
* \sa SDL_GL_GetDrawableSize
* \sa SDL_Vulkan_GetDrawableSize
* \sa SDL_GetWindowSizeInPixels
* \sa SDL_GetRendererOutputSize
* \sa SDL_SetWindowSize
*/
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
int *h);
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h);
/**
* Get the size of a window's borders (decorations) around the client area.
* Get the size of a window's borders (decorations) around the client area,
* in screen coordinates.
*
* Note: If this function fails (returns -1), the size values will be
* initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the
@ -975,17 +946,13 @@ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
*
* \sa SDL_GetWindowSize
*/
extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window,
int *top, int *left,
int *bottom, int *right);
extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window *window, int *top, int *left, int *bottom, int *right);
/**
* Get the size of a window in pixels.
* Get the size of a window's client area, in pixels.
*
* This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
* drawable, i.e. the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a
* platform with high-DPI support (Apple calls this "Retina"), and not
* disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint.
* The window size in pixels may differ from the size in screen coordinates if
* the window is on a high density display (one with an OS scaling factor).
*
* \param window the window from which the drawable size should be queried
* \param w a pointer to variable for storing the width in pixels, may be NULL
@ -997,26 +964,24 @@ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window,
* \sa SDL_CreateWindow
* \sa SDL_GetWindowSize
*/
extern DECLSPEC void SDLCALL SDL_GetWindowSizeInPixels(SDL_Window * window,
int *w, int *h);
extern DECLSPEC void SDLCALL SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h);
/**
* Set the minimum size of a window's client area.
* Set the minimum size of a window's client area, in screen coordinates.
*
* \param window the window to change
* \param min_w the minimum width of the window in pixels
* \param min_h the minimum height of the window in pixels
* \param min_w the minimum width of the window
* \param min_h the minimum height of the window
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetWindowMinimumSize
* \sa SDL_SetWindowMaximumSize
*/
extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
int min_w, int min_h);
extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h);
/**
* Get the minimum size of a window's client area.
* Get the minimum size of a window's client area, in screen coordinates.
*
* \param window the window to query
* \param w a pointer filled in with the minimum width of the window, may be
@ -1029,26 +994,24 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
* \sa SDL_GetWindowMaximumSize
* \sa SDL_SetWindowMinimumSize
*/
extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
int *w, int *h);
extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window *window, int *w, int *h);
/**
* Set the maximum size of a window's client area.
* Set the maximum size of a window's client area, in screen coordinates.
*
* \param window the window to change
* \param max_w the maximum width of the window in pixels
* \param max_h the maximum height of the window in pixels
* \param max_w the maximum width of the window
* \param max_h the maximum height of the window
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetWindowMaximumSize
* \sa SDL_SetWindowMinimumSize
*/
extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
int max_w, int max_h);
extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h);
/**
* Get the maximum size of a window's client area.
* Get the maximum size of a window's client area, in screen coordinates.
*
* \param window the window to query
* \param w a pointer filled in with the maximum width of the window, may be
@ -1061,8 +1024,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
* \sa SDL_GetWindowMinimumSize
* \sa SDL_SetWindowMaximumSize
*/
extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window,
int *w, int *h);
extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window, int *w, int *h);
/**
* Set the border state of a window.
@ -1080,8 +1042,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window,
*
* \sa SDL_GetWindowFlags
*/
extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
SDL_bool bordered);
extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered);
/**
* Set the user-resizable state of a window.
@ -1099,8 +1060,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window,
*
* \sa SDL_GetWindowFlags
*/
extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window,
SDL_bool resizable);
extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable);
/**
* Set the window to always be above the others.
@ -1116,8 +1076,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window,
*
* \sa SDL_GetWindowFlags
*/
extern DECLSPEC void SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window * window,
SDL_bool on_top);
extern DECLSPEC void SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top);
/**
* Show a window.
@ -1129,7 +1088,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window * window,
* \sa SDL_HideWindow
* \sa SDL_RaiseWindow
*/
extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window *window);
/**
* Hide a window.
@ -1140,7 +1099,7 @@ extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window);
*
* \sa SDL_ShowWindow
*/
extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window *window);
/**
* Raise a window above other windows and set the input focus.
@ -1149,7 +1108,7 @@ extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window);
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window *window);
/**
* Make a window as large as possible.
@ -1161,7 +1120,7 @@ extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window);
* \sa SDL_MinimizeWindow
* \sa SDL_RestoreWindow
*/
extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window *window);
/**
* Minimize a window to an iconic representation.
@ -1173,7 +1132,7 @@ extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window);
* \sa SDL_MaximizeWindow
* \sa SDL_RestoreWindow
*/
extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window *window);
/**
* Restore the size and position of a minimized or maximized window.
@ -1185,7 +1144,7 @@ extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window);
* \sa SDL_MaximizeWindow
* \sa SDL_MinimizeWindow
*/
extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window *window);
/**
* Set a window's fullscreen state.
@ -1204,8 +1163,7 @@ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
* \sa SDL_GetWindowDisplayMode
* \sa SDL_SetWindowDisplayMode
*/
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
Uint32 flags);
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags);
/**
* Get the SDL surface associated with the window.
@ -1230,7 +1188,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
* \sa SDL_UpdateWindowSurface
* \sa SDL_UpdateWindowSurfaceRects
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window);
extern DECLSPEC SDL_Surface *SDLCALL SDL_GetWindowSurface(SDL_Window *window);
/**
* Copy the window surface to the screen.
@ -1249,7 +1207,7 @@ extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window);
* \sa SDL_GetWindowSurface
* \sa SDL_UpdateWindowSurfaceRects
*/
extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window *window);
/**
* Copy areas of the window surface to the screen.
@ -1271,9 +1229,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
* \sa SDL_GetWindowSurface
* \sa SDL_UpdateWindowSurface
*/
extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
const SDL_Rect * rects,
int numrects);
extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects);
/**
* Set a window's input grab mode.
@ -1293,8 +1249,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
* \sa SDL_GetGrabbedWindow
* \sa SDL_GetWindowGrab
*/
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
SDL_bool grabbed);
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed);
/**
* Set a window's keyboard grab mode.
@ -1324,8 +1279,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
* \sa SDL_SetWindowMouseGrab
* \sa SDL_SetWindowGrab
*/
extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window * window,
SDL_bool grabbed);
extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_bool grabbed);
/**
* Set a window's mouse grab mode.
@ -1341,8 +1295,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window * window,
* \sa SDL_SetWindowKeyboardGrab
* \sa SDL_SetWindowGrab
*/
extern DECLSPEC void SDLCALL SDL_SetWindowMouseGrab(SDL_Window * window,
SDL_bool grabbed);
extern DECLSPEC void SDLCALL SDL_SetWindowMouseGrab(SDL_Window *window, SDL_bool grabbed);
/**
* Get a window's input grab mode.
@ -1354,7 +1307,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMouseGrab(SDL_Window * window,
*
* \sa SDL_SetWindowGrab
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window *window);
/**
* Get a window's keyboard grab mode.
@ -1367,7 +1320,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
* \sa SDL_SetWindowKeyboardGrab
* \sa SDL_GetWindowGrab
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window * window);
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window *window);
/**
* Get a window's mouse grab mode.
@ -1380,7 +1333,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window * window);
* \sa SDL_SetWindowKeyboardGrab
* \sa SDL_GetWindowGrab
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window * window);
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window *window);
/**
* Get the window that currently has an input grab enabled.
@ -1392,7 +1345,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window * window);
* \sa SDL_GetWindowGrab
* \sa SDL_SetWindowGrab
*/
extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
extern DECLSPEC SDL_Window *SDLCALL SDL_GetGrabbedWindow(void);
/**
* Confines the cursor to the specified area of a window.
@ -1411,7 +1364,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
* \sa SDL_GetWindowMouseRect
* \sa SDL_SetWindowMouseGrab
*/
extern DECLSPEC int SDLCALL SDL_SetWindowMouseRect(SDL_Window * window, const SDL_Rect * rect);
extern DECLSPEC int SDLCALL SDL_SetWindowMouseRect(SDL_Window *window, const SDL_Rect *rect);
/**
* Get the mouse confinement rectangle of a window.
@ -1424,7 +1377,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowMouseRect(SDL_Window * window, const SD
*
* \sa SDL_SetWindowMouseRect
*/
extern DECLSPEC const SDL_Rect * SDLCALL SDL_GetWindowMouseRect(SDL_Window * window);
extern DECLSPEC const SDL_Rect *SDLCALL SDL_GetWindowMouseRect(SDL_Window *window);
/**
* Set the opacity for a window.
@ -1443,7 +1396,7 @@ extern DECLSPEC const SDL_Rect * SDLCALL SDL_GetWindowMouseRect(SDL_Window * win
*
* \sa SDL_GetWindowOpacity
*/
extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity);
extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window *window, float opacity);
/**
* Get the opacity of a window.
@ -1464,7 +1417,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opac
*
* \sa SDL_SetWindowOpacity
*/
extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity);
extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window *window, float *out_opacity);
/**
* Set the window as a modal for another window.
@ -1476,7 +1429,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * ou
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window);
extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window *modal_window, SDL_Window *parent_window);
/**
* Explicitly set input focus to the window.
@ -1493,7 +1446,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL
*
* \sa SDL_RaiseWindow
*/
extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window);
extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window *window);
/**
* Possible return values from the SDL_HitTest callback.
@ -1568,9 +1521,7 @@ typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window,
SDL_HitTest callback,
void *callback_data);
extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *callback_data);
/**
* Request a window to demand attention from the user.
@ -1582,7 +1533,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window * window, SDL_FlashOperation operation);
extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOperation operation);
/**
* Destroy a window.
@ -1597,7 +1548,7 @@ extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window * window, SDL_FlashOperat
* \sa SDL_CreateWindow
* \sa SDL_CreateWindowFrom
*/
extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window);
/**
@ -1770,8 +1721,7 @@ extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
*extension);
extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char *extension);
/**
* Reset all previously set OpenGL context attributes to their default values.
@ -1838,8 +1788,7 @@ extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
* \sa SDL_GL_DeleteContext
* \sa SDL_GL_MakeCurrent
*/
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
window);
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *window);
/**
* Set up an OpenGL context for rendering into an OpenGL window.
@ -1855,8 +1804,7 @@ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
*
* \sa SDL_GL_CreateContext
*/
extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
SDL_GLContext context);
extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context);
/**
* Get the currently active OpenGL window.
@ -1866,7 +1814,7 @@ extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
extern DECLSPEC SDL_Window *SDLCALL SDL_GL_GetCurrentWindow(void);
/**
* Get the currently active OpenGL context.
@ -1908,7 +1856,7 @@ extern DECLSPEC SDL_EGLConfig SDLCALL SDL_EGL_GetCurrentEGLConfig(void);
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_EGLSurface SDLCALL SDL_EGL_GetWindowEGLSurface(SDL_Window * window);
extern DECLSPEC SDL_EGLSurface SDLCALL SDL_EGL_GetWindowEGLSurface(SDL_Window *window);
/**
* Sets the callbacks for defining custom EGLAttrib arrays for EGL
@ -1941,11 +1889,6 @@ extern DECLSPEC void SDLCALL SDL_EGL_SetEGLAttributeCallbacks(SDL_EGLAttribArray
*
* This returns info useful for calling glViewport().
*
* This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
* drawable, i.e. the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a
* platform with high-DPI support (Apple calls this "Retina"), and not
* disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint.
*
* \param window the window from which the drawable size should be queried
* \param w a pointer to variable for storing the width in pixels, may be NULL
* \param h a pointer to variable for storing the height in pixels, may be
@ -1956,8 +1899,7 @@ extern DECLSPEC void SDLCALL SDL_EGL_SetEGLAttributeCallbacks(SDL_EGLAttribArray
* \sa SDL_CreateWindow
* \sa SDL_GetWindowSize
*/
extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w,
int *h);
extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window *window, int *w, int *h);
/**
* Set the swap interval for the current OpenGL context.
@ -2024,7 +1966,7 @@ extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(int *interval);
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_GL_SwapWindow(SDL_Window * window);
extern DECLSPEC int SDLCALL SDL_GL_SwapWindow(SDL_Window *window);
/**
* Delete an OpenGL context.

View file

@ -251,10 +251,6 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
state->num_windows = 1;
return 1;
}
if (SDL_strcasecmp(argv[index], "--allow-highdpi") == 0) {
state->window_flags |= SDL_WINDOW_ALLOW_HIGHDPI;
return 1;
}
if (SDL_strcasecmp(argv[index], "--windows") == 0) {
++index;
if (!argv[index] || !SDL_isdigit((unsigned char)*argv[index])) {
@ -716,9 +712,6 @@ static void SDLTest_PrintWindowFlag(char *text, size_t maxlen, Uint32 flag)
case SDL_WINDOW_FOREIGN:
SDL_snprintfcat(text, maxlen, "FOREIGN");
break;
case SDL_WINDOW_ALLOW_HIGHDPI:
SDL_snprintfcat(text, maxlen, "ALLOW_HIGHDPI");
break;
case SDL_WINDOW_MOUSE_CAPTURE:
SDL_snprintfcat(text, maxlen, "MOUSE_CAPTURE");
break;
@ -767,7 +760,6 @@ static void SDLTest_PrintWindowFlags(char *text, size_t maxlen, Uint32 flags)
SDL_WINDOW_MOUSE_FOCUS,
SDL_WINDOW_FULLSCREEN_DESKTOP,
SDL_WINDOW_FOREIGN,
SDL_WINDOW_ALLOW_HIGHDPI,
SDL_WINDOW_MOUSE_CAPTURE,
SDL_WINDOW_ALWAYS_ON_TOP,
SDL_WINDOW_SKIP_TASKBAR,

View file

@ -516,4 +516,7 @@ extern void SDL_ToggleDragAndDropSupport(void);
extern int SDL_GetDisplayIndexForPoint(const SDL_Point *point);
/* This has been moved out of the public API, but is still available for now */
#define SDL_WINDOW_ALLOW_HIGHDPI 0x00002000
#endif /* SDL_sysvideo_h_ */

View file

@ -1650,13 +1650,8 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint
}
}
/* Unless the user has specified the high-DPI disabling hint, respect the
* SDL_WINDOW_ALLOW_HIGHDPI flag.
*/
if (flags & SDL_WINDOW_ALLOW_HIGHDPI) {
if (SDL_GetHintBoolean(SDL_HINT_VIDEO_HIGHDPI_DISABLED, SDL_FALSE)) {
flags &= ~SDL_WINDOW_ALLOW_HIGHDPI;
}
if (!SDL_GetHintBoolean("SDL_VIDEO_HIGHDPI_DISABLED", SDL_FALSE)) {
flags |= SDL_WINDOW_ALLOW_HIGHDPI;
}
window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
@ -3353,7 +3348,7 @@ void SDL_GL_UnloadLibrary(void)
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
typedef GLenum (APIENTRY* PFNGLGETERRORPROC) (void);
typedef void (APIENTRY* PFNGLGETINTEGERVPROC) (GLenum pname, GLint * params);
typedef void (APIENTRY* PFNGLGETINTEGERVPROC) (GLenum pname, GLint *params);
typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGPROC) (GLenum name);
#if !SDL_VIDEO_OPENGL
typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
@ -4136,7 +4131,7 @@ void SDL_GL_DeleteContext(SDL_GLContext context)
* Utility function used by SDL_WM_SetIcon(); flags & 1 for color key, flags
* & 2 for alpha channel.
*/
static void CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int flags)
static void CreateMaskFromColorKeyOrAlpha(SDL_Surface *icon, Uint8 *mask, int flags)
{
int x, y;
Uint32 colorkey;
@ -4200,7 +4195,7 @@ static void CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int
/*
* Sets the window manager icon for the display window.
*/
void SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask)
void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask)
{
if (icon && _this->SetIcon) {
/* Generate a mask if necessary, and create the icon! */

View file

@ -385,18 +385,16 @@ static const char *WIN_GetDPIAwareness(_THIS)
static void WIN_InitDPIAwareness(_THIS)
{
const char *hint = SDL_GetHint(SDL_HINT_WINDOWS_DPI_AWARENESS);
const char *hint = SDL_GetHint("SDL_WINDOWS_DPI_AWARENESS");
if (hint != NULL) {
if (SDL_strcmp(hint, "permonitorv2") == 0) {
WIN_DeclareDPIAwarePerMonitorV2(_this);
} else if (SDL_strcmp(hint, "permonitor") == 0) {
WIN_DeclareDPIAwarePerMonitor(_this);
} else if (SDL_strcmp(hint, "system") == 0) {
WIN_DeclareDPIAwareSystem(_this);
} else if (SDL_strcmp(hint, "unaware") == 0) {
WIN_DeclareDPIAwareUnaware(_this);
}
if (hint == NULL || SDL_strcmp(hint, "permonitorv2") == 0) {
WIN_DeclareDPIAwarePerMonitorV2(_this);
} else if (SDL_strcmp(hint, "permonitor") == 0) {
WIN_DeclareDPIAwarePerMonitor(_this);
} else if (SDL_strcmp(hint, "system") == 0) {
WIN_DeclareDPIAwareSystem(_this);
} else if (SDL_strcmp(hint, "unaware") == 0) {
WIN_DeclareDPIAwareUnaware(_this);
}
}
@ -404,7 +402,7 @@ static void WIN_InitDPIScaling(_THIS)
{
SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_DPI_SCALING, SDL_FALSE)) {
if (SDL_GetHintBoolean("SDL_WINDOWS_DPI_SCALING", SDL_TRUE)) {
WIN_DeclareDPIAwarePerMonitorV2(_this);
data->dpi_scaling_enabled = SDL_TRUE;

View file

@ -21,7 +21,6 @@ const char *HintsEnum[] = {
SDL_HINT_RENDER_VSYNC,
SDL_HINT_TIMER_RESOLUTION,
SDL_HINT_VIDEO_ALLOW_SCREENSAVER,
SDL_HINT_VIDEO_HIGHDPI_DISABLED,
SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES,
SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS,
SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT,
@ -45,7 +44,6 @@ const char *HintsVerbose[] = {
"SDL_RENDER_VSYNC",
"SDL_TIMER_RESOLUTION",
"SDL_VIDEO_ALLOW_SCREENSAVER",
"SDL_VIDEO_HIGHDPI_DISABLED",
"SDL_VIDEO_MAC_FULLSCREEN_SPACES",
"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS",
"SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT",

View file

@ -1753,7 +1753,7 @@ int video_setWindowCenteredOnDisplay(void *arg)
expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2));
expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2));
window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_ALLOW_HIGHDPI);
window = SDL_CreateWindow(title, x, y, w, h, 0);
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");

View file

@ -103,9 +103,6 @@ int main(int argc, char *argv[])
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Enable highdpi scaling on Windows */
SDL_SetHint(SDL_HINT_WINDOWS_DPI_SCALING, "1");
/* Initialize SDL */
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
@ -113,7 +110,7 @@ int main(int argc, char *argv[])
}
/* Create window and renderer for given surface */
window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE);
if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n", SDL_GetError());
return 1;