aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Fokin <Denis.Fokin@jetbrains.com>2017-05-29 15:47:19 +0300
committerDenis Fokin <Denis.Fokin@jetbrains.com>2017-05-29 15:47:19 +0300
commit83e6b1c2e67a192558f8882f663718d4bea0c8b0 (patch)
tree3701cddfc0ee9696f3030e7d3caba4aaeaaaf5a3
parente0b77ed1cc5054f3c623a2c953c741df4e6e6b10 (diff)
downloadjdk8u_jdk-83e6b1c2e67a192558f8882f663718d4bea0c8b0.tar.gz
JRE-377 Allow dark decorations on Mac OS X (Compilation is fixed)jb8u152-b886
-rw-r--r--src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java11
-rw-r--r--src/macosx/native/sun/awt/AWTWindow.m32
2 files changed, 38 insertions, 5 deletions
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
index 9e15191b69..2f10821c31 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
@@ -79,6 +79,8 @@ 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_LIGHT_APPEARANCE = "jetbrains.awt.windowLightAppearance";
+ public static final String WINDOW_AQUA_APPEARANCE = "jetbrains.awt.windowAquaAppearance";
public static final String WINDOW_DRAGGABLE_BACKGROUND = "apple.awt.draggableWindowBackground";
public static final String WINDOW_ALPHA = "Window.alpha";
@@ -124,6 +126,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
static final int RESIZABLE = 1 << 9; // both a style bit and prop bit
static final int DARK = 1 << 28;
+ static final int LIGHT = 1 << 29;
static final int NONACTIVATING = 1 << 24;
static final int IS_DIALOG = 1 << 25;
static final int IS_MODAL = 1 << 26;
@@ -170,6 +173,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
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_LIGHT_APPEARANCE) { public void applyProperty(final CPlatformWindow c, final Object value) {
+ c.setStyleBits(LIGHT, 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()));
}},
@@ -392,6 +398,11 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
styleBits = SET(styleBits, DARK, Boolean.parseBoolean(prop.toString()));
}
+ prop = rootpane.getClientProperty(WINDOW_LIGHT_APPEARANCE);
+ if (prop != null) {
+ styleBits = SET(styleBits, LIGHT, 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 3f870b1ec0..cabd4261ad 100644
--- a/src/macosx/native/sun/awt/AWTWindow.m
+++ b/src/macosx/native/sun/awt/AWTWindow.m
@@ -275,12 +275,19 @@ AWT_NS_WINDOW_IMPLEMENTATION
}
}
- /*if (IS(self.styleBits, DARK)) {
- [self.nsWindow setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
- } else {
- [self.nsWindow setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantLight]];
+/* Class* nsAppearanceClass = NSClassFromString(@"NSAppearance");
+
+ if (nsAppearanceClass != nil) {
+ if (IS(self.styleBits, DARK)) {
+ id darkAppearanceObject = [nsAppearanceClass appearanceNamed:@"NSAppearanceNameVibrantDark"];
+ [self.nsWindow setAppearance:darkAppearanceObject];
+ } else if (IS(self.styleBits, LIGHT)) {
+ id lightAppearanceObject = [nsAppearanceClass appearanceNamed:@"NSAppearanceNameVibrantLight"];
+ [self.nsWindow setAppearance:lightAppearanceObject];
+ } else {
+ [self.nsWindow setAppearance:nil];
+ }
}*/
-
}
- (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)platformWindow
@@ -1031,6 +1038,21 @@ JNF_COCOA_ENTER(env);
}
window.styleBits = newBits;
+
+ Class* nsAppearanceClass = NSClassFromString(@"NSAppearance");
+
+ if (nsAppearanceClass != nil) {
+ if (IS(window.styleBits, DARK)) {
+ id darkAppearanceObject = [nsAppearanceClass appearanceNamed:@"NSAppearanceNameVibrantDark"];
+ [nsWindow setAppearance:darkAppearanceObject];
+ } else if (IS(window.styleBits, LIGHT)) {
+ id lightAppearanceObject = [nsAppearanceClass appearanceNamed:@"NSAppearanceNameVibrantLight"];
+ [nsWindow setAppearance:lightAppearanceObject];
+ } else {
+ [nsWindow setAppearance:nil];
+ }
+ }
+
}];
JNF_COCOA_EXIT(env);