diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2020-01-27 21:41:39 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2020-01-27 21:41:39 +0300 |
commit | 22ca8b8aee9955292b838ac92d08566bcaee3e25 (patch) | |
tree | 9d2e25cd24e288110d71d3cf176e9970aa3da8f8 /intern/ghost | |
parent | f357740a80f9a8e568147f6102b09a9ec25e4226 (diff) |
UI: Win32 - Restore Minimized App On WM_Close
Changes needed for Windows 10 to restore and show close dialog from minimized state.
https://developer.blender.org/D5107
Reviewed by Brecht Van Lommel
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 12 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 3 |
2 files changed, 14 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 31a6ea96bc3..4a4016cbca1 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -443,6 +443,13 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent) ::DispatchMessageW(&msg); hasEventHandled = true; } + + /* PeekMessage above is allowed to dispatch messages to the wndproc without us + * noticing, so we need to check the event manager here to see if there are + * events waiting in the queue. + */ + hasEventHandled |= this->m_eventManager->getNumEvents() > 0; + } while (waitForEvent && !hasEventHandled); return hasEventHandled; @@ -1453,7 +1460,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, //////////////////////////////////////////////////////////////////////// case WM_CLOSE: /* The WM_CLOSE message is sent as a signal that a window - * or an application should terminate. */ + * or an application should terminate. Restore if minimized. */ + if (IsIconic(hwnd)) { + ShowWindow(hwnd, SW_RESTORE); + } event = processWindowEvent(GHOST_kEventWindowClose, window); break; case WM_ACTIVATE: diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index e91dba5cef8..2ab0e837efb 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -644,6 +644,9 @@ GHOST_TSuccess GHOST_WindowWin32::setOrder(GHOST_TWindowOrder order) hWndToRaise = ::GetWindow(m_hWnd, GW_HWNDNEXT); /* the window to raise */ } else { + if (getState() == GHOST_kWindowStateMinimized) { + setState(GHOST_kWindowStateNormal); + } hWndInsertAfter = HWND_TOP; hWndToRaise = NULL; } |