src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
Print this page
@@ -111,10 +111,11 @@
static final int CLOSEABLE = 1 << 7;
static final int MINIMIZABLE = 1 << 8;
static final int RESIZABLE = 1 << 9; // both a style bit and prop bit
+ static final int NONACTIVATING = 1 << 24;
static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE;
// corresponds to method-based properties
static final int HAS_SHADOW = 1 << 10;
@@ -126,13 +127,10 @@
static final int DOCUMENT_MODIFIED = 1 << 21;
static final int FULLSCREENABLE = 1 << 23;
static final int _METHOD_PROP_BITMASK = RESIZABLE | HAS_SHADOW | ZOOMABLE | ALWAYS_ON_TOP | HIDES_ON_DEACTIVATE | DRAGGABLE_BACKGROUND | DOCUMENT_MODIFIED | FULLSCREENABLE;
- // not sure
- static final int POPUP = 1 << 14;
-
// corresponds to callback-based properties
static final int SHOULD_BECOME_KEY = 1 << 12;
static final int SHOULD_BECOME_MAIN = 1 << 13;
static final int MODAL_EXCLUDED = 1 << 16;
@@ -263,21 +261,18 @@
protected int getInitialStyleBits() {
// defaults style bits
int styleBits = DECORATED | HAS_SHADOW | CLOSEABLE | MINIMIZABLE | ZOOMABLE | RESIZABLE;
- if (target.getName() == "###overrideRedirect###") {
- styleBits = SET(styleBits, POPUP, true);
- }
-
if (isNativelyFocusableWindow()) {
styleBits = SET(styleBits, SHOULD_BECOME_KEY, true);
styleBits = SET(styleBits, SHOULD_BECOME_MAIN, true);
}
final boolean isFrame = (target instanceof Frame);
final boolean isDialog = (target instanceof Dialog);
+ final boolean isPopup = (target.getType() == Window.Type.POPUP);
if (isDialog) {
styleBits = SET(styleBits, MINIMIZABLE, false);
}
// Either java.awt.Frame or java.awt.Dialog can be undecorated, however java.awt.Window always is undecorated.
@@ -303,12 +298,14 @@
if (target.getModalExclusionType() == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) {
styleBits = SET(styleBits, MODAL_EXCLUDED, true);
}
// If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look.
- if (!isDialog && IS(styleBits, POPUP)) {
+ if (isPopup) {
styleBits = SET(styleBits, TEXTURED, true);
+ // Popups in applets don't activate applet's process
+ styleBits = SET(styleBits, NONACTIVATING, true);
}
if (target instanceof javax.swing.RootPaneContainer) {
javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
Object prop = null;
@@ -497,16 +494,23 @@
LWWindowPeer blocker = peer.getBlocker();
if (blocker == null || !visible) {
// If it ain't blocked, or is being hidden, go regular way
if (visible) {
CWrapper.NSWindow.makeFirstResponder(nsWindowPtr, contentView.getAWTView());
- boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(nsWindowPtr);
- if (!isKeyWindow) {
- CWrapper.NSWindow.makeKeyAndOrderFront(nsWindowPtr);
+
+ boolean isPopup = (target.getType() == Window.Type.POPUP);
+ if (isPopup) {
+ // Popups in applets don't activate applet's process
+ CWrapper.NSWindow.orderFrontRegardless(nsWindowPtr);
} else {
CWrapper.NSWindow.orderFront(nsWindowPtr);
}
+
+ boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(nsWindowPtr);
+ if (!isKeyWindow) {
+ CWrapper.NSWindow.makeKeyWindow(nsWindowPtr);
+ }
} else {
CWrapper.NSWindow.orderOut(nsWindowPtr);
}
} else {
// otherwise, put it in a proper z-order
@@ -771,10 +775,15 @@
/*************************************************************
* Callbacks from the AWTWindow and AWTView objc classes.
*************************************************************/
private void deliverWindowFocusEvent(boolean gained){
+ // Fix for 7150349: ingore "gained" notifications when the app is inactive.
+ if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) {
+ focusLogger.fine("the app is inactive, so the notification is ignored");
+ return;
+ }
peer.notifyActivation(gained);
}
private void deliverMoveResizeEvent(int x, int y, int width, int height) {
// when the content view enters the full-screen mode, the native