From 9d87230fccfa54c409643c67c3cd2fbb2cfb15d0 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Wed, 23 Nov 2016 18:48:02 +0300 Subject: [PATCH] 8140525: AwtFrame::WmShowWindow() may steal focus Reviewed-by: serb, ssadetsky --- .../java.desktop/windows/native/libawt/windows/awt_Frame.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp index 6c8d65a47c7..9bc6366d17b 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp @@ -484,7 +484,10 @@ MsgRouting AwtFrame::WmShowWindow(BOOL show, UINT status) if (fgProcessID != ::GetCurrentProcessId()) { AwtWindow* window = (AwtWindow*)GetComponent(GetHWnd()); - if (window != NULL && window->IsFocusableWindow() && window->IsAutoRequestFocus() && + if (window != NULL && + window->IsFocusableWindow() && + window->IsAutoRequestFocus() && + !::IsWindowVisible(GetHWnd()) && // the window is really showing !::IsWindow(GetModalBlocker(GetHWnd()))) { // When the Java process is not allowed to set the foreground window