--- old/src/windows/classes/sun/awt/windows/WWindowPeer.java 2012-09-04 14:51:58.780449300 +0400 +++ new/src/windows/classes/sun/awt/windows/WWindowPeer.java 2012-09-04 14:51:58.250048300 +0400 @@ -272,9 +272,9 @@ if (!focusAllowedFor()) { return false; } - return requestWindowFocus(cause == CausedFocusEvent.Cause.MOUSE_EVENT); + return requestWindowFocus(); } - public native boolean requestWindowFocus(boolean isMouseEventCause); + public native boolean requestWindowFocus(); public boolean focusAllowedFor() { Window window = (Window)this.target; --- old/src/windows/native/sun/windows/awt_Component.cpp 2012-09-04 14:52:00.418452100 +0400 +++ new/src/windows/native/sun/windows/awt_Component.cpp 2012-09-04 14:52:00.028451400 +0400 @@ -1549,7 +1549,7 @@ // on handling the Java mouse event. Anyway, we have to // activate the window here as it works both for AWT & Swing. // Do it in our own fassion, - window->AwtSetActiveWindow(TRUE, LOWORD(lParam)/*hittest*/); + window->AwtSetActiveWindow(LOWORD(lParam)/*hittest*/); } mr = mrConsume; retValue = MA_NOACTIVATE; @@ -1922,7 +1922,7 @@ mr = mrConsume; break; case WM_AWT_WINDOW_SETACTIVE: - retValue = (LRESULT)((AwtWindow*)this)->AwtSetActiveWindow((BOOL)wParam); + retValue = (LRESULT)((AwtWindow*)this)->AwtSetActiveWindow(); mr = mrConsume; break; --- old/src/windows/native/sun/windows/awt_Frame.cpp 2012-09-04 14:52:02.470478700 +0400 +++ new/src/windows/native/sun/windows/awt_Frame.cpp 2012-09-04 14:52:02.113458300 +0400 @@ -984,7 +984,7 @@ } } -BOOL AwtFrame::AwtSetActiveWindow(BOOL isMouseEventCause, UINT hittest) +BOOL AwtFrame::AwtSetActiveWindow(UINT hittest) { if (hittest == HTCLIENT) { // Don't let the actualFocusedWindow to steal focus if: @@ -992,7 +992,7 @@ // b) focus is requested to some of the frame's child. m_actualFocusedWindow = NULL; } - return AwtWindow::AwtSetActiveWindow(isMouseEventCause); + return AwtWindow::AwtSetActiveWindow(); } MsgRouting AwtFrame::WmEnterMenuLoop(BOOL isTrackPopupMenu) --- old/src/windows/native/sun/windows/awt_Frame.h 2012-09-04 14:52:04.074712500 +0400 +++ new/src/windows/native/sun/windows/awt_Frame.h 2012-09-04 14:52:03.731511900 +0400 @@ -145,7 +145,7 @@ virtual void Reshape(int x, int y, int width, int height); - virtual BOOL AwtSetActiveWindow(BOOL isMouseEventCause = FALSE, UINT hittest = HTCLIENT); + virtual BOOL AwtSetActiveWindow(UINT hittest = HTCLIENT); void CheckRetainActualFocusedWindow(HWND activatedOpositeHWnd); BOOL CheckActivateActualFocusedWindow(HWND deactivatedOpositeHWnd); --- old/src/windows/native/sun/windows/awt_Window.cpp 2012-09-04 14:52:05.509915000 +0400 +++ new/src/windows/native/sun/windows/awt_Window.cpp 2012-09-04 14:52:05.151114400 +0400 @@ -136,7 +136,6 @@ // Struct for _RequestWindowFocus() method struct RequestWindowFocusStruct { jobject component; - jboolean isMouseEventCause; }; // struct for _RepositionSecurityWarning() method struct RepositionSecurityWarningStruct { @@ -1557,24 +1556,8 @@ env->DeleteLocalRef(event); } -BOOL AwtWindow::AwtSetActiveWindow(BOOL isMouseEventCause, UINT hittest) +BOOL AwtWindow::AwtSetActiveWindow(UINT hittest) { - // Fix for 6458497. - // Retreat if current foreground window is out of both our and embedder process. - // The exception is when activation is requested due to a mouse event. - if (!isMouseEventCause) { - HWND fgWindow = ::GetForegroundWindow(); - if (NULL != fgWindow) { - DWORD fgProcessID; - ::GetWindowThreadProcessId(fgWindow, &fgProcessID); - if (fgProcessID != ::GetCurrentProcessId() - && !AwtToolkit::GetInstance().IsEmbedderProcessId(fgProcessID)) - { - return FALSE; - } - } - } - HWND proxyContainerHWnd = GetProxyToplevelContainer(); HWND proxyHWnd = GetProxyFocusOwner(); @@ -2113,7 +2096,6 @@ RequestWindowFocusStruct *rfs = (RequestWindowFocusStruct *)param; jobject self = rfs->component; - jboolean isMouseEventCause = rfs->isMouseEventCause; jboolean result = JNI_FALSE; AwtWindow *window = NULL; @@ -2128,7 +2110,7 @@ window = (AwtWindow *)pData; if (::IsWindow(window->GetHWnd())) { - result = (jboolean)window->SendMessage(WM_AWT_WINDOW_SETACTIVE, (WPARAM)isMouseEventCause, 0); + result = (jboolean)window->SendMessage(WM_AWT_WINDOW_SETACTIVE, 0); } ret: env->DeleteGlobalRef(self); @@ -3625,7 +3607,7 @@ * Signature: (Z)Z */ JNIEXPORT jboolean JNICALL Java_sun_awt_windows_WWindowPeer_requestWindowFocus - (JNIEnv *env, jobject self, jboolean isMouseEventCause) + (JNIEnv *env, jobject self) { TRY; @@ -3633,7 +3615,6 @@ RequestWindowFocusStruct *rfs = new RequestWindowFocusStruct; rfs->component = selfGlobalRef; - rfs->isMouseEventCause = isMouseEventCause; return (jboolean)AwtToolkit::GetInstance().SyncCall( (void*(*)(void*))AwtWindow::_RequestWindowFocus, rfs); --- old/src/windows/native/sun/windows/awt_Window.h 2012-09-04 14:52:07.284960300 +0400 +++ new/src/windows/native/sun/windows/awt_Window.h 2012-09-04 14:52:06.939940600 +0400 @@ -189,7 +189,7 @@ static jboolean _RequestWindowFocus(void *param); - virtual BOOL AwtSetActiveWindow(BOOL isMouseEventCause = FALSE, UINT hittest = HTCLIENT); + virtual BOOL AwtSetActiveWindow(UINT hittest = HTCLIENT); // Execute on Toolkit only. INLINE static LRESULT SynthesizeWmActivate(BOOL doActivate, HWND targetHWnd, HWND oppositeHWnd) {