Fix T40065: Pressing Esc in separate render result window does not focus main window.

The problem is that the render window keeps keybord input focus even after it has been
lowered. Windows maintains the Z-order of windows, so the present solution is to raise
the window that has been just below the render window.

Differential revision: https://developer.blender.org/D594
Reviewed by: campbellbarton
This commit is contained in:
Tamito Kajiyama 2014-07-01 15:01:02 +09:00
parent 9f05588b68
commit fef9463123
Notes: blender-bot 2023-02-14 10:41:23 +01:00
Referenced by issue #40065, Pressing Esc in separate render result window does not focus main window
1 changed files with 17 additions and 2 deletions

View File

@ -646,8 +646,23 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
GHOST_TSuccess GHOST_WindowWin32::setOrder(GHOST_TWindowOrder order)
{
HWND hWndInsertAfter = order == GHOST_kWindowOrderTop ? HWND_TOP : HWND_BOTTOM;
return ::SetWindowPos(m_hWnd, hWndInsertAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
HWND hWndInsertAfter, hWndToRaise;
if (order == GHOST_kWindowOrderBottom) {
hWndInsertAfter = HWND_BOTTOM;
hWndToRaise = ::GetWindow(m_hWnd, GW_HWNDNEXT); /* the window to raise */
}
else {
hWndInsertAfter = HWND_TOP;
hWndToRaise = NULL;
}
if (::SetWindowPos(m_hWnd, hWndInsertAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) == FALSE) {
return GHOST_kFailure;
}
if (hWndToRaise && ::SetWindowPos(hWndToRaise, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) == FALSE) {
return GHOST_kFailure;
}
return GHOST_kSuccess;
}