8205479: OS X: requestFocus() does not work properly for embedded frame

Reviewed-by: serb, aivanov
This commit is contained in:
Dmitry Markov 2018-08-17 09:31:13 +01:00
parent 299f32d852
commit ca5903367f
2 changed files with 17 additions and 2 deletions

View File

@ -165,8 +165,6 @@ public class CEmbeddedFrame extends EmbeddedFrame {
: this;
}
}
// ignore focus "lost" native request as it may mistakenly
// deactivate active window (see 8001161)
if (globalFocusedWindow == this) {
responder.handleWindowFocusEvent(parentWindowActive, null);
}
@ -181,4 +179,19 @@ public class CEmbeddedFrame extends EmbeddedFrame {
// another window.
return globalFocusedWindow != null ? !globalFocusedWindow.isParentWindowActive() : true;
}
@Override
public void synthesizeWindowActivation(boolean doActivate) {
if (isParentWindowActive() != doActivate) {
handleWindowFocusEvent(doActivate);
}
}
public static void updateGlobalFocusedWindow(CEmbeddedFrame newGlobalFocusedWindow) {
synchronized (classLock) {
if (newGlobalFocusedWindow.isParentWindowActive()) {
globalFocusedWindow = newGlobalFocusedWindow;
}
}
}
}

View File

@ -147,6 +147,8 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
@Override
public boolean requestWindowFocus() {
CEmbeddedFrame.updateGlobalFocusedWindow(target);
target.synthesizeWindowActivation(true);
return true;
}