diff options
Diffstat (limited to 'Source/3rdParty/SDL2/src/power')
-rw-r--r-- | Source/3rdParty/SDL2/src/power/SDL_power.c | 12 | ||||
-rw-r--r-- | Source/3rdParty/SDL2/src/power/SDL_syspower.h | 4 | ||||
-rw-r--r-- | Source/3rdParty/SDL2/src/power/linux/SDL_syspower.c | 6 |
3 files changed, 12 insertions, 10 deletions
diff --git a/Source/3rdParty/SDL2/src/power/SDL_power.c b/Source/3rdParty/SDL2/src/power/SDL_power.c index e09e27b..de77c09 100644 --- a/Source/3rdParty/SDL2/src/power/SDL_power.c +++ b/Source/3rdParty/SDL2/src/power/SDL_power.c @@ -42,11 +42,8 @@ SDL_GetPowerInfo_Hardwired(SDL_PowerState * state, int *seconds, int *percent) return SDL_TRUE; } #endif -#endif - static SDL_GetPowerInfo_Impl implementations[] = { -#ifndef SDL_POWER_DISABLED #ifdef SDL_POWER_LINUX /* in order of preference. More than could work. */ SDL_GetPowerInfo_Linux_org_freedesktop_upower, SDL_GetPowerInfo_Linux_sys_class_power_supply, @@ -81,31 +78,34 @@ static SDL_GetPowerInfo_Impl implementations[] = { #ifdef SDL_POWER_HARDWIRED SDL_GetPowerInfo_Hardwired, #endif -#endif }; +#endif SDL_PowerState SDL_GetPowerInfo(int *seconds, int *percent) { +#ifndef SDL_POWER_DISABLED const int total = sizeof(implementations) / sizeof(implementations[0]); - int _seconds, _percent; SDL_PowerState retval = SDL_POWERSTATE_UNKNOWN; int i; +#endif + int _seconds, _percent; /* Make these never NULL for platform-specific implementations. */ if (seconds == NULL) { seconds = &_seconds; } - if (percent == NULL) { percent = &_percent; } +#ifndef SDL_POWER_DISABLED for (i = 0; i < total; i++) { if (implementations[i](&retval, seconds, percent)) { return retval; } } +#endif /* nothing was definitive. */ *seconds = -1; diff --git a/Source/3rdParty/SDL2/src/power/SDL_syspower.h b/Source/3rdParty/SDL2/src/power/SDL_syspower.h index a9bf70c..afd6268 100644 --- a/Source/3rdParty/SDL2/src/power/SDL_syspower.h +++ b/Source/3rdParty/SDL2/src/power/SDL_syspower.h @@ -40,7 +40,9 @@ SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Hardwired(SDL_PowerState *, int *, int *); + +/* this one is static in SDL_power.c */ +/* SDL_bool SDL_GetPowerInfo_Hardwired(SDL_PowerState *, int *, int *);*/ #endif /* SDL_syspower_h_ */ diff --git a/Source/3rdParty/SDL2/src/power/linux/SDL_syspower.c b/Source/3rdParty/SDL2/src/power/linux/SDL_syspower.c index 105d5fe..e6c0c1c 100644 --- a/Source/3rdParty/SDL2/src/power/linux/SDL_syspower.c +++ b/Source/3rdParty/SDL2/src/power/linux/SDL_syspower.c @@ -608,12 +608,12 @@ SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *second { SDL_bool retval = SDL_FALSE; - #if SDL_USE_LIBDBUS +#if SDL_USE_LIBDBUS SDL_DBusContext *dbus = SDL_DBus_GetContext(); char **paths = NULL; int i, numpaths = 0; - if (!SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices", + if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices", DBUS_TYPE_INVALID, DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &paths, &numpaths, DBUS_TYPE_INVALID)) { return SDL_FALSE; /* try a different approach than UPower. */ @@ -631,7 +631,7 @@ SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *second if (dbus) { dbus->free_string_array(paths); } - #endif /* SDL_USE_LIBDBUS */ +#endif /* SDL_USE_LIBDBUS */ return retval; } |