mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Windows: Fix window_get_size_with_decorations returning an invalid size when minimizing by storing previous value
This commit is contained in:
parent
6fd949a6dc
commit
3497a5dbf5
2 changed files with 8 additions and 0 deletions
|
|
@ -2300,6 +2300,11 @@ Size2i DisplayServerWindows::window_get_size_with_decorations(WindowID p_window)
|
||||||
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
|
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
|
||||||
const WindowData &wd = windows[p_window];
|
const WindowData &wd = windows[p_window];
|
||||||
|
|
||||||
|
// GetWindowRect() returns a zero rect for a minimized window, so we need to get the size in another way.
|
||||||
|
if (wd.minimized) {
|
||||||
|
return Size2(wd.width_with_decorations, wd.height_with_decorations);
|
||||||
|
}
|
||||||
|
|
||||||
RECT r;
|
RECT r;
|
||||||
if (GetWindowRect(wd.hWnd, &r)) { // Retrieves area inside of window border, including decoration.
|
if (GetWindowRect(wd.hWnd, &r)) { // Retrieves area inside of window border, including decoration.
|
||||||
int off_x = (wd.multiwindow_fs || (!wd.fullscreen && wd.borderless && wd.maximized)) ? FS_TRANSP_BORDER : 0;
|
int off_x = (wd.multiwindow_fs || (!wd.fullscreen && wd.borderless && wd.maximized)) ? FS_TRANSP_BORDER : 0;
|
||||||
|
|
@ -5803,6 +5808,8 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
||||||
if (!window.minimized) {
|
if (!window.minimized) {
|
||||||
window.width = window_client_rect.size.width;
|
window.width = window_client_rect.size.width;
|
||||||
window.height = window_client_rect.size.height;
|
window.height = window_client_rect.size.height;
|
||||||
|
window.width_with_decorations = window_rect.size.width;
|
||||||
|
window.height_with_decorations = window_rect.size.height;
|
||||||
|
|
||||||
rect_changed = true;
|
rect_changed = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -341,6 +341,7 @@ class DisplayServerWindows : public DisplayServer {
|
||||||
Size2 min_size;
|
Size2 min_size;
|
||||||
Size2 max_size;
|
Size2 max_size;
|
||||||
int width = 0, height = 0;
|
int width = 0, height = 0;
|
||||||
|
int width_with_decorations = 0, height_with_decorations = 0;
|
||||||
|
|
||||||
Size2 window_rect;
|
Size2 window_rect;
|
||||||
Point2 last_pos;
|
Point2 last_pos;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue