Win32: Fix fullscreen errors using Taskbar system menu

Changing window state using taskbar system menu could result in a titleless window.

Differential Revision: https://developer.blender.org/D10812

Reviewed by Ray Molenkamp
This commit is contained in:
Harley Acheson 2021-04-12 07:52:14 -07:00
parent e96f0d2e2b
commit c037a02096
2 changed files with 15 additions and 4 deletions

View File

@ -1442,12 +1442,23 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
*/
break;
case WM_SYSCOMMAND:
/* The WM_SYSCHAR message is sent to the window when system commands such as
/* The WM_SYSCOMMAND message is sent to the window when system commands such as
* maximize, minimize or close the window are triggered. Also it is sent when ALT
* button is press for menu. To prevent this we must return preventing DefWindowProc.
*
* Note that the four low-order bits of the wParam parameter are used internally by the
* OS. To obtain the correct result when testing the value of wParam, an application
* must combine the value 0xFFF0 with the wParam value by using the bitwise AND operator.
*/
if (wParam == SC_KEYMENU) {
eventHandled = true;
switch (wParam & 0xFFF0) {
case SC_KEYMENU:
eventHandled = true;
break;
case SC_RESTORE:
::ShowWindow(hwnd, SW_RESTORE);
window->setState(window->getState());
eventHandled = true;
break;
}
break;
////////////////////////////////////////////////////////////////////////

View File

@ -521,7 +521,7 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
switch (state) {
case GHOST_kWindowStateMinimized:
wp.showCmd = SW_SHOWMINIMIZED;
wp.showCmd = SW_MINIMIZE;
break;
case GHOST_kWindowStateMaximized:
wp.showCmd = SW_SHOWMAXIMIZED;