summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/DisplayServer.xml15
-rw-r--r--doc/classes/Window.xml8
-rw-r--r--platform/android/display_server_android.cpp6
-rw-r--r--platform/android/display_server_android.h3
-rw-r--r--platform/ios/display_server_ios.h3
-rw-r--r--platform/ios/display_server_ios.mm6
-rw-r--r--platform/linuxbsd/x11/display_server_x11.cpp44
-rw-r--r--platform/linuxbsd/x11/display_server_x11.h3
-rw-r--r--platform/macos/display_server_macos.h3
-rw-r--r--platform/macos/display_server_macos.mm23
-rw-r--r--platform/web/display_server_web.cpp8
-rw-r--r--platform/web/display_server_web.h3
-rw-r--r--platform/windows/display_server_windows.cpp22
-rw-r--r--platform/windows/display_server_windows.h3
-rw-r--r--scene/main/window.cpp14
-rw-r--r--scene/main/window.h3
-rw-r--r--servers/display_server.cpp3
-rw-r--r--servers/display_server.h3
-rw-r--r--servers/display_server_headless.h3
19 files changed, 148 insertions, 28 deletions
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index c59bfbfe4f..38b264d20f 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -1156,14 +1156,14 @@
<return type="Vector2i" />
<param index="0" name="window_id" type="int" default="0" />
<description>
- Returns the position of the given window to on the screen.
+ Returns the position of the client area of the given window on the screen.
</description>
</method>
- <method name="window_get_real_size" qualifiers="const">
+ <method name="window_get_position_with_decorations" qualifiers="const">
<return type="Vector2i" />
<param index="0" name="window_id" type="int" default="0" />
<description>
- Returns the size of the window specified by [param window_id] (in pixels), including the borders drawn by the operating system. See also [method window_get_size].
+ Returns the position of the given window on the screen including the borders drawn by the operating system. See also [method window_get_position].
</description>
</method>
<method name="window_get_safe_title_margins" qualifiers="const">
@@ -1177,7 +1177,14 @@
<return type="Vector2i" />
<param index="0" name="window_id" type="int" default="0" />
<description>
- Returns the size of the window specified by [param window_id] (in pixels), excluding the borders drawn by the operating system. This is also called the "client area". See also [method window_get_real_size], [method window_set_size] and [method window_get_position].
+ Returns the size of the window specified by [param window_id] (in pixels), excluding the borders drawn by the operating system. This is also called the "client area". See also [method window_get_size_with_decorations], [method window_set_size] and [method window_get_position].
+ </description>
+ </method>
+ <method name="window_get_size_with_decorations" qualifiers="const">
+ <return type="Vector2i" />
+ <param index="0" name="window_id" type="int" default="0" />
+ <description>
+ Returns the size of the window specified by [param window_id] (in pixels), including the borders drawn by the operating system. See also [method window_get_size].
</description>
</method>
<method name="window_get_vsync_mode" qualifiers="const">
diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml
index 8707ef003a..d736f103ab 100644
--- a/doc/classes/Window.xml
+++ b/doc/classes/Window.xml
@@ -41,7 +41,13 @@
Returns layout direction and text writing direction.
</description>
</method>
- <method name="get_real_size" qualifiers="const">
+ <method name="get_position_with_decorations" qualifiers="const">
+ <return type="Vector2i" />
+ <description>
+ Returns the window's position including its border.
+ </description>
+ </method>
+ <method name="get_size_with_decorations" qualifiers="const">
<return type="Vector2i" />
<description>
Returns the window's size including its border.
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp
index 937b929d62..057fffc470 100644
--- a/platform/android/display_server_android.cpp
+++ b/platform/android/display_server_android.cpp
@@ -366,6 +366,10 @@ Point2i DisplayServerAndroid::window_get_position(DisplayServer::WindowID p_wind
return Point2i();
}
+Point2i DisplayServerAndroid::window_get_position_with_decorations(DisplayServer::WindowID p_window) const {
+ return Point2i();
+}
+
void DisplayServerAndroid::window_set_position(const Point2i &p_position, DisplayServer::WindowID p_window) {
// Not supported on Android.
}
@@ -398,7 +402,7 @@ Size2i DisplayServerAndroid::window_get_size(DisplayServer::WindowID p_window) c
return OS_Android::get_singleton()->get_display_size();
}
-Size2i DisplayServerAndroid::window_get_real_size(DisplayServer::WindowID p_window) const {
+Size2i DisplayServerAndroid::window_get_size_with_decorations(DisplayServer::WindowID p_window) const {
return OS_Android::get_singleton()->get_display_size();
}
diff --git a/platform/android/display_server_android.h b/platform/android/display_server_android.h
index c7f4d8046f..08d947ebf9 100644
--- a/platform/android/display_server_android.h
+++ b/platform/android/display_server_android.h
@@ -150,6 +150,7 @@ public:
virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const override;
+ virtual Point2i window_get_position_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override;
virtual void window_set_transient(WindowID p_window, WindowID p_parent) override;
@@ -162,7 +163,7 @@ public:
virtual void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const override;
- virtual Size2i window_get_real_size(WindowID p_window = MAIN_WINDOW_ID) const override;
+ virtual Size2i window_get_size_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) override;
virtual WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const override;
diff --git a/platform/ios/display_server_ios.h b/platform/ios/display_server_ios.h
index 447f919139..78046d7a57 100644
--- a/platform/ios/display_server_ios.h
+++ b/platform/ios/display_server_ios.h
@@ -162,6 +162,7 @@ public:
virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const override;
+ virtual Point2i window_get_position_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override;
virtual void window_set_transient(WindowID p_window, WindowID p_parent) override;
@@ -174,7 +175,7 @@ public:
virtual void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const override;
- virtual Size2i window_get_real_size(WindowID p_window = MAIN_WINDOW_ID) const override;
+ virtual Size2i window_get_size_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) override;
virtual WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const override;
diff --git a/platform/ios/display_server_ios.mm b/platform/ios/display_server_ios.mm
index 6793b40dd4..cd0740aa39 100644
--- a/platform/ios/display_server_ios.mm
+++ b/platform/ios/display_server_ios.mm
@@ -496,6 +496,10 @@ Point2i DisplayServerIOS::window_get_position(WindowID p_window) const {
return Point2i();
}
+Point2i DisplayServerIOS::window_get_position_with_decorations(WindowID p_window) const {
+ return Point2i();
+}
+
void DisplayServerIOS::window_set_position(const Point2i &p_position, WindowID p_window) {
// Probably not supported for single window iOS app
}
@@ -529,7 +533,7 @@ Size2i DisplayServerIOS::window_get_size(WindowID p_window) const {
return Size2i(screenBounds.size.width, screenBounds.size.height) * screen_get_max_scale();
}
-Size2i DisplayServerIOS::window_get_real_size(WindowID p_window) const {
+Size2i DisplayServerIOS::window_get_size_with_decorations(WindowID p_window) const {
return window_get_size(p_window);
}
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index ec6947e180..7e81fee3cf 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -1397,8 +1397,8 @@ void DisplayServerX11::window_set_mouse_passthrough(const Vector<Vector2> &p_reg
XRectangle rect;
rect.x = 0;
rect.y = 0;
- rect.width = window_get_real_size(p_window).x;
- rect.height = window_get_real_size(p_window).y;
+ rect.width = window_get_size_with_decorations(p_window).x;
+ rect.height = window_get_size_with_decorations(p_window).y;
XUnionRectWithRegion(&rect, region, region);
} else {
XPoint *points = (XPoint *)memalloc(sizeof(XPoint) * p_region.size());
@@ -1618,6 +1618,40 @@ Point2i DisplayServerX11::window_get_position(WindowID p_window) const {
return wd.position;
}
+Point2i DisplayServerX11::window_get_position_with_decorations(WindowID p_window) const {
+ _THREAD_SAFE_METHOD_
+
+ ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
+ const WindowData &wd = windows[p_window];
+
+ if (wd.fullscreen) {
+ return wd.position;
+ }
+
+ XWindowAttributes xwa;
+ XSync(x11_display, False);
+ XGetWindowAttributes(x11_display, wd.x11_window, &xwa);
+ int x = wd.position.x;
+ int y = wd.position.y;
+ Atom prop = XInternAtom(x11_display, "_NET_FRAME_EXTENTS", True);
+ if (prop != None) {
+ Atom type;
+ int format;
+ unsigned long len;
+ unsigned long remaining;
+ unsigned char *data = nullptr;
+ if (XGetWindowProperty(x11_display, wd.x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
+ if (format == 32 && len == 4 && data) {
+ long *extents = (long *)data;
+ x -= extents[0]; // left
+ y -= extents[2]; // top
+ }
+ XFree(data);
+ }
+ }
+ return Size2i(x, y);
+}
+
void DisplayServerX11::window_set_position(const Point2i &p_position, WindowID p_window) {
_THREAD_SAFE_METHOD_
@@ -1762,12 +1796,16 @@ Size2i DisplayServerX11::window_get_size(WindowID p_window) const {
return wd.size;
}
-Size2i DisplayServerX11::window_get_real_size(WindowID p_window) const {
+Size2i DisplayServerX11::window_get_size_with_decorations(WindowID p_window) const {
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
const WindowData &wd = windows[p_window];
+ if (wd.fullscreen) {
+ return wd.size;
+ }
+
XWindowAttributes xwa;
XSync(x11_display, False);
XGetWindowAttributes(x11_display, wd.x11_window, &xwa);
diff --git a/platform/linuxbsd/x11/display_server_x11.h b/platform/linuxbsd/x11/display_server_x11.h
index c88a6b466a..c85363cf90 100644
--- a/platform/linuxbsd/x11/display_server_x11.h
+++ b/platform/linuxbsd/x11/display_server_x11.h
@@ -392,6 +392,7 @@ public:
virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const override;
+ virtual Point2i window_get_position_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override;
virtual void window_set_max_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
@@ -405,7 +406,7 @@ public:
virtual void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const override;
- virtual Size2i window_get_real_size(WindowID p_window = MAIN_WINDOW_ID) const override;
+ virtual Size2i window_get_size_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) override;
virtual WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const override;
diff --git a/platform/macos/display_server_macos.h b/platform/macos/display_server_macos.h
index 8f315f736b..bd26f6e417 100644
--- a/platform/macos/display_server_macos.h
+++ b/platform/macos/display_server_macos.h
@@ -355,6 +355,7 @@ public:
virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const override;
+ virtual Point2i window_get_position_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override;
virtual void window_set_transient(WindowID p_window, WindowID p_parent) override;
@@ -368,7 +369,7 @@ public:
virtual void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const override;
- virtual Size2i window_get_real_size(WindowID p_window = MAIN_WINDOW_ID) const override;
+ virtual Size2i window_get_size_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) override;
virtual WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const override;
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index ad6143e16e..5c979dbf22 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -2414,6 +2414,27 @@ Point2i DisplayServerMacOS::window_get_position(WindowID p_window) const {
return pos;
}
+Point2i DisplayServerMacOS::window_get_position_with_decorations(WindowID p_window) const {
+ _THREAD_SAFE_METHOD_
+
+ ERR_FAIL_COND_V(!windows.has(p_window), Point2i());
+ const WindowData &wd = windows[p_window];
+
+ const NSRect nsrect = [wd.window_object frame];
+ Point2i pos;
+
+ // Return the position of the top-left corner, for OS X the y starts at the bottom.
+ const float scale = screen_get_max_scale();
+ pos.x = nsrect.origin.x;
+ pos.y = (nsrect.origin.y + nsrect.size.height);
+ pos *= scale;
+ pos -= _get_screens_origin();
+ // OS X native y-coordinate relative to _get_screens_origin() is negative,
+ // Godot expects a positive value.
+ pos.y *= -1;
+ return pos;
+}
+
void DisplayServerMacOS::window_set_position(const Point2i &p_position, WindowID p_window) {
_THREAD_SAFE_METHOD_
@@ -2573,7 +2594,7 @@ Size2i DisplayServerMacOS::window_get_size(WindowID p_window) const {
return wd.size;
}
-Size2i DisplayServerMacOS::window_get_real_size(WindowID p_window) const {
+Size2i DisplayServerMacOS::window_get_size_with_decorations(WindowID p_window) const {
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
diff --git a/platform/web/display_server_web.cpp b/platform/web/display_server_web.cpp
index f704124704..2413d79ca2 100644
--- a/platform/web/display_server_web.cpp
+++ b/platform/web/display_server_web.cpp
@@ -943,7 +943,11 @@ void DisplayServerWeb::window_set_current_screen(int p_screen, WindowID p_window
}
Point2i DisplayServerWeb::window_get_position(WindowID p_window) const {
- return Point2i(); // TODO Does this need implementation?
+ return Point2i();
+}
+
+Point2i DisplayServerWeb::window_get_position_with_decorations(WindowID p_window) const {
+ return Point2i();
}
void DisplayServerWeb::window_set_position(const Point2i &p_position, WindowID p_window) {
@@ -980,7 +984,7 @@ Size2i DisplayServerWeb::window_get_size(WindowID p_window) const {
return Size2i(size[0], size[1]);
}
-Size2i DisplayServerWeb::window_get_real_size(WindowID p_window) const {
+Size2i DisplayServerWeb::window_get_size_with_decorations(WindowID p_window) const {
return window_get_size(p_window);
}
diff --git a/platform/web/display_server_web.h b/platform/web/display_server_web.h
index 1919736802..b8354a3355 100644
--- a/platform/web/display_server_web.h
+++ b/platform/web/display_server_web.h
@@ -182,6 +182,7 @@ public:
virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const override;
+ virtual Point2i window_get_position_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override;
virtual void window_set_transient(WindowID p_window, WindowID p_parent) override;
@@ -194,7 +195,7 @@ public:
virtual void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const override;
- virtual Size2i window_get_real_size(WindowID p_window = MAIN_WINDOW_ID) const override;
+ virtual Size2i window_get_size_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) override;
virtual WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const override;
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index c704a26b7a..a64d2eb96d 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -909,6 +909,24 @@ Point2i DisplayServerWindows::window_get_position(WindowID p_window) const {
return Point2i(point.x, point.y);
}
+Point2i DisplayServerWindows::window_get_position_with_decorations(WindowID p_window) const {
+ _THREAD_SAFE_METHOD_
+
+ ERR_FAIL_COND_V(!windows.has(p_window), Point2i());
+ const WindowData &wd = windows[p_window];
+
+ if (wd.minimized) {
+ return wd.last_pos;
+ }
+
+ RECT r;
+ if (GetWindowRect(wd.hWnd, &r)) {
+ return Point2i(r.left, r.top);
+ }
+
+ return Point2i();
+}
+
void DisplayServerWindows::_update_real_mouse_position(WindowID p_window) {
ERR_FAIL_COND(!windows.has(p_window));
@@ -1124,7 +1142,7 @@ Size2i DisplayServerWindows::window_get_size(WindowID p_window) const {
return Size2();
}
-Size2i DisplayServerWindows::window_get_real_size(WindowID p_window) const {
+Size2i DisplayServerWindows::window_get_size_with_decorations(WindowID p_window) const {
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -2414,7 +2432,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
case WM_GETMINMAXINFO: {
if (windows[window_id].resizable && !windows[window_id].fullscreen) {
// Size of window decorations.
- Size2 decor = window_get_real_size(window_id) - window_get_size(window_id);
+ Size2 decor = window_get_size_with_decorations(window_id) - window_get_size(window_id);
MINMAXINFO *min_max_info = (MINMAXINFO *)lParam;
if (windows[window_id].min_size != Size2()) {
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index 8ac0086d69..4702bb7765 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -555,6 +555,7 @@ public:
virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const override;
+ virtual Point2i window_get_position_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override;
virtual void window_set_transient(WindowID p_window, WindowID p_parent) override;
@@ -568,7 +569,7 @@ public:
virtual void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
virtual Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const override;
- virtual Size2i window_get_real_size(WindowID p_window = MAIN_WINDOW_ID) const override; //wtf is this? should probable use proper name
+ virtual Size2i window_get_size_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) override;
virtual WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const override;
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index aff2c594d9..73436b1658 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -106,9 +106,16 @@ void Window::reset_size() {
set_size(Size2i());
}
-Size2i Window::get_real_size() const {
+Point2i Window::get_position_with_decorations() const {
if (window_id != DisplayServer::INVALID_WINDOW_ID) {
- return DisplayServer::get_singleton()->window_get_real_size(window_id);
+ return DisplayServer::get_singleton()->window_get_position_with_decorations(window_id);
+ }
+ return position;
+}
+
+Size2i Window::get_size_with_decorations() const {
+ if (window_id != DisplayServer::INVALID_WINDOW_ID) {
+ return DisplayServer::get_singleton()->window_get_size_with_decorations(window_id);
}
return size;
}
@@ -1655,7 +1662,8 @@ void Window::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_size"), &Window::get_size);
ClassDB::bind_method(D_METHOD("reset_size"), &Window::reset_size);
- ClassDB::bind_method(D_METHOD("get_real_size"), &Window::get_real_size);
+ ClassDB::bind_method(D_METHOD("get_position_with_decorations"), &Window::get_position_with_decorations);
+ ClassDB::bind_method(D_METHOD("get_size_with_decorations"), &Window::get_size_with_decorations);
ClassDB::bind_method(D_METHOD("set_max_size", "max_size"), &Window::set_max_size);
ClassDB::bind_method(D_METHOD("get_max_size"), &Window::get_max_size);
diff --git a/scene/main/window.h b/scene/main/window.h
index 03597b309a..48ce9041a4 100644
--- a/scene/main/window.h
+++ b/scene/main/window.h
@@ -198,7 +198,8 @@ public:
Size2i get_size() const;
void reset_size();
- Size2i get_real_size() const;
+ Point2i get_position_with_decorations() const;
+ Size2i get_size_with_decorations() const;
void set_max_size(const Size2i &p_max_size);
Size2i get_max_size() const;
diff --git a/servers/display_server.cpp b/servers/display_server.cpp
index 52d7f66203..8d59a226fd 100644
--- a/servers/display_server.cpp
+++ b/servers/display_server.cpp
@@ -643,6 +643,7 @@ void DisplayServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("window_set_current_screen", "screen", "window_id"), &DisplayServer::window_set_current_screen, DEFVAL(MAIN_WINDOW_ID));
ClassDB::bind_method(D_METHOD("window_get_position", "window_id"), &DisplayServer::window_get_position, DEFVAL(MAIN_WINDOW_ID));
+ ClassDB::bind_method(D_METHOD("window_get_position_with_decorations", "window_id"), &DisplayServer::window_get_position_with_decorations, DEFVAL(MAIN_WINDOW_ID));
ClassDB::bind_method(D_METHOD("window_set_position", "position", "window_id"), &DisplayServer::window_set_position, DEFVAL(MAIN_WINDOW_ID));
ClassDB::bind_method(D_METHOD("window_get_size", "window_id"), &DisplayServer::window_get_size, DEFVAL(MAIN_WINDOW_ID));
@@ -661,7 +662,7 @@ void DisplayServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("window_get_min_size", "window_id"), &DisplayServer::window_get_min_size, DEFVAL(MAIN_WINDOW_ID));
ClassDB::bind_method(D_METHOD("window_set_min_size", "min_size", "window_id"), &DisplayServer::window_set_min_size, DEFVAL(MAIN_WINDOW_ID));
- ClassDB::bind_method(D_METHOD("window_get_real_size", "window_id"), &DisplayServer::window_get_real_size, DEFVAL(MAIN_WINDOW_ID));
+ ClassDB::bind_method(D_METHOD("window_get_size_with_decorations", "window_id"), &DisplayServer::window_get_size_with_decorations, DEFVAL(MAIN_WINDOW_ID));
ClassDB::bind_method(D_METHOD("window_get_mode", "window_id"), &DisplayServer::window_get_mode, DEFVAL(MAIN_WINDOW_ID));
ClassDB::bind_method(D_METHOD("window_set_mode", "mode", "window_id"), &DisplayServer::window_set_mode, DEFVAL(MAIN_WINDOW_ID));
diff --git a/servers/display_server.h b/servers/display_server.h
index a796377f88..f7c296b0d3 100644
--- a/servers/display_server.h
+++ b/servers/display_server.h
@@ -353,6 +353,7 @@ public:
virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) = 0;
virtual Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const = 0;
+ virtual Point2i window_get_position_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const = 0;
virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) = 0;
virtual void window_set_transient(WindowID p_window, WindowID p_parent) = 0;
@@ -366,7 +367,7 @@ public:
virtual void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) = 0;
virtual Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const = 0;
- virtual Size2i window_get_real_size(WindowID p_window = MAIN_WINDOW_ID) const = 0; // FIXME: Find clearer name for this.
+ virtual Size2i window_get_size_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const = 0;
virtual void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) = 0;
virtual WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const = 0;
diff --git a/servers/display_server_headless.h b/servers/display_server_headless.h
index e1a27b6137..94b5f3c1e9 100644
--- a/servers/display_server_headless.h
+++ b/servers/display_server_headless.h
@@ -90,6 +90,7 @@ public:
void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) override {}
Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const override { return Point2i(); }
+ Point2i window_get_position_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override { return Point2i(); }
void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override {}
void window_set_transient(WindowID p_window, WindowID p_parent) override {}
@@ -102,7 +103,7 @@ public:
void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override {}
Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const override { return Size2i(); }
- Size2i window_get_real_size(WindowID p_window = MAIN_WINDOW_ID) const override { return Size2i(); }
+ Size2i window_get_size_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override { return Size2i(); }
void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) override {}
WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const override { return WINDOW_MODE_MINIMIZED; }