diff options
Diffstat (limited to 'platform')
29 files changed, 98 insertions, 94 deletions
diff --git a/platform/android/power_android.cpp b/platform/android/power_android.cpp index 98d4d810b9..48c9377a5a 100644 --- a/platform/android/power_android.cpp +++ b/platform/android/power_android.cpp @@ -198,19 +198,19 @@ bool power_android::GetPowerInfo_Android() { if (Android_JNI_GetPowerInfo(&plugged, &charged, &battery, &this->nsecs_left, &this->percent_left) != -1) { if (plugged) { if (charged) { - this->power_state = POWERSTATE_CHARGED; + this->power_state = OS::POWERSTATE_CHARGED; } else if (battery) { - this->power_state = POWERSTATE_CHARGING; + this->power_state = OS::POWERSTATE_CHARGING; } else { - this->power_state = POWERSTATE_NO_BATTERY; + this->power_state = OS::POWERSTATE_NO_BATTERY; this->nsecs_left = -1; this->percent_left = -1; } } else { - this->power_state = POWERSTATE_ON_BATTERY; + this->power_state = OS::POWERSTATE_ON_BATTERY; } } else { - this->power_state = POWERSTATE_UNKNOWN; + this->power_state = OS::POWERSTATE_UNKNOWN; this->nsecs_left = -1; this->percent_left = -1; } @@ -218,12 +218,12 @@ bool power_android::GetPowerInfo_Android() { return true; } -PowerState power_android::get_power_state() { +OS::PowerState power_android::get_power_state() { if (GetPowerInfo_Android()) { return power_state; } else { WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN"); - return POWERSTATE_UNKNOWN; + return OS::POWERSTATE_UNKNOWN; } } @@ -246,7 +246,7 @@ int power_android::get_power_percent_left() { } power_android::power_android() - : nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { + : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) { } power_android::~power_android() { diff --git a/platform/android/power_android.h b/platform/android/power_android.h index fc618c660d..4c7af1c771 100644 --- a/platform/android/power_android.h +++ b/platform/android/power_android.h @@ -31,7 +31,7 @@ #ifndef PLATFORM_ANDROID_POWER_ANDROID_H_ #define PLATFORM_ANDROID_POWER_ANDROID_H_ -#include "os/power.h" +#include "os/os.h" #include <android/native_window_jni.h> class power_android { @@ -57,7 +57,7 @@ private: int nsecs_left; int percent_left; - PowerState power_state; + OS::PowerState power_state; bool GetPowerInfo_Android(); bool UpdatePowerInfo(); @@ -71,7 +71,7 @@ public: static struct LocalReferenceHolder LocalReferenceHolder_Setup(const char *func); static void LocalReferenceHolder_Cleanup(struct LocalReferenceHolder *refholder); - PowerState get_power_state(); + OS::PowerState get_power_state(); int get_power_seconds_left(); int get_power_percent_left(); }; diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h index cb68f9303f..d2fafb9129 100644 --- a/platform/haiku/os_haiku.h +++ b/platform/haiku/os_haiku.h @@ -117,7 +117,7 @@ public: virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const; virtual String get_executable_path() const; - virtual PowerState get_power_state(); + virtual OS::PowerState get_power_state(); virtual int get_power_seconds_left(); virtual int get_power_percent_left(); diff --git a/platform/haiku/power_haiku.cpp b/platform/haiku/power_haiku.cpp index 449b43a621..8718b317a3 100644 --- a/platform/haiku/power_haiku.cpp +++ b/platform/haiku/power_haiku.cpp @@ -37,12 +37,12 @@ bool PowerHaiku::UpdatePowerInfo() { return false; } -PowerState PowerHaiku::get_power_state() { +OS::PowerState PowerHaiku::get_power_state() { if (UpdatePowerInfo()) { return power_state; } else { WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN"); - return POWERSTATE_UNKNOWN; + return OS::POWERSTATE_UNKNOWN; } } @@ -65,7 +65,7 @@ int PowerX11::get_power_percent_left() { } PowerHaiku::PowerHaiku() - : nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { + : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) { } PowerHaiku::~PowerHaiku() { diff --git a/platform/haiku/power_haiku.h b/platform/haiku/power_haiku.h index 12513bdaef..59a93cd976 100644 --- a/platform/haiku/power_haiku.h +++ b/platform/haiku/power_haiku.h @@ -31,11 +31,13 @@ #ifndef PLATFORM_HAIKU_POWER_HAIKU_H_ #define PLATFORM_HAIKU_POWER_HAIKU_H_ +#include <os/os.h> + class PowerHaiku { private: int nsecs_left; int percent_left; - PowerState power_state; + OS::PowerState power_state; bool UpdatePowerInfo(); @@ -43,7 +45,7 @@ public: PowerHaiku(); virtual ~PowerHaiku(); - PowerState get_power_state(); + OS::PowerState get_power_state(); int get_power_seconds_left(); int get_power_percent_left(); }; diff --git a/platform/iphone/power_iphone.cpp b/platform/iphone/power_iphone.cpp index 2811e62108..055d31ef0a 100644 --- a/platform/iphone/power_iphone.cpp +++ b/platform/iphone/power_iphone.cpp @@ -30,15 +30,15 @@ #include "power_iphone.h" -bool PowerState::UpdatePowerInfo() { +bool OS::PowerState::UpdatePowerInfo() { return false; } -PowerState PowerIphone::get_power_state() { +OS::PowerState PowerIphone::get_power_state() { if (UpdatePowerInfo()) { return power_state; } else { - return POWERSTATE_UNKNOWN; + return OS::POWERSTATE_UNKNOWN; } } @@ -59,7 +59,7 @@ int PowerIphone::get_power_percent_left() { } PowerIphone::PowerIphone() - : nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { + : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) { // TODO Auto-generated constructor stub } diff --git a/platform/iphone/power_iphone.h b/platform/iphone/power_iphone.h index b4fb8d62dc..6270a8069c 100644 --- a/platform/iphone/power_iphone.h +++ b/platform/iphone/power_iphone.h @@ -31,11 +31,13 @@ #ifndef PLATFORM_IPHONE_POWER_IPHONE_H_ #define PLATFORM_IPHONE_POWER_IPHONE_H_ +#include <os/os.h> + class PowerIphone { private: int nsecs_left; int percent_left; - PowerState power_state; + OS::PowerState power_state; bool UpdatePowerInfo(); @@ -43,7 +45,7 @@ public: PowerIphone(); virtual ~PowerIphone(); - PowerState get_power_state(); + OS::PowerState get_power_state(); int get_power_seconds_left(); int get_power_percent_left(); }; diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index ac8d367366..543d028576 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -976,7 +976,7 @@ String OS_JavaScript::get_joy_guid(int p_device) const { return input->get_joy_guid_remapped(p_device); } -PowerState OS_JavaScript::get_power_state() { +OS::PowerState OS_JavaScript::get_power_state() { return power_manager->get_power_state(); } diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index f78a3f2768..4c6469cb58 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -165,7 +165,7 @@ public: virtual String get_joy_guid(int p_device) const; bool joy_connection_changed(int p_type, const EmscriptenGamepadEvent *p_event); - virtual PowerState get_power_state(); + virtual OS::PowerState get_power_state(); virtual int get_power_seconds_left(); virtual int get_power_percent_left(); diff --git a/platform/javascript/power_javascript.cpp b/platform/javascript/power_javascript.cpp index 3d54146595..10964502d4 100644 --- a/platform/javascript/power_javascript.cpp +++ b/platform/javascript/power_javascript.cpp @@ -36,12 +36,12 @@ bool PowerJavascript::UpdatePowerInfo() { return false; } -PowerState PowerJavascript::get_power_state() { +OS::PowerState PowerJavascript::get_power_state() { if (UpdatePowerInfo()) { return power_state; } else { WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN"); - return POWERSTATE_UNKNOWN; + return OS::POWERSTATE_UNKNOWN; } } @@ -64,7 +64,7 @@ int PowerJavascript::get_power_percent_left() { } PowerJavascript::PowerJavascript() - : nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { + : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) { } PowerJavascript::~PowerJavascript() { diff --git a/platform/javascript/power_javascript.h b/platform/javascript/power_javascript.h index 834d765557..8454c5d728 100644 --- a/platform/javascript/power_javascript.h +++ b/platform/javascript/power_javascript.h @@ -31,13 +31,13 @@ #ifndef PLATFORM_JAVASCRIPT_POWER_JAVASCRIPT_H_ #define PLATFORM_JAVASCRIPT_POWER_JAVASCRIPT_H_ -#include "os/power.h" +#include "os/os.h" class PowerJavascript { private: int nsecs_left; int percent_left; - PowerState power_state; + OS::PowerState power_state; bool UpdatePowerInfo(); @@ -45,7 +45,7 @@ public: PowerJavascript(); virtual ~PowerJavascript(); - PowerState get_power_state(); + OS::PowerState get_power_state(); int get_power_seconds_left(); int get_power_percent_left(); }; diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index ca3e5745e9..059dd5afd0 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -216,7 +216,7 @@ public: virtual void set_ime_position(const Point2 &p_pos); virtual void set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_inp); - virtual PowerState get_power_state(); + virtual OS::PowerState get_power_state(); virtual int get_power_seconds_left(); virtual int get_power_percent_left(); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index beda6f4c38..5a23d76755 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1914,7 +1914,7 @@ String OS_OSX::get_joy_guid(int p_device) const { return input->get_joy_guid_remapped(p_device); } -PowerState OS_OSX::get_power_state() { +OS::PowerState OS_OSX::get_power_state() { return power_manager->get_power_state(); } diff --git a/platform/osx/power_osx.cpp b/platform/osx/power_osx.cpp index 5f3938cb91..eed03e63c1 100644 --- a/platform/osx/power_osx.cpp +++ b/platform/osx/power_osx.cpp @@ -174,7 +174,7 @@ bool power_osx::GetPowerInfo_MacOSX() { nsecs_left = -1; percent_left = -1; - power_state = POWERSTATE_UNKNOWN; + power_state = OS::POWERSTATE_UNKNOWN; if (blob != NULL) { CFArrayRef list = IOPSCopyPowerSourcesList(blob); @@ -194,13 +194,13 @@ bool power_osx::GetPowerInfo_MacOSX() { } if (!have_battery) { - power_state = POWERSTATE_NO_BATTERY; + power_state = OS::POWERSTATE_NO_BATTERY; } else if (charging) { - power_state = POWERSTATE_CHARGING; + power_state = OS::POWERSTATE_CHARGING; } else if (have_ac) { - power_state = POWERSTATE_CHARGED; + power_state = OS::POWERSTATE_CHARGED; } else { - power_state = POWERSTATE_ON_BATTERY; + power_state = OS::POWERSTATE_ON_BATTERY; } CFRelease(list); @@ -218,11 +218,11 @@ bool power_osx::UpdatePowerInfo() { return false; } -PowerState power_osx::get_power_state() { +OS::PowerState power_osx::get_power_state() { if (UpdatePowerInfo()) { return power_state; } else { - return POWERSTATE_UNKNOWN; + return OS::POWERSTATE_UNKNOWN; } } @@ -243,7 +243,7 @@ int power_osx::get_power_percent_left() { } power_osx::power_osx() - : nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { + : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) { } power_osx::~power_osx() { diff --git a/platform/osx/power_osx.h b/platform/osx/power_osx.h index 692c850d7c..20e47e9cd9 100644 --- a/platform/osx/power_osx.h +++ b/platform/osx/power_osx.h @@ -33,7 +33,7 @@ #include "dir_access_osx.h" #include "os/file_access.h" -#include "os/power.h" +#include "os/os.h" #include <CoreFoundation/CoreFoundation.h> class power_osx { @@ -41,7 +41,7 @@ class power_osx { private: int nsecs_left; int percent_left; - PowerState power_state; + OS::PowerState power_state; void checkps(CFDictionaryRef dict, bool *have_ac, bool *have_battery, bool *charging); bool GetPowerInfo_MacOSX(/*PowerState * state, int *seconds, int *percent*/); bool UpdatePowerInfo(); @@ -50,7 +50,7 @@ public: power_osx(); virtual ~power_osx(); - PowerState get_power_state(); + OS::PowerState get_power_state(); int get_power_seconds_left(); int get_power_percent_left(); }; diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index 44034e815d..e2bb464e76 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -200,7 +200,7 @@ void OS_Server::move_window_to_foreground() { void OS_Server::set_cursor_shape(CursorShape p_shape) { } -PowerState OS_Server::get_power_state() { +OS::PowerState OS_Server::get_power_state() { return power_manager->get_power_state(); } diff --git a/platform/server/os_server.h b/platform/server/os_server.h index f3db053be3..8c0ca1a58d 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -106,7 +106,7 @@ public: void run(); - virtual PowerState get_power_state(); + virtual OS::PowerState get_power_state(); virtual int get_power_seconds_left(); virtual int get_power_percent_left(); diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 3a8932aae2..fd8904fa0a 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -855,7 +855,7 @@ bool OSUWP::_check_internal_feature_support(const String &p_feature) { return p_feature == "pc" || p_feature == "s3tc"; } -PowerState OSUWP::get_power_state() { +OS::PowerState OSUWP::get_power_state() { return power_manager->get_power_state(); } diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index 5f36396017..a7a5d32cb9 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -259,7 +259,7 @@ public: void input_event(const Ref<InputEvent> &p_event); - virtual PowerState get_power_state(); + virtual OS::PowerState get_power_state(); virtual int get_power_seconds_left(); virtual int get_power_percent_left(); diff --git a/platform/uwp/power_uwp.cpp b/platform/uwp/power_uwp.cpp index 07a726647d..81e97b1391 100644 --- a/platform/uwp/power_uwp.cpp +++ b/platform/uwp/power_uwp.cpp @@ -31,7 +31,7 @@ #include "power_uwp.h" PowerUWP::PowerUWP() - : nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { + : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) { } PowerUWP::~PowerUWP() { @@ -47,12 +47,12 @@ bool PowerUWP::UpdatePowerInfo() { return false; } -PowerState PowerUWP::get_power_state() { +OS::PowerState PowerUWP::get_power_state() { if (UpdatePowerInfo()) { return power_state; } else { WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN"); - return POWERSTATE_UNKNOWN; + return OS::POWERSTATE_UNKNOWN; } } diff --git a/platform/uwp/power_uwp.h b/platform/uwp/power_uwp.h index 9a9811a4f5..0c57689c50 100644 --- a/platform/uwp/power_uwp.h +++ b/platform/uwp/power_uwp.h @@ -33,14 +33,14 @@ #include "os/dir_access.h" #include "os/file_access.h" -#include "os/power.h" +#include "os/os.h" class PowerUWP { private: int nsecs_left; int percent_left; - PowerState power_state; + OS::PowerState power_state; bool UpdatePowerInfo(); @@ -48,7 +48,7 @@ public: PowerUWP(); virtual ~PowerUWP(); - PowerState get_power_state(); + OS::PowerState get_power_state(); int get_power_seconds_left(); int get_power_percent_left(); }; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 530072db6e..62954e1a56 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2353,7 +2353,7 @@ bool OS_Windows::is_vsync_enabled() const { return true; } -PowerState OS_Windows::get_power_state() { +OS::PowerState OS_Windows::get_power_state() { return power_manager->get_power_state(); } diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 474b0fea5c..1a01ac950d 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -281,7 +281,7 @@ public: virtual void set_use_vsync(bool p_enable); virtual bool is_vsync_enabled() const; - virtual PowerState get_power_state(); + virtual OS::PowerState get_power_state(); virtual int get_power_seconds_left(); virtual int get_power_percent_left(); diff --git a/platform/windows/power_windows.cpp b/platform/windows/power_windows.cpp index b37e189a3a..8d86f160f1 100644 --- a/platform/windows/power_windows.cpp +++ b/platform/windows/power_windows.cpp @@ -64,19 +64,19 @@ bool PowerWindows::GetPowerInfo_Windows() { /* This API should exist back to Win95. */ if (!GetSystemPowerStatus(&status)) { /* !!! FIXME: push GetLastError() into GetError() */ - power_state = POWERSTATE_UNKNOWN; + power_state = OS::POWERSTATE_UNKNOWN; } else if (status.BatteryFlag == 0xFF) { /* unknown state */ - power_state = POWERSTATE_UNKNOWN; + power_state = OS::POWERSTATE_UNKNOWN; } else if (status.BatteryFlag & (1 << 7)) { /* no battery */ - power_state = POWERSTATE_NO_BATTERY; + power_state = OS::POWERSTATE_NO_BATTERY; } else if (status.BatteryFlag & (1 << 3)) { /* charging */ - power_state = POWERSTATE_CHARGING; + power_state = OS::POWERSTATE_CHARGING; need_details = TRUE; } else if (status.ACLineStatus == 1) { - power_state = POWERSTATE_CHARGED; /* on AC, not charging. */ + power_state = OS::POWERSTATE_CHARGED; /* on AC, not charging. */ need_details = TRUE; } else { - power_state = POWERSTATE_ON_BATTERY; /* not on AC. */ + power_state = OS::POWERSTATE_ON_BATTERY; /* not on AC. */ need_details = TRUE; } @@ -97,11 +97,11 @@ bool PowerWindows::GetPowerInfo_Windows() { return TRUE; /* always the definitive answer on Windows. */ } -PowerState PowerWindows::get_power_state() { +OS::PowerState PowerWindows::get_power_state() { if (GetPowerInfo_Windows()) { return power_state; } else { - return POWERSTATE_UNKNOWN; + return OS::POWERSTATE_UNKNOWN; } } @@ -122,7 +122,7 @@ int PowerWindows::get_power_percent_left() { } PowerWindows::PowerWindows() - : nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { + : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) { } PowerWindows::~PowerWindows() { diff --git a/platform/windows/power_windows.h b/platform/windows/power_windows.h index 9da9841f48..0745615195 100644 --- a/platform/windows/power_windows.h +++ b/platform/windows/power_windows.h @@ -33,7 +33,7 @@ #include "os/dir_access.h" #include "os/file_access.h" -#include "os/power.h" +#include "os/os.h" #include <windows.h> @@ -42,7 +42,7 @@ class PowerWindows { private: int nsecs_left; int percent_left; - PowerState power_state; + OS::PowerState power_state; bool GetPowerInfo_Windows(); @@ -50,7 +50,7 @@ public: PowerWindows(); virtual ~PowerWindows(); - PowerState get_power_state(); + OS::PowerState get_power_state(); int get_power_seconds_left(); int get_power_percent_left(); }; diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index f61ccacb98..4e78e0318c 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -2167,7 +2167,7 @@ void OS_X11::set_context(int p_context) { } } -PowerState OS_X11::get_power_state() { +OS::PowerState OS_X11::get_power_state() { return power_manager->get_power_state(); } diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 14c737d45e..2ba7f07cef 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -269,7 +269,7 @@ public: virtual void set_use_vsync(bool p_enable); virtual bool is_vsync_enabled() const; - virtual PowerState get_power_state(); + virtual OS::PowerState get_power_state(); virtual int get_power_seconds_left(); virtual int get_power_percent_left(); diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp index 32100354a6..76ff7f91fb 100644 --- a/platform/x11/power_x11.cpp +++ b/platform/x11/power_x11.cpp @@ -252,7 +252,7 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() { this->nsecs_left = -1; this->percent_left = -1; - this->power_state = POWERSTATE_UNKNOWN; + this->power_state = OS::POWERSTATE_UNKNOWN; dirp->change_dir(proc_acpi_battery_path); Error err = dirp->list_dir_begin(); @@ -282,13 +282,13 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() { } if (!have_battery) { - this->power_state = POWERSTATE_NO_BATTERY; + this->power_state = OS::POWERSTATE_NO_BATTERY; } else if (charging) { - this->power_state = POWERSTATE_CHARGING; + this->power_state = OS::POWERSTATE_CHARGING; } else if (have_ac) { - this->power_state = POWERSTATE_CHARGED; + this->power_state = OS::POWERSTATE_CHARGED; } else { - this->power_state = POWERSTATE_ON_BATTERY; + this->power_state = OS::POWERSTATE_ON_BATTERY; } return true; /* definitive answer. */ @@ -400,17 +400,17 @@ bool PowerX11::GetPowerInfo_Linux_proc_apm() { } if (battery_flag == 0xFF) { /* unknown state */ - this->power_state = POWERSTATE_UNKNOWN; + this->power_state = OS::POWERSTATE_UNKNOWN; } else if (battery_flag & (1 << 7)) { /* no battery */ - this->power_state = POWERSTATE_NO_BATTERY; + this->power_state = OS::POWERSTATE_NO_BATTERY; } else if (battery_flag & (1 << 3)) { /* charging */ - this->power_state = POWERSTATE_CHARGING; + this->power_state = OS::POWERSTATE_CHARGING; need_details = true; } else if (ac_status == 1) { - this->power_state = POWERSTATE_CHARGED; /* on AC, not charging. */ + this->power_state = OS::POWERSTATE_CHARGED; /* on AC, not charging. */ need_details = true; } else { - this->power_state = POWERSTATE_ON_BATTERY; + this->power_state = OS::POWERSTATE_ON_BATTERY; need_details = true; } @@ -445,7 +445,7 @@ bool PowerX11::GetPowerInfo_Linux_sys_class_power_supply(/*PowerState *state, in return false; } - this->power_state = POWERSTATE_NO_BATTERY; /* assume we're just plugged in. */ + this->power_state = OS::POWERSTATE_NO_BATTERY; /* assume we're just plugged in. */ this->nsecs_left = -1; this->percent_left = -1; @@ -454,7 +454,7 @@ bool PowerX11::GetPowerInfo_Linux_sys_class_power_supply(/*PowerState *state, in while (name != "") { bool choose = false; char str[64]; - PowerState st; + OS::PowerState st; int secs; int pct; @@ -475,17 +475,17 @@ bool PowerX11::GetPowerInfo_Linux_sys_class_power_supply(/*PowerState *state, in /* some drivers don't offer this, so if it's not explicitly reported assume it's present. */ if (read_power_file(base, name.utf8().get_data(), "present", str, sizeof(str)) && (String(str) == "0\n")) { - st = POWERSTATE_NO_BATTERY; + st = OS::POWERSTATE_NO_BATTERY; } else if (!read_power_file(base, name.utf8().get_data(), "status", str, sizeof(str))) { - st = POWERSTATE_UNKNOWN; /* uh oh */ + st = OS::POWERSTATE_UNKNOWN; /* uh oh */ } else if (String(str) == "Charging\n") { - st = POWERSTATE_CHARGING; + st = OS::POWERSTATE_CHARGING; } else if (String(str) == "Discharging\n") { - st = POWERSTATE_ON_BATTERY; + st = OS::POWERSTATE_ON_BATTERY; } else if ((String(str) == "Full\n") || (String(str) == "Not charging\n")) { - st = POWERSTATE_CHARGED; + st = OS::POWERSTATE_CHARGED; } else { - st = POWERSTATE_UNKNOWN; /* uh oh */ + st = OS::POWERSTATE_UNKNOWN; /* uh oh */ } if (!read_power_file(base, name.utf8().get_data(), "capacity", str, sizeof(str))) { @@ -543,17 +543,17 @@ bool PowerX11::UpdatePowerInfo() { } PowerX11::PowerX11() - : nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) { + : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) { } PowerX11::~PowerX11() { } -PowerState PowerX11::get_power_state() { +OS::PowerState PowerX11::get_power_state() { if (UpdatePowerInfo()) { return power_state; } else { - return POWERSTATE_UNKNOWN; + return OS::POWERSTATE_UNKNOWN; } } diff --git a/platform/x11/power_x11.h b/platform/x11/power_x11.h index e34223036d..7fc258bc0d 100644 --- a/platform/x11/power_x11.h +++ b/platform/x11/power_x11.h @@ -33,14 +33,14 @@ #include "os/dir_access.h" #include "os/file_access.h" -#include "os/power.h" +#include "os/os.h" class PowerX11 { private: int nsecs_left; int percent_left; - PowerState power_state; + OS::PowerState power_state; FileAccessRef open_power_file(const char *base, const char *node, const char *key); bool read_power_file(const char *base, const char *node, const char *key, char *buf, size_t buflen); @@ -58,7 +58,7 @@ public: PowerX11(); virtual ~PowerX11(); - PowerState get_power_state(); + OS::PowerState get_power_state(); int get_power_seconds_left(); int get_power_percent_left(); }; |