[Bf-blender-cvs] [c037a02096b] master: Win32: Fix fullscreen errors using Taskbar system menu
Harley Acheson
noreply at git.blender.org
Mon Apr 12 16:55:52 CEST 2021
Commit: c037a02096bdb1ee3ae5b1c894bf5585ae62f236
Author: Harley Acheson
Date: Mon Apr 12 07:52:14 2021 -0700
Branches: master
https://developer.blender.org/rBc037a02096bdb1ee3ae5b1c894bf5585ae62f236
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
===================================================================
M intern/ghost/intern/GHOST_SystemWin32.cpp
M intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 430e8216ae3..38dea9c1142 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -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;
////////////////////////////////////////////////////////////////////////
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 28ce1381562..ef155d96f99 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -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;
More information about the Bf-blender-cvs
mailing list