8140525: AwtFrame::WmShowWindow() may steal focus
authorant
Wed, 23 Nov 2016 18:48:02 +0300
changeset 42721 64c57d4076e6
parent 42720 9690e3d8af61
child 42722 ab37f3c53f9c
8140525: AwtFrame::WmShowWindow() may steal focus Reviewed-by: serb, ssadetsky
jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp	Wed Nov 23 14:28:14 2016 +0530
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp	Wed Nov 23 18:48:02 2016 +0300
@@ -484,7 +484,10 @@
             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