# HG changeset patch # User dcherepanov # Date 1337355564 -14400 # Node ID 91828a78446fba8da4b65c3e359aa0ece93b713b # Parent 58d40d4a87b36b0b4d663c8ee2fd19d0481261b7 7156191: [macosx] Can't type into applet demos in Pivot Reviewed-by: art diff -r 58d40d4a87b3 -r 91828a78446f jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Thu May 17 22:21:27 2012 +0400 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Fri May 18 19:39:24 2012 +0400 @@ -112,28 +112,19 @@ 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 -r 58d40d4a87b3 -r 91828a78446f jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java Thu May 17 22:21:27 2012 +0400 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java Fri May 18 19:39:24 2012 +0400 @@ -204,4 +204,8 @@ } } } + + void handleWindowFocusEvent(boolean gained) { + peer.notifyActivation(gained); + } } diff -r 58d40d4a87b3 -r 91828a78446f jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Thu May 17 22:21:27 2012 +0400 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java Fri May 18 19:39:24 2012 +0400 @@ -49,9 +49,9 @@ 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 -r 58d40d4a87b3 -r 91828a78446f jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Thu May 17 22:21:27 2012 +0400 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Fri May 18 19:39:24 2012 +0400 @@ -208,6 +208,7 @@ 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 @@ 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 @@ 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) {