changeset 16306:b64f4ea8dc42

8140525: AwtFrame::WmShowWindow() may steal focus Reviewed-by: serb, ssadetsky
author ant
date Wed, 23 Nov 2016 18:48:02 +0300
parents 48d8673787b8
children c67a08956b11
files src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp	Wed Nov 23 14:28:14 2016 +0530
+++ b/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