summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-08-08 12:04:04 +0200
committerGitHub <noreply@github.com>2022-08-08 12:04:04 +0200
commit5df8eae86292303fefe2d412fb8c04126e7ebe87 (patch)
tree7882e72df128ae9bbe8ea4bf88f74863619ff1b2
parent76391a091ed69f02ebdcc94164bac9d917c21606 (diff)
parentc939f336d6e26bb0d84f23e5a2587bc296b35dbf (diff)
Merge pull request #64014 from RedMser/keep-screen-on-singledef
-rw-r--r--core/config/project_settings.cpp3
-rw-r--r--doc/classes/ProjectSettings.xml3
-rw-r--r--main/main.cpp1
-rw-r--r--platform/ios/display_server_ios.mm2
-rw-r--r--platform/linuxbsd/display_server_x11.cpp2
-rw-r--r--platform/macos/display_server_macos.mm2
-rw-r--r--platform/uwp/os_uwp.cpp2
-rw-r--r--platform/windows/display_server_windows.cpp2
8 files changed, 11 insertions, 6 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 38db7f9190..5c4bcc687a 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -1198,6 +1198,9 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("display/window/size/window_height_override", 0);
custom_prop_info["display/window/size/window_height_override"] = PropertyInfo(Variant::INT, "display/window/size/window_height_override", PROPERTY_HINT_RANGE, "0,4320,1,or_greater"); // 8K resolution
+ GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true);
+ GLOBAL_DEF("display/window/energy_saving/keep_screen_on.editor", false);
+
GLOBAL_DEF_BASIC("audio/buses/default_bus_layout", "res://default_bus_layout.tres");
custom_prop_info["audio/buses/default_bus_layout"] = PropertyInfo(Variant::STRING, "audio/buses/default_bus_layout", PROPERTY_HINT_FILE, "*.tres");
GLOBAL_DEF_RST("audio/general/2d_panning_strength", 1.0f);
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 40477d27d4..9df8d2df80 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -549,6 +549,9 @@
<member name="display/window/energy_saving/keep_screen_on" type="bool" setter="" getter="" default="true">
If [code]true[/code], keeps the screen on (even in case of inactivity), so the screensaver does not take over. Works on desktop and mobile platforms.
</member>
+ <member name="display/window/energy_saving/keep_screen_on.editor" type="bool" setter="" getter="" default="false">
+ Editor-only override for [member display/window/energy_saving/keep_screen_on]. Does not affect exported projects in debug or release mode.
+ </member>
<member name="display/window/handheld/orientation" type="int" setter="" getter="" default="0">
The default screen orientation to use on mobile devices. See [enum DisplayServer.ScreenOrientation] for possible values.
[b]Note:[/b] When set to a portrait orientation, this project setting does not flip the project resolution's width and height automatically. Instead, you have to set [member display/window/size/viewport_width] and [member display/window/size/viewport_height] accordingly.
diff --git a/main/main.cpp b/main/main.cpp
index 4c4377a174..965fcc66c6 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1481,7 +1481,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->_allow_layered = false;
}
- OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true);
if (rtm == -1) {
rtm = GLOBAL_DEF("rendering/driver/threads/thread_model", OS::RENDER_THREAD_SAFE);
}
diff --git a/platform/ios/display_server_ios.mm b/platform/ios/display_server_ios.mm
index 080ee5f3ab..6ce7e676a2 100644
--- a/platform/ios/display_server_ios.mm
+++ b/platform/ios/display_server_ios.mm
@@ -128,7 +128,7 @@ DisplayServerIOS::DisplayServerIOS(const String &p_rendering_driver, WindowMode
}
#endif
- bool keep_screen_on = bool(GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true));
+ bool keep_screen_on = bool(GLOBAL_GET("display/window/energy_saving/keep_screen_on"));
screen_set_keep_on(keep_screen_on);
Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events);
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 3409e43ba5..8efbd2e3c5 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -4991,7 +4991,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
#ifdef DBUS_ENABLED
screensaver = memnew(FreeDesktopScreenSaver);
- screen_set_keep_on(GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true));
+ screen_set_keep_on(GLOBAL_GET("display/window/energy_saving/keep_screen_on"));
#endif
r_error = OK;
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index e228007246..a49485154b 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -3286,7 +3286,7 @@ DisplayServerMacOS::DisplayServerMacOS(const String &p_rendering_driver, WindowM
}
#endif
- screen_set_keep_on(GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true));
+ screen_set_keep_on(GLOBAL_GET("display/window/energy_saving/keep_screen_on"));
}
DisplayServerMacOS::~DisplayServerMacOS() {
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 7bc4c6047c..40f93bb18b 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -275,7 +275,7 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
display_request->RequestActive();
}
- set_keep_screen_on(GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true));
+ set_keep_screen_on(GLOBAL_GET("display/window/energy_saving/keep_screen_on"));
return OK;
}
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index a975d09a9d..8c8dbef8a4 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -3653,7 +3653,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
tts = memnew(TTS_Windows);
// Enforce default keep screen on value.
- screen_set_keep_on(GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true));
+ screen_set_keep_on(GLOBAL_GET("display/window/energy_saving/keep_screen_on"));
// Note: Wacom WinTab driver API for pen input, for devices incompatible with Windows Ink.
HMODULE wintab_lib = LoadLibraryW(L"wintab32.dll");