Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarley Acheson <harley.acheson@gmail.com>2021-04-12 17:52:14 +0300
committerHarley Acheson <harley.acheson@gmail.com>2021-04-12 17:52:14 +0300
commitc037a02096bdb1ee3ae5b1c894bf5585ae62f236 (patch)
tree739fa7e383997c368c8e32668c769a772cad09a0 /intern/ghost
parente96f0d2e2b5cba05a2455278898bbd6026852aaf (diff)
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
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp17
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp2
2 files changed, 15 insertions, 4 deletions
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;