提交 cdb7be5f 编写于 作者: M mcherkas

8038919: Requesting focus to a modeless dialog doesn't work on Safari

Reviewed-by: ant, serb
上级 7d0d901f
...@@ -674,6 +674,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo ...@@ -674,6 +674,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override // PlatformWindow @Override // PlatformWindow
public void toFront() { public void toFront() {
final long nsWindowPtr = getNSWindowPtr(); final long nsWindowPtr = getNSWindowPtr();
LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
if( w != null
&& ((LWWindowPeer)w.getPeer()).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
&& !lwcToolkit.isApplicationActive()) {
lwcToolkit.activateApplicationIgnoringOtherApps();
}
updateFocusabilityForAutoRequestFocus(false); updateFocusabilityForAutoRequestFocus(false);
nativePushNSWindowToFront(nsWindowPtr); nativePushNSWindowToFront(nsWindowPtr);
updateFocusabilityForAutoRequestFocus(true); updateFocusabilityForAutoRequestFocus(true);
......
...@@ -801,6 +801,11 @@ public final class LWCToolkit extends LWToolkit { ...@@ -801,6 +801,11 @@ public final class LWCToolkit extends LWToolkit {
*/ */
public static native boolean isEmbedded(); public static native boolean isEmbedded();
/*
* Activates application ignoring other apps.
*/
public native void activateApplicationIgnoringOtherApps();
/************************ /************************
* Native methods section * Native methods section
************************/ ************************/
......
...@@ -413,6 +413,23 @@ JNF_COCOA_EXIT(env); ...@@ -413,6 +413,23 @@ JNF_COCOA_EXIT(env);
return active; return active;
} }
/*
* Class: sun_lwawt_macosx_LWCToolkit
* Method: activateApplicationIgnoringOtherApps
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_activateApplicationIgnoringOtherApps
(JNIEnv *env, jclass clazz)
{
JNF_COCOA_ENTER(env);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
if(![NSApp isActive]){
[NSApp activateIgnoringOtherApps:YES];
}
}];
JNF_COCOA_EXIT(env);
}
/* /*
* Class: sun_awt_SunToolkit * Class: sun_awt_SunToolkit
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册