summaryrefslogtreecommitdiff
path: root/platform/windows/display_server_windows.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-07 14:29:46 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-07 14:29:46 +0100
commit0a3f66471ed79d9b1852150cb059f20f841d46d9 (patch)
tree3fa41499970c449b5c7062b03182a94ab88208a5 /platform/windows/display_server_windows.cpp
parent39ad411369f554d44ec4bf4723995374e0bde156 (diff)
parentedf13eb5a635112c5df0aa81f11c8004274f62cf (diff)
Merge pull request #69712 from bruvzg/real_size
Rename `window_get_real_size`, add position counterpart.
Diffstat (limited to 'platform/windows/display_server_windows.cpp')
-rw-r--r--platform/windows/display_server_windows.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 459b2f10e1..e7864ebac0 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()) {