From 5ec1b698d24173542ede9e8f31ff552875d508d5 Mon Sep 17 00:00:00 2001 From: jeana helver <32199119+jeanahelver@users.noreply.github.com> Date: Wed, 21 Jun 2023 17:56:23 +0200 Subject: [PATCH] Fix missing enum value for `Window.initial_position` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reorder the properties in a possibly more intuitive order. Co-authored-by: RĂ©mi Verschelde --- scene/main/window.cpp | 12 +++++++----- scene/main/window.h | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/scene/main/window.cpp b/scene/main/window.cpp index eab280e67a8..b08fceb1832 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -2660,13 +2660,15 @@ void Window::_bind_methods() { ClassDB::bind_method(D_METHOD("popup_exclusive_centered_ratio", "from_node", "ratio"), &Window::popup_exclusive_centered_ratio, DEFVAL(0.8)); ClassDB::bind_method(D_METHOD("popup_exclusive_centered_clamped", "from_node", "minsize", "fallback_ratio"), &Window::popup_exclusive_centered_clamped, DEFVAL(Size2i()), DEFVAL(0.75)); - ADD_PROPERTY(PropertyInfo(Variant::INT, "initial_position", PROPERTY_HINT_ENUM, "Absolute,Center of Primary Screen,Center of Other Screen,Center of Screen With Mouse Pointer,Center of Screen With Keyboard Focus"), "set_initial_position", "get_initial_position"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "title"), "set_title", "get_title"); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "position", PROPERTY_HINT_NONE, "suffix:px"), "set_position", "get_position"); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "size", PROPERTY_HINT_NONE, "suffix:px"), "set_size", "get_size"); + // Keep the enum values in sync with the `Mode` enum. ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Windowed,Minimized,Maximized,Fullscreen"), "set_mode", "get_mode"); - // Keep the enum values in sync with the `DisplayServer::SCREEN_` enum. + ADD_PROPERTY(PropertyInfo(Variant::STRING, "title"), "set_title", "get_title"); + + // Keep the enum values in sync with the `WindowInitialPosition` enum. + ADD_PROPERTY(PropertyInfo(Variant::INT, "initial_position", PROPERTY_HINT_ENUM, "Absolute,Center of Primary Screen,Center of Main Window Screen,Center of Other Screen,Center of Screen With Mouse Pointer,Center of Screen With Keyboard Focus"), "set_initial_position", "get_initial_position"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "position", PROPERTY_HINT_NONE, "suffix:px"), "set_position", "get_position"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "size", PROPERTY_HINT_NONE, "suffix:px"), "set_size", "get_size"); ADD_PROPERTY(PropertyInfo(Variant::INT, "current_screen", PROPERTY_HINT_RANGE, "0,64,1,or_greater"), "set_current_screen", "get_current_screen"); ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "mouse_passthrough_polygon"), "set_mouse_passthrough_polygon", "get_mouse_passthrough_polygon"); diff --git a/scene/main/window.h b/scene/main/window.h index d0afd0ff9f2..b98b888380b 100644 --- a/scene/main/window.h +++ b/scene/main/window.h @@ -43,6 +43,7 @@ class ThemeOwner; class Window : public Viewport { GDCLASS(Window, Viewport) public: + // Keep synced with enum hint for `mode` property. enum Mode { MODE_WINDOWED = DisplayServer::WINDOW_MODE_WINDOWED, MODE_MINIMIZED = DisplayServer::WINDOW_MODE_MINIMIZED, @@ -88,6 +89,7 @@ public: DEFAULT_WINDOW_SIZE = 100, }; + // Keep synced with enum hint for `initial_position` property. enum WindowInitialPosition { WINDOW_INITIAL_POSITION_ABSOLUTE, WINDOW_INITIAL_POSITION_CENTER_PRIMARY_SCREEN,