diff --git a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java index fa711c9a9d288a379a39340cace862fb21908ab3..2415ff7d8d83c2127871e02fc1708b5123e8edac 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java +++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java @@ -112,28 +112,19 @@ public class CEmbeddedFrame extends EmbeddedFrame { public void handleFocusEvent(boolean focused) { this.focused = focused; - updateOverlayWindowActiveState(); + if (parentWindowActive) { + responder.handleWindowFocusEvent(focused); + } } public void handleWindowFocusEvent(boolean parentWindowActive) { this.parentWindowActive = parentWindowActive; - updateOverlayWindowActiveState(); + if (focused) { + responder.handleWindowFocusEvent(parentWindowActive); + } } public boolean isParentWindowActive() { return parentWindowActive; } - - /* - * May change appearance of contents of window, and generate a - * WINDOW_ACTIVATED event. - */ - private void updateOverlayWindowActiveState() { - final boolean showAsFocused = parentWindowActive && focused; - dispatchEvent( - new FocusEvent(this, showAsFocused ? - FocusEvent.FOCUS_GAINED : - FocusEvent.FOCUS_LOST)); - } - } diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java index 739e56790082c5f0e10551ff8a7429871d802969..aa5c616b4287cbec55c5e91a09a00fcd1c7cd3aa 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java @@ -204,4 +204,8 @@ final class CPlatformResponder { } } } + + void handleWindowFocusEvent(boolean gained) { + peer.notifyActivation(gained); + } } diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java index 77a81e0d78fdb699a8cc32933845010cc3ea0c87..5c072a698005ec42196291ef21dd24fb7a075d82 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java @@ -49,9 +49,9 @@ public class CPlatformView extends CFRetainedResource { super(0, true); } - public void initialize(LWWindowPeer peer) { + public void initialize(LWWindowPeer peer, CPlatformResponder responder) { this.peer = peer; - this.responder = new CPlatformResponder(peer, false); + this.responder = responder; if (!LWCToolkit.getSunAwtDisableCALayers()) { this.windowLayer = new CGLLayer(peer); diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index efad23e636e8bf976e31a161a6c02fd0f94ff95a..2d7cfea3941658f017e83ec47cf3c478fb0c8e47 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -208,6 +208,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo private boolean visible = false; // visibility status from native perspective private boolean undecorated; // initialized in getInitialStyleBits() private Rectangle normalBounds = null; // not-null only for undecorated maximized windows + private CPlatformResponder responder; public CPlatformWindow(final PeerType peerType) { super(0, true); @@ -232,8 +233,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo final long parentNSWindowPtr = (owner != null ? owner.getNSWindowPtr() : 0); String warningString = target.getWarningString(); + responder = new CPlatformResponder(peer, false); contentView = new CPlatformView(); - contentView.initialize(peer); + contentView.initialize(peer, responder); final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0); setPtr(nativeWindowPtr); @@ -865,7 +867,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo focusLogger.fine("the app is inactive, so the notification is ignored"); return; } - peer.notifyActivation(gained); + responder.handleWindowFocusEvent(gained); } private void deliverMoveResizeEvent(int x, int y, int width, int height) {