src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
Print this page
*** 36,45 ****
--- 36,47 ----
import java.awt.event.*;
public class CEmbeddedFrame extends EmbeddedFrame {
private CPlatformResponder responder;
+ private boolean focused = true;
+ private boolean parentWindowActive = true;
public CEmbeddedFrame() {
show();
}
*** 92,97 ****
--- 94,126 ----
}
public void handleInputEvent(String text) {
new RuntimeException("Not implemented");
}
+
+ public void handleFocusEvent(boolean focused) {
+ this.focused = focused;
+ updateOverlayWindowActiveState();
+ }
+
+ public void handleWindowFocusEvent(boolean parentWindowActive) {
+ this.parentWindowActive = parentWindowActive;
+ updateOverlayWindowActiveState();
+ }
+
+ 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));
+ }
+
}