mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-30 00:17:40 +00:00
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:
parent
fb0c3197e0
commit
8994878767
27 changed files with 243 additions and 21 deletions
|
@ -1438,6 +1438,21 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
|
|||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static const char *SystemThemeName(void)
|
||||
{
|
||||
switch (SDL_GetSystemTheme()) {
|
||||
#define CASE(X) \
|
||||
case SDL_SYSTEM_THEME_##X: \
|
||||
return #X
|
||||
CASE(UNKNOWN);
|
||||
CASE(LIGHT);
|
||||
CASE(DARK);
|
||||
#undef CASE
|
||||
default:
|
||||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *DisplayOrientationName(int orientation)
|
||||
{
|
||||
switch (orientation) {
|
||||
|
@ -1505,6 +1520,9 @@ static const char *GamepadButtonName(const SDL_GamepadButton button)
|
|||
static void SDLTest_PrintEvent(SDL_Event *event)
|
||||
{
|
||||
switch (event->type) {
|
||||
case SDL_EVENT_SYSTEM_THEME_CHANGED:
|
||||
SDL_Log("SDL EVENT: System theme changed to %s\n", SystemThemeName());
|
||||
break;
|
||||
case SDL_EVENT_DISPLAY_CONNECTED:
|
||||
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " connected",
|
||||
event->display.displayID);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue