mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-29 10:44:16 +00: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:
@@ -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,
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
@@ -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! */
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user