From 3dea5fd631c9513ed09b876f25e8bf6deff49683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 14 Feb 2020 13:43:28 +0100 Subject: Remove incomplete battery status/power API It was initially implemented in #5871 for Godot 3.0, but never really completed or thoroughly tested for most platforms. It then stayed in limbo and nobody seems really keen to finish it, so it's better to remove it in 4.0, and re-add eventually (possibly with a different API) if there's demand and an implementation confirmed working on all platforms. Closes #8770. --- platform/uwp/SCsub | 1 - platform/uwp/os_uwp.cpp | 14 --------- platform/uwp/os_uwp.h | 7 ----- platform/uwp/power_uwp.cpp | 77 ---------------------------------------------- platform/uwp/power_uwp.h | 56 --------------------------------- 5 files changed, 155 deletions(-) delete mode 100644 platform/uwp/power_uwp.cpp delete mode 100644 platform/uwp/power_uwp.h (limited to 'platform/uwp') diff --git a/platform/uwp/SCsub b/platform/uwp/SCsub index c14290f0c4..620d8c3c3a 100644 --- a/platform/uwp/SCsub +++ b/platform/uwp/SCsub @@ -7,7 +7,6 @@ files = [ '#platform/windows/key_mapping_windows.cpp', '#platform/windows/windows_terminal_logger.cpp', 'joypad_uwp.cpp', - 'power_uwp.cpp', 'context_egl_uwp.cpp', 'app.cpp', 'os_uwp.cpp', diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 9748c1ef9f..3cd7a02a94 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -271,8 +271,6 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a AudioDriverManager::initialize(p_audio_driver); - power_manager = memnew(PowerUWP); - managed_object->update_clipboard(); Clipboard::ContentChanged += ref new EventHandler(managed_object, &ManagedType::on_clipboard_changed); @@ -854,18 +852,6 @@ bool OS_UWP::_check_internal_feature_support(const String &p_feature) { return p_feature == "pc"; } -OS::PowerState OS_UWP::get_power_state() { - return power_manager->get_power_state(); -} - -int OS_UWP::get_power_seconds_left() { - return power_manager->get_power_seconds_left(); -} - -int OS_UWP::get_power_percent_left() { - return power_manager->get_power_percent_left(); -} - OS_UWP::OS_UWP() { key_event_pos = 0; diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index fb43ab382e..32b899c0da 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -39,7 +39,6 @@ #include "drivers/xaudio2/audio_driver_xaudio2.h" #include "joypad_uwp.h" #include "main/input_default.h" -#include "power_uwp.h" #include "servers/audio_server.h" #include "servers/visual/rasterizer.h" #include "servers/visual_server.h" @@ -102,8 +101,6 @@ private: AudioDriverXAudio2 audio_driver; - PowerUWP *power_manager; - MouseMode mouse_mode; bool alt_mem; bool gr_mem; @@ -254,10 +251,6 @@ public: void input_event(const Ref &p_event); - virtual OS::PowerState get_power_state(); - virtual int get_power_seconds_left(); - virtual int get_power_percent_left(); - void queue_key_event(KeyEvent &p_event); OS_UWP(); diff --git a/platform/uwp/power_uwp.cpp b/platform/uwp/power_uwp.cpp deleted file mode 100644 index c6b4359392..0000000000 --- a/platform/uwp/power_uwp.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************/ -/* power_uwp.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "power_uwp.h" - -PowerUWP::PowerUWP() : - nsecs_left(-1), - percent_left(-1), - power_state(OS::POWERSTATE_UNKNOWN) { -} - -PowerUWP::~PowerUWP() { -} - -bool PowerUWP::UpdatePowerInfo() { - // TODO, WinRT: Battery info is available on at least one WinRT platform (Windows Phone 8). Implement UpdatePowerInfo as appropriate. */ - /* Notes from SDL: - - the Win32 function, GetSystemPowerStatus, is not available for use on WinRT - - Windows Phone 8 has a 'Battery' class, which is documented as available for C++ - - More info on WP8's Battery class can be found at http://msdn.microsoft.com/library/windowsphone/develop/jj207231 - */ - return false; -} - -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 OS::POWERSTATE_UNKNOWN; - } -} - -int PowerUWP::get_power_seconds_left() { - if (UpdatePowerInfo()) { - return nsecs_left; - } else { - WARN_PRINT("Power management is not implemented on this platform, defaulting to -1"); - return -1; - } -} - -int PowerUWP::get_power_percent_left() { - if (UpdatePowerInfo()) { - return percent_left; - } else { - WARN_PRINT("Power management is not implemented on this platform, defaulting to -1"); - return -1; - } -} diff --git a/platform/uwp/power_uwp.h b/platform/uwp/power_uwp.h deleted file mode 100644 index 5e28cf65e5..0000000000 --- a/platform/uwp/power_uwp.h +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************/ -/* power_uwp.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef POWER_UWP_H -#define POWER_UWP_H - -#include "core/os/dir_access.h" -#include "core/os/file_access.h" -#include "core/os/os.h" - -class PowerUWP { - -private: - int nsecs_left; - int percent_left; - OS::PowerState power_state; - - bool UpdatePowerInfo(); - -public: - PowerUWP(); - virtual ~PowerUWP(); - - OS::PowerState get_power_state(); - int get_power_seconds_left(); - int get_power_percent_left(); -}; - -#endif // POWER_UWP_H -- cgit v1.2.3