diff options
author | Denis Fokin <Denis.Fokin@jetbrains.com> | 2017-05-25 20:14:37 +0300 |
---|---|---|
committer | Denis Fokin <Denis.Fokin@jetbrains.com> | 2017-05-25 20:15:20 +0300 |
commit | a36ba7631726196e8021d58b2c32da12c855931f (patch) | |
tree | 0061608ef36afa284b587b5d448c8f51f38ef6ea /src/macosx | |
parent | 72c77a992bbf1b95b82ffc08cb2f4f3bc36b3657 (diff) | |
download | jdk8u_jdk-a36ba7631726196e8021d58b2c32da12c855931f.tar.gz |
JRE-377 Allow dark decorations on Mac OS X
Diffstat (limited to 'src/macosx')
-rw-r--r-- | src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java | 10 | ||||
-rw-r--r-- | src/macosx/native/sun/awt/AWTWindow.m | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index afa8c20241..9bd761cb92 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -78,6 +78,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo // for client properties public static final String WINDOW_BRUSH_METAL_LOOK = "apple.awt.brushMetalLook"; + public static final String WINDOW_DARK_APPEARANCE = "jetbrains.awt.windowDarkAppearance"; public static final String WINDOW_DRAGGABLE_BACKGROUND = "apple.awt.draggableWindowBackground"; public static final String WINDOW_ALPHA = "Window.alpha"; @@ -122,6 +123,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo static final int MINIMIZABLE = 1 << 8; static final int RESIZABLE = 1 << 9; // both a style bit and prop bit + static final int DARK = 1 << 28; static final int NONACTIVATING = 1 << 24; static final int IS_DIALOG = 1 << 25; static final int IS_MODAL = 1 << 26; @@ -165,6 +167,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo new Property<CPlatformWindow>(WINDOW_BRUSH_METAL_LOOK) { public void applyProperty(final CPlatformWindow c, final Object value) { c.setStyleBits(TEXTURED, Boolean.parseBoolean(value.toString())); }}, + new Property<CPlatformWindow>(WINDOW_DARK_APPEARANCE) { public void applyProperty(final CPlatformWindow c, final Object value) { + c.setStyleBits(DARK, value == null ? true : Boolean.parseBoolean(value.toString())); + }}, new Property<CPlatformWindow>(WINDOW_ALPHA) { public void applyProperty(final CPlatformWindow c, final Object value) { AWTUtilities.setWindowOpacity(c.target, value == null ? 1.0f : Float.parseFloat(value.toString())); }}, @@ -382,6 +387,11 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo styleBits = SET(styleBits, MINIMIZABLE, Boolean.parseBoolean(prop.toString())); } + prop = rootpane.getClientProperty(WINDOW_DARK_APPEARANCE); + if (prop != null) { + styleBits = SET(styleBits, DARK, Boolean.parseBoolean(prop.toString())); + } + prop = rootpane.getClientProperty(WINDOW_ZOOMABLE); if (prop != null) { styleBits = SET(styleBits, ZOOMABLE, Boolean.parseBoolean(prop.toString())); diff --git a/src/macosx/native/sun/awt/AWTWindow.m b/src/macosx/native/sun/awt/AWTWindow.m index d77bbb9fd4..f778eb5fa2 100644 --- a/src/macosx/native/sun/awt/AWTWindow.m +++ b/src/macosx/native/sun/awt/AWTWindow.m @@ -275,6 +275,12 @@ AWT_NS_WINDOW_IMPLEMENTATION } } + if (IS(self.styleBits, DARK)) { + [self.nsWindow setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]]; + } else { + [self.nsWindow setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantLight]]; + } + } - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)platformWindow |