JBR-1795 Project opened from Welcome screen goes to backgound after loading

(cherry picked from commit 322526458a)
This commit is contained in:
Anton Tarasov
2019-08-27 22:40:50 +03:00
committed by alexey.ushakov@jetbrains.com
parent a7b9b528ac
commit dc1ea13b55

View File

@@ -786,6 +786,24 @@ AwtFrame::Show()
} else {
::ShowWindow(hwnd, SW_SHOWMAXIMIZED);
}
// [tav] Workaround for unclear platform behaviour.
// When a custom decor frame is being shown maximized at the moment
// some another AWT window is still foreground - the frame can go
// in background when shown if:
// 1) the other AWT window is closed the moment after frame's show
// 2) some another maximized window is behind the frame, it steals activation
if (HasCustomDecoration()) {
HWND fgHWnd = ::GetForegroundWindow();
if (fgHWnd != NULL &&
GetComponent(fgHWnd) != NULL && // it's awt window
IsFocusableWindow() &&
IsAutoRequestFocus() &&
!::IsWindow(GetModalBlocker(GetHWnd())))
{
::SetForegroundWindow(GetHWnd());
}
}
}
else if (m_isInputMethodWindow) {
// Don't activate input methow window