Skip to content

Commit 92d9488

Browse files
committed
Fix the client area changing size on Windows when restoring a window.
This was caused by WM_SYSCOMMAND handler not properly setting the extended style. Now, it respects it correctly. It's not obvious why we need to do this in the first place, but the comment around the code suggests that it's related to display constraints. Fixes #1433
1 parent cf13c96 commit 92d9488

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/win/wwindow.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,8 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message,
739739
break;
740740
}
741741
case WM_SYSCOMMAND: {
742+
DWORD style;
743+
DWORD exstyle;
742744
if (_al_win_disable_screensaver &&
743745
((wParam & 0xfff0) == SC_MONITORPOWER || (wParam & 0xfff0) == SC_SCREENSAVE)) {
744746
return 0;
@@ -751,11 +753,13 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message,
751753
/* This is used by WM_GETMINMAXINFO to set constraints. */
752754
else if ((wParam & 0xfff0) == SC_MAXIMIZE) {
753755
d->flags |= ALLEGRO_MAXIMIZED;
754-
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
756+
display_flags_to_window_styles(d->flags, &style, &exstyle);
757+
SetWindowLong(hWnd, GWL_EXSTYLE, exstyle);
755758
}
756759
else if ((wParam & 0xfff0) == SC_RESTORE) {
757760
d->flags &= ~ALLEGRO_MAXIMIZED;
758-
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_OVERLAPPEDWINDOW);
761+
display_flags_to_window_styles(d->flags, &style, &exstyle);
762+
SetWindowLong(hWnd, GWL_EXSTYLE, exstyle);
759763
}
760764
break;
761765
}

0 commit comments

Comments
 (0)