mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-04 14:24:57 +08:00
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:
+24
-80
@@ -92,7 +92,7 @@ extern "C" {
|
|||||||
* By default this hint is not set and the APK expansion files are not searched.
|
* 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"
|
#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.
|
* \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.
|
* \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
|
* 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,
|
* 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.
|
* SDL_SCANCODE_AC_BACK.
|
||||||
*
|
*
|
||||||
* The variable can be set to the following values:
|
* The variable can be set to the following values:
|
||||||
* "0" - Back button will be handled as usual for system. (default)
|
* "0" - Back button will be handled as usual for system. (default)
|
||||||
* "1" - Back button will be trapped, allowing you to handle the key press
|
* "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.)
|
* 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.
|
* 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.
|
* \brief Specify an application name.
|
||||||
*
|
*
|
||||||
* This hint lets you specify the application name sent to the OS when
|
* 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
|
* required. For example, this will often appear in volume control applets for
|
||||||
* audio streams, and in lists of applications which are inhibiting the
|
* 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.
|
* \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:
|
* For example, on Nintendo Switch controllers, normally you'd get:
|
||||||
*
|
*
|
||||||
* (Y)
|
* (Y)
|
||||||
@@ -561,9 +561,9 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* The variable can be set to the following values:
|
* The variable can be set to the following values:
|
||||||
* "0" - SDL_EVENT_TEXT_EDITING events are sent, and it is the application's
|
* "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)
|
* 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.
|
* and text that is being composed will be rendered in its own UI.
|
||||||
*/
|
*/
|
||||||
#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
|
#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
|
* \brief A variable controlling whether relative mouse motion is affected by renderer scaling
|
||||||
*
|
*
|
||||||
* This variable can be set to the following values:
|
* This variable can be set to the following values:
|
||||||
* "0" - Relative motion is unaffected by DPI or renderer's logical size
|
* "0" - Relative motion is unaffected by display scale or renderer's logical size
|
||||||
* "1" - Relative motion is scaled according to DPI scaling and 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"
|
#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
|
* disabled. You should use a string that describes what your program is doing
|
||||||
* (and, therefore, why the screensaver is disabled). For example, "Playing a
|
* (and, therefore, why the screensaver is disabled). For example, "Playing a
|
||||||
* game" or "Watching a video".
|
* game" or "Watching a video".
|
||||||
*
|
*
|
||||||
* Setting this to "" or leaving it unset will have SDL use a reasonable
|
* Setting this to "" or leaving it unset will have SDL use a reasonable
|
||||||
* default: "Playing a game" or something similar.
|
* 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
|
* 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
|
* that require special handling by the application. This hint exists to let SDL know that
|
||||||
* the app is prepared to handle said restrictions.
|
* the app is prepared to handle said restrictions.
|
||||||
*
|
*
|
||||||
* On Linux, SDL will apply the following configuration to any thread that becomes realtime:
|
* 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,
|
* * 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.
|
* * 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,
|
* * Exceeding this limit will result in the kernel sending SIGKILL to the app,
|
||||||
* * Refer to the man pages for more information.
|
* * Refer to the man pages for more information.
|
||||||
*
|
*
|
||||||
* This variable can be set to the following values:
|
* This variable can be set to the following values:
|
||||||
* "0" - default platform specific behaviour
|
* "0" - default platform specific behaviour
|
||||||
* "1" - Force SDL_THREAD_PRIORITY_TIME_CRITICAL to a realtime scheduling policy
|
* "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"
|
#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:
|
* This variable can be set to the following values:
|
||||||
* "0" - Disable screensaver
|
* "0" - Disable screensaver
|
||||||
@@ -1608,7 +1608,7 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* \brief Tell the video driver that we only want a double buffer.
|
* \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
|
* 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
|
* 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
|
* 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"
|
#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.
|
* \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").
|
* \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
|
* 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:
|
* created SDL_Window:
|
||||||
*
|
*
|
||||||
* 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is
|
* 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.
|
* \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
|
||||||
*
|
*
|
||||||
* This variable can be set to the following values:
|
* This variable can be set to the following values:
|
||||||
* "0" - Disable _NET_WM_BYPASS_COMPOSITOR
|
* "0" - Disable _NET_WM_BYPASS_COMPOSITOR
|
||||||
* "1" - Enable _NET_WM_BYPASS_COMPOSITOR
|
* "1" - Enable _NET_WM_BYPASS_COMPOSITOR
|
||||||
*
|
*
|
||||||
* By default SDL will use _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"
|
#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"
|
#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:
|
* This variable can be set to the following values:
|
||||||
* "0" - The window message loop is not run
|
* "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"
|
#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 "SDL_WINDOWS_INTRESOURCE_ICON"
|
||||||
#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL"
|
#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"
|
#define SDL_HINT_WINDOWS_USE_D3D9EX "SDL_WINDOWS_USE_D3D9EX"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Controls whether SDL will declare the process to be DPI aware.
|
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*
|
*
|
||||||
* This variable can be set to the following values:
|
* 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)
|
* "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"
|
#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:
|
* This variable can be set to the following values:
|
||||||
* "0" - The window is activated when the SDL_ShowWindow function is called
|
* "0" - The window is activated when the SDL_ShowWindow function is called
|
||||||
|
|||||||
+114
-172
File diff suppressed because it is too large
Load Diff
@@ -251,10 +251,6 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
|
|||||||
state->num_windows = 1;
|
state->num_windows = 1;
|
||||||
return 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) {
|
if (SDL_strcasecmp(argv[index], "--windows") == 0) {
|
||||||
++index;
|
++index;
|
||||||
if (!argv[index] || !SDL_isdigit((unsigned char)*argv[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:
|
case SDL_WINDOW_FOREIGN:
|
||||||
SDL_snprintfcat(text, maxlen, "FOREIGN");
|
SDL_snprintfcat(text, maxlen, "FOREIGN");
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOW_ALLOW_HIGHDPI:
|
|
||||||
SDL_snprintfcat(text, maxlen, "ALLOW_HIGHDPI");
|
|
||||||
break;
|
|
||||||
case SDL_WINDOW_MOUSE_CAPTURE:
|
case SDL_WINDOW_MOUSE_CAPTURE:
|
||||||
SDL_snprintfcat(text, maxlen, "MOUSE_CAPTURE");
|
SDL_snprintfcat(text, maxlen, "MOUSE_CAPTURE");
|
||||||
break;
|
break;
|
||||||
@@ -767,7 +760,6 @@ static void SDLTest_PrintWindowFlags(char *text, size_t maxlen, Uint32 flags)
|
|||||||
SDL_WINDOW_MOUSE_FOCUS,
|
SDL_WINDOW_MOUSE_FOCUS,
|
||||||
SDL_WINDOW_FULLSCREEN_DESKTOP,
|
SDL_WINDOW_FULLSCREEN_DESKTOP,
|
||||||
SDL_WINDOW_FOREIGN,
|
SDL_WINDOW_FOREIGN,
|
||||||
SDL_WINDOW_ALLOW_HIGHDPI,
|
|
||||||
SDL_WINDOW_MOUSE_CAPTURE,
|
SDL_WINDOW_MOUSE_CAPTURE,
|
||||||
SDL_WINDOW_ALWAYS_ON_TOP,
|
SDL_WINDOW_ALWAYS_ON_TOP,
|
||||||
SDL_WINDOW_SKIP_TASKBAR,
|
SDL_WINDOW_SKIP_TASKBAR,
|
||||||
|
|||||||
@@ -516,4 +516,7 @@ extern void SDL_ToggleDragAndDropSupport(void);
|
|||||||
|
|
||||||
extern int SDL_GetDisplayIndexForPoint(const SDL_Point *point);
|
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_ */
|
#endif /* SDL_sysvideo_h_ */
|
||||||
|
|||||||
+5
-10
@@ -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
|
if (!SDL_GetHintBoolean("SDL_VIDEO_HIGHDPI_DISABLED", SDL_FALSE)) {
|
||||||
* SDL_WINDOW_ALLOW_HIGHDPI flag.
|
flags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
||||||
*/
|
|
||||||
if (flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
|
||||||
if (SDL_GetHintBoolean(SDL_HINT_VIDEO_HIGHDPI_DISABLED, SDL_FALSE)) {
|
|
||||||
flags &= ~SDL_WINDOW_ALLOW_HIGHDPI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
|
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
|
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||||
typedef GLenum (APIENTRY* PFNGLGETERRORPROC) (void);
|
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);
|
typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGPROC) (GLenum name);
|
||||||
#if !SDL_VIDEO_OPENGL
|
#if !SDL_VIDEO_OPENGL
|
||||||
typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
|
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
|
* Utility function used by SDL_WM_SetIcon(); flags & 1 for color key, flags
|
||||||
* & 2 for alpha channel.
|
* & 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;
|
int x, y;
|
||||||
Uint32 colorkey;
|
Uint32 colorkey;
|
||||||
@@ -4200,7 +4195,7 @@ static void CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int
|
|||||||
/*
|
/*
|
||||||
* Sets the window manager icon for the display window.
|
* 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) {
|
if (icon && _this->SetIcon) {
|
||||||
/* Generate a mask if necessary, and create the icon! */
|
/* Generate a mask if necessary, and create the icon! */
|
||||||
|
|||||||
@@ -385,18 +385,16 @@ static const char *WIN_GetDPIAwareness(_THIS)
|
|||||||
|
|
||||||
static void WIN_InitDPIAwareness(_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 (hint == NULL || SDL_strcmp(hint, "permonitorv2") == 0) {
|
||||||
if (SDL_strcmp(hint, "permonitorv2") == 0) {
|
WIN_DeclareDPIAwarePerMonitorV2(_this);
|
||||||
WIN_DeclareDPIAwarePerMonitorV2(_this);
|
} else if (SDL_strcmp(hint, "permonitor") == 0) {
|
||||||
} else if (SDL_strcmp(hint, "permonitor") == 0) {
|
WIN_DeclareDPIAwarePerMonitor(_this);
|
||||||
WIN_DeclareDPIAwarePerMonitor(_this);
|
} else if (SDL_strcmp(hint, "system") == 0) {
|
||||||
} else if (SDL_strcmp(hint, "system") == 0) {
|
WIN_DeclareDPIAwareSystem(_this);
|
||||||
WIN_DeclareDPIAwareSystem(_this);
|
} else if (SDL_strcmp(hint, "unaware") == 0) {
|
||||||
} else if (SDL_strcmp(hint, "unaware") == 0) {
|
WIN_DeclareDPIAwareUnaware(_this);
|
||||||
WIN_DeclareDPIAwareUnaware(_this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,7 +402,7 @@ static void WIN_InitDPIScaling(_THIS)
|
|||||||
{
|
{
|
||||||
SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
|
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);
|
WIN_DeclareDPIAwarePerMonitorV2(_this);
|
||||||
|
|
||||||
data->dpi_scaling_enabled = SDL_TRUE;
|
data->dpi_scaling_enabled = SDL_TRUE;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ const char *HintsEnum[] = {
|
|||||||
SDL_HINT_RENDER_VSYNC,
|
SDL_HINT_RENDER_VSYNC,
|
||||||
SDL_HINT_TIMER_RESOLUTION,
|
SDL_HINT_TIMER_RESOLUTION,
|
||||||
SDL_HINT_VIDEO_ALLOW_SCREENSAVER,
|
SDL_HINT_VIDEO_ALLOW_SCREENSAVER,
|
||||||
SDL_HINT_VIDEO_HIGHDPI_DISABLED,
|
|
||||||
SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES,
|
SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES,
|
||||||
SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS,
|
SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS,
|
||||||
SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT,
|
SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT,
|
||||||
@@ -45,7 +44,6 @@ const char *HintsVerbose[] = {
|
|||||||
"SDL_RENDER_VSYNC",
|
"SDL_RENDER_VSYNC",
|
||||||
"SDL_TIMER_RESOLUTION",
|
"SDL_TIMER_RESOLUTION",
|
||||||
"SDL_VIDEO_ALLOW_SCREENSAVER",
|
"SDL_VIDEO_ALLOW_SCREENSAVER",
|
||||||
"SDL_VIDEO_HIGHDPI_DISABLED",
|
|
||||||
"SDL_VIDEO_MAC_FULLSCREEN_SPACES",
|
"SDL_VIDEO_MAC_FULLSCREEN_SPACES",
|
||||||
"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS",
|
"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS",
|
||||||
"SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT",
|
"SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT",
|
||||||
|
|||||||
@@ -1753,7 +1753,7 @@ int video_setWindowCenteredOnDisplay(void *arg)
|
|||||||
expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2));
|
expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2));
|
||||||
expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 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_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");
|
SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
|
||||||
|
|
||||||
|
|||||||
@@ -103,9 +103,6 @@ int main(int argc, char *argv[])
|
|||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
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 */
|
/* Initialize SDL */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
|
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 */
|
/* 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) {
|
if (window == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n", SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user