summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/windows/os_windows.cpp15
-rw-r--r--platform/windows/os_windows.h3
2 files changed, 13 insertions, 5 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 6544314825..55d667c101 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1876,6 +1876,8 @@ void OS_Windows::set_window_fullscreen(bool p_enabled) {
if (p_enabled) {
+ was_maximized = maximized;
+
if (pre_fs_valid) {
GetWindowRect(hWnd, &pre_fs_rect);
}
@@ -1905,7 +1907,7 @@ void OS_Windows::set_window_fullscreen(bool p_enabled) {
rect.bottom = video_mode.height;
}
- _update_window_style(false);
+ _update_window_style(false, was_maximized);
MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE);
@@ -2087,12 +2089,16 @@ bool OS_Windows::get_borderless_window() {
return video_mode.borderless_window;
}
-void OS_Windows::_update_window_style(bool repaint) {
+void OS_Windows::_update_window_style(bool p_repaint, bool p_maximized) {
if (video_mode.fullscreen || video_mode.borderless_window) {
SetWindowLongPtr(hWnd, GWL_STYLE, WS_SYSMENU | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE);
} else {
if (video_mode.resizable) {
- SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE);
+ if (p_maximized) {
+ SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_MAXIMIZE);
+ } else {
+ SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE);
+ }
} else {
SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_MINIMIZEBOX | WS_POPUPWINDOW | WS_VISIBLE);
}
@@ -2100,7 +2106,7 @@ void OS_Windows::_update_window_style(bool repaint) {
SetWindowPos(hWnd, video_mode.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
- if (repaint) {
+ if (p_repaint) {
RECT rect;
GetWindowRect(hWnd, &rect);
MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE);
@@ -3247,6 +3253,7 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
control_mem = false;
meta_mem = false;
minimized = false;
+ was_maximized = false;
console_visible = IsWindowVisible(GetConsoleWindow());
hInstance = _hInstance;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 683896886b..b0e665e574 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -176,7 +176,7 @@ class OS_Windows : public OS {
void _drag_event(float p_x, float p_y, int idx);
void _touch_event(bool p_pressed, float p_x, float p_y, int idx);
- void _update_window_style(bool repaint = true);
+ void _update_window_style(bool p_repaint = true, bool p_maximized = false);
void _set_mouse_mode_impl(MouseMode p_mode);
@@ -209,6 +209,7 @@ protected:
bool minimized;
bool borderless;
bool console_visible;
+ bool was_maximized;
public:
LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);