Added SDL_GetSystemTheme() to return whether the system is using a dark or light color theme, and SDL_EVENT_SYSTEM_THEME_CHANGED is sent when this changes
Fixes https://github.com/libsdl-org/SDL/issues/5334 Fixes https://github.com/libsdl-org/SDL/issues/6958 Closes https://github.com/libsdl-org/SDL/pull/6440
This commit is contained in:
@@ -87,6 +87,8 @@ typedef enum
|
||||
|
||||
SDL_EVENT_LOCALE_CHANGED, /**< The user's locale preferences have changed. */
|
||||
|
||||
SDL_EVENT_SYSTEM_THEME_CHANGED, /**< The system theme changed */
|
||||
|
||||
/* Display events */
|
||||
/* 0x150 was SDL_DISPLAYEVENT, reserve the number for sdl2-compat */
|
||||
SDL_EVENT_DISPLAY_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
|
||||
|
||||
@@ -43,6 +43,16 @@ extern "C" {
|
||||
typedef Uint32 SDL_DisplayID;
|
||||
typedef Uint32 SDL_WindowID;
|
||||
|
||||
/**
|
||||
* \brief System theme
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_SYSTEM_THEME_UNKNOWN, /**< Unknown system theme */
|
||||
SDL_SYSTEM_THEME_LIGHT, /**< Light colored system theme */
|
||||
SDL_SYSTEM_THEME_DARK, /**< Dark colored system theme */
|
||||
} SDL_SystemTheme;
|
||||
|
||||
/**
|
||||
* \brief The structure that defines a display mode
|
||||
*
|
||||
@@ -65,6 +75,18 @@ typedef struct
|
||||
void *driverdata; /**< driver-specific data, initialize to 0 */
|
||||
} SDL_DisplayMode;
|
||||
|
||||
/**
|
||||
* \brief Display orientation
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */
|
||||
SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */
|
||||
SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */
|
||||
SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */
|
||||
SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */
|
||||
} SDL_DisplayOrientation;
|
||||
|
||||
/**
|
||||
* \brief The type used to identify a window
|
||||
*
|
||||
@@ -151,18 +173,6 @@ typedef enum
|
||||
#define SDL_WINDOWPOS_ISCENTERED(X) \
|
||||
(((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
|
||||
|
||||
/**
|
||||
* \brief Display orientation
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */
|
||||
SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */
|
||||
SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */
|
||||
SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */
|
||||
SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */
|
||||
} SDL_DisplayOrientation;
|
||||
|
||||
/**
|
||||
* \brief Window flash operation
|
||||
*/
|
||||
@@ -297,6 +307,15 @@ extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
|
||||
|
||||
/**
|
||||
* Get the current system theme
|
||||
*
|
||||
* \returns the current system theme, light, dark, or unknown
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void);
|
||||
|
||||
/**
|
||||
* Get a list of currently connected displays.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user