Mercurial > hg > icedtea7-forest-aarch64 > jdk
changeset 8215:5e38c7e9b978
8038919: Requesting focus to a modeless dialog doesn't work on Safari
Reviewed-by: ant, serb
author | mcherkas |
---|---|
date | Fri, 10 Oct 2014 20:14:42 +0400 |
parents | 58e1e9eb97f0 |
children | d0f1aec5c8b4 84c3e31f3c4a |
files | src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java src/macosx/native/sun/awt/LWCToolkit.m |
diffstat | 3 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Fri Oct 10 15:16:32 2014 +0400 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Fri Oct 10 20:14:42 2014 +0400 @@ -674,6 +674,13 @@ @Override // PlatformWindow public void toFront() { 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); nativePushNSWindowToFront(nsWindowPtr); updateFocusabilityForAutoRequestFocus(true);
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Fri Oct 10 15:16:32 2014 +0400 +++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Fri Oct 10 20:14:42 2014 +0400 @@ -700,6 +700,11 @@ */ public native boolean isApplicationActive(); + /* + * Activates application ignoring other apps. + */ + public native void activateApplicationIgnoringOtherApps(); + /************************ * Native methods section ************************/
--- a/src/macosx/native/sun/awt/LWCToolkit.m Fri Oct 10 15:16:32 2014 +0400 +++ b/src/macosx/native/sun/awt/LWCToolkit.m Fri Oct 10 20:14:42 2014 +0400 @@ -392,6 +392,23 @@ 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