-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate remembering window settings into single config #97333
Consolidate remembering window settings into single config #97333
Conversation
main/main.cpp
Outdated
@@ -4051,7 +4056,7 @@ int Main::start() { | |||
sml->get_root()->set_embedding_subwindows(true); | |||
} | |||
restore_editor_window_layout = EditorSettings::get_singleton()->get_setting( | |||
"interface/editor/remember_window_size_and_position"); | |||
"interface/editor/editor_screen") == -5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I compare this variant to this signed int?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cast it to an int, like int(EditorSettings::get_singleton()->get_setting("interface/editor/editor_screen"))
or EditorSettings::get_singleton()->get_setting("interface/editor/editor_screen").operator int()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a total beginner with c++, is there a convention of using the raw values over something like an enum here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use the enum to make it safer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I found the enums! lmk if i'm doing this right
I'm not sure what's causing the build fail |
The project manager's Auto option does not work. The window spawns at 0, 0 and moves to screen center, always on screen 1. |
Refactored to only apply settings in the editor and not to project manager, which was never implemented. |
Any other considerations for this PR? |
cc. @KoBeWi |
doc/classes/EditorSettings.xml
Outdated
@@ -772,7 +772,7 @@ | |||
Translations are provided by the community. If you spot a mistake, [url=$DOCS_URL/contributing/documentation/editor_and_docs_localization.html]contribute to editor translations on Weblate![/url] | |||
</member> | |||
<member name="interface/editor/editor_screen" type="int" setter="" getter=""> | |||
The preferred monitor to display the editor. | |||
The preferred monitor to display the editor. If set to [b]Auto[/b], the editor will remember the last screen it was displayed on across restarts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The preferred monitor to display the editor. If set to [b]Auto[/b], the editor will remember the last screen it was displayed on across restarts. | |
The preferred monitor to display the editor. If [b]Auto[/b], the editor will remember the last screen it was displayed on across restarts. |
Also you could mention position and size, like in the deleted setting below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, though I think the new enum shouldn't be in DisplayServer, or at least be wrapped in TOOLS_ENABLED. It's editor-only.
editor/editor_settings.cpp
Outdated
@@ -426,12 +426,17 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { | |||
EDITOR_SETTING_USAGE(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/display_scale", 0, display_scale_hint_string, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED | PROPERTY_USAGE_EDITOR_BASIC_SETTING) | |||
EDITOR_SETTING_USAGE(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/editor/custom_display_scale", 1.0, "0.5,3,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED | PROPERTY_USAGE_EDITOR_BASIC_SETTING) | |||
|
|||
String ed_screen_hints = "Screen With Mouse Pointer:-4,Screen With Keyboard Focus:-3,Primary Screen:-2"; // Note: Main Window Screen:-1 is not used for the main window. | |||
String ed_screen_hints = "Auto (Remembers last position):-4,Screen With Mouse Pointer:-3,Screen With Keyboard Focus:-2,Primary Screen:-1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will make existing settings break as if people picked Screen With Keyboard Focus
they'll now have picked Screen With Mouse Pointer
, any reason you can't keep those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good point
@AThousandShips @KoBeWi Made changes! |
ad87f26
to
e0957c2
Compare
I pushed an update to squash the commits together, as per our preferred PR workflow. |
Thanks! And congrats for your first merged Godot contribution 🎉 |
Fixes #97051 by consolidating the
remember_window_size_and_position
editor config into a newAuto
option ininterface/editor/editor_screen
.Tested locally on MacOS build