mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Sync display/window/size/initial_position_type
and Window::WINDOW_INITIAL_POSITION_
enum.
(cherry picked from commit d990f594a0
)
This commit is contained in:
parent
a2e1a028bb
commit
a2b01e420d
3 changed files with 9 additions and 8 deletions
|
@ -1497,9 +1497,10 @@ ProjectSettings::ProjectSettings() {
|
|||
|
||||
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "display/window/size/mode", PROPERTY_HINT_ENUM, "Windowed,Minimized,Maximized,Fullscreen,Exclusive Fullscreen"), 0);
|
||||
|
||||
// Keep the enum values in sync with the `DisplayServer::SCREEN_` enum.
|
||||
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "display/window/size/initial_position_type", PROPERTY_HINT_ENUM, "Absolute,Center of Primary Screen,Center of Other Screen,Center of Screen With Mouse Pointer,Center of Screen With Keyboard Focus"), 1);
|
||||
// Keep the enum values in sync with the `Window::WINDOW_INITIAL_POSITION_` enum.
|
||||
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "display/window/size/initial_position_type", PROPERTY_HINT_ENUM, "Absolute:0,Center of Primary Screen:1,Center of Other Screen:3,Center of Screen With Mouse Pointer:4,Center of Screen With Keyboard Focus:5"), 1);
|
||||
GLOBAL_DEF_BASIC(PropertyInfo(Variant::VECTOR2I, "display/window/size/initial_position"), Vector2i());
|
||||
// Keep the enum values in sync with the `DisplayServer::SCREEN_` enum.
|
||||
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "display/window/size/initial_screen", PROPERTY_HINT_RANGE, "0,64,1,or_greater"), 0);
|
||||
|
||||
GLOBAL_DEF_BASIC("display/window/size/resizable", true);
|
||||
|
|
|
@ -2479,27 +2479,27 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||
}
|
||||
window_mode = (DisplayServer::WindowMode)(GLOBAL_GET("display/window/size/mode").operator int());
|
||||
int initial_position_type = GLOBAL_GET("display/window/size/initial_position_type").operator int();
|
||||
if (initial_position_type == 0) { // Absolute.
|
||||
if (initial_position_type == Window::WINDOW_INITIAL_POSITION_ABSOLUTE) { // Absolute.
|
||||
if (!init_use_custom_pos) {
|
||||
init_custom_pos = GLOBAL_GET("display/window/size/initial_position").operator Vector2i();
|
||||
init_use_custom_pos = true;
|
||||
}
|
||||
} else if (initial_position_type == 1) { // Center of Primary Screen.
|
||||
} else if (initial_position_type == Window::WINDOW_INITIAL_POSITION_CENTER_PRIMARY_SCREEN || initial_position_type == Window::WINDOW_INITIAL_POSITION_CENTER_MAIN_WINDOW_SCREEN) { // Center of Primary Screen.
|
||||
if (!init_use_custom_screen) {
|
||||
init_screen = DisplayServer::SCREEN_PRIMARY;
|
||||
init_use_custom_screen = true;
|
||||
}
|
||||
} else if (initial_position_type == 2) { // Center of Other Screen.
|
||||
} else if (initial_position_type == Window::WINDOW_INITIAL_POSITION_CENTER_OTHER_SCREEN) { // Center of Other Screen.
|
||||
if (!init_use_custom_screen) {
|
||||
init_screen = GLOBAL_GET("display/window/size/initial_screen").operator int();
|
||||
init_use_custom_screen = true;
|
||||
}
|
||||
} else if (initial_position_type == 3) { // Center of Screen With Mouse Pointer.
|
||||
} else if (initial_position_type == Window::WINDOW_INITIAL_POSITION_CENTER_SCREEN_WITH_MOUSE_FOCUS) { // Center of Screen With Mouse Pointer.
|
||||
if (!init_use_custom_screen) {
|
||||
init_screen = DisplayServer::SCREEN_WITH_MOUSE_FOCUS;
|
||||
init_use_custom_screen = true;
|
||||
}
|
||||
} else if (initial_position_type == 4) { // Center of Screen With Keyboard Focus.
|
||||
} else if (initial_position_type == Window::WINDOW_INITIAL_POSITION_CENTER_SCREEN_WITH_KEYBOARD_FOCUS) { // Center of Screen With Keyboard Focus.
|
||||
if (!init_use_custom_screen) {
|
||||
init_screen = DisplayServer::SCREEN_WITH_KEYBOARD_FOCUS;
|
||||
init_use_custom_screen = true;
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
DEFAULT_WINDOW_SIZE = 100,
|
||||
};
|
||||
|
||||
// Keep synced with enum hint for `initial_position` property.
|
||||
// Keep synced with enum hint for `initial_position` property and `display/window/size/initial_position_type` project setting.
|
||||
enum WindowInitialPosition {
|
||||
WINDOW_INITIAL_POSITION_ABSOLUTE,
|
||||
WINDOW_INITIAL_POSITION_CENTER_PRIMARY_SCREEN,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue