diff options
author | Julian Murgia <the.straton@gmail.com> | 2016-07-23 13:15:55 +0200 |
---|---|---|
committer | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-03-04 18:04:29 +0100 |
commit | 94103c0c025f04e75d5e163d9f0bdde27bb0c848 (patch) | |
tree | d5bb55acd30270cace54dae5537b009887de1e68 /platform/server | |
parent | ef174abf6d640e69c402b5e9628743173c313439 (diff) |
Add API to access battery power state
Done:
- X11, server (tested)
- Windows (developed, would be nice to retest)
- OSX (not tested)
Prepared (not developed):
- Android (code is here, but may not compile)
- iphone
- winrt
- bb10
- haiku
- javascript
Diffstat (limited to 'platform/server')
-rw-r--r-- | platform/server/os_server.cpp | 12 | ||||
-rw-r--r-- | platform/server/os_server.h | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index d691ae35bd..ee80080b4e 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -217,6 +217,18 @@ void OS_Server::set_cursor_shape(CursorShape p_shape) { } +PowerState OS_Server::get_power_state() { + return power_manager->get_power_state(); +} + +int OS_Server::get_power_seconds_left() { + return power_manager->get_power_seconds_left(); +} + +int OS_Server::get_power_percent_left() { + return power_manager->get_power_percent_left(); +} + void OS_Server::run() { force_quit = false; diff --git a/platform/server/os_server.h b/platform/server/os_server.h index 2b6225c48d..a035076726 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -38,6 +38,7 @@ #include "servers/audio_server.h" #include "drivers/rtaudio/audio_driver_rtaudio.h" #include "servers/physics_2d/physics_2d_server_sw.h" +#include "../x11/power_x11.h" //bitch #undef CursorShape @@ -65,6 +66,8 @@ class OS_Server : public OS_Unix { bool force_quit; InputDefault *input; + + PowerX11 *power_manager; @@ -105,6 +108,10 @@ public: virtual void move_window_to_foreground(); void run(); + + virtual PowerState get_power_state(); + virtual int get_power_seconds_left(); + virtual int get_power_percent_left(); OS_Server(); }; |