提交 18b4b6bd 编写于 作者: D dmarkov

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

Reviewed-by: serb, aivanov
上级 51031646
...@@ -159,8 +159,6 @@ public class CEmbeddedFrame extends EmbeddedFrame { ...@@ -159,8 +159,6 @@ public class CEmbeddedFrame extends EmbeddedFrame {
: this; : this;
} }
} }
// ignore focus "lost" native request as it may mistakenly
// deactivate active window (see 8001161)
if (globalFocusedWindow == this) { if (globalFocusedWindow == this) {
responder.handleWindowFocusEvent(parentWindowActive, null); responder.handleWindowFocusEvent(parentWindowActive, null);
} }
...@@ -175,4 +173,18 @@ public class CEmbeddedFrame extends EmbeddedFrame { ...@@ -175,4 +173,18 @@ public class CEmbeddedFrame extends EmbeddedFrame {
// another window. // another window.
return globalFocusedWindow != null ? !globalFocusedWindow.isParentWindowActive() : true; return globalFocusedWindow != null ? !globalFocusedWindow.isParentWindowActive() : true;
} }
public void synthesizeWindowActivation(boolean doActivate) {
if (isParentWindowActive() != doActivate) {
handleWindowFocusEvent(doActivate);
}
}
public static void updateGlobalFocusedWindow(CEmbeddedFrame newGlobalFocusedWindow) {
synchronized (classLock) {
if (newGlobalFocusedWindow.isParentWindowActive()) {
globalFocusedWindow = newGlobalFocusedWindow;
}
}
}
} }
...@@ -146,6 +146,8 @@ public class CPlatformEmbeddedFrame implements PlatformWindow { ...@@ -146,6 +146,8 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
@Override @Override
public boolean requestWindowFocus() { public boolean requestWindowFocus() {
CEmbeddedFrame.updateGlobalFocusedWindow(target);
target.synthesizeWindowActivation(true);
return true; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册