summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2023-02-02 21:30:09 +0100
committerMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2023-02-02 22:40:03 +0100
commit6165498d0e125636cf39d2ea00f44689e2da31b6 (patch)
tree30e606c9d002a0371071518b3709bcfc834830bd /platform
parent18e827ee46b00f6909c8c3b56bcd07d332b89cdc (diff)
Fix windowsize for fullscreen windows on windowcreation on Windows
Fortunately the location in the codebase was easy to find because there was a FIXME comment.
Diffstat (limited to 'platform')
-rw-r--r--platform/windows/display_server_windows.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 777d05584c..f083cc202f 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -3959,10 +3959,19 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
wd.im_position = Vector2();
- // FIXME this is wrong in cases where the window coordinates were changed due to full screen mode; use WindowRect
- wd.last_pos = p_rect.position;
- wd.width = p_rect.size.width;
- wd.height = p_rect.size.height;
+ if (p_mode == WINDOW_MODE_FULLSCREEN || p_mode == WINDOW_MODE_EXCLUSIVE_FULLSCREEN || p_mode == WINDOW_MODE_MAXIMIZED) {
+ RECT r;
+ GetClientRect(wd.hWnd, &r);
+ ClientToScreen(wd.hWnd, (POINT *)&r.left);
+ ClientToScreen(wd.hWnd, (POINT *)&r.right);
+ wd.last_pos = Point2i(r.left, r.top) - _get_screens_origin();
+ wd.width = r.right - r.left;
+ wd.height = r.bottom - r.top;
+ } else {
+ wd.last_pos = p_rect.position;
+ wd.width = p_rect.size.width;
+ wd.height = p_rect.size.height;
+ }
window_id_counter++;
}