@ -45,7 +45,7 @@ public final class MacOSDecorationsUtil {
Window window = SwingUtilities . getWindowAncestor ( rootPane ) ;
Window window = SwingUtilities . getWindowAncestor ( rootPane ) ;
long windowHandle = JNIDecorationsMacOS . getComponentPointer ( window ) ;
long windowHandle = JNIDecorationsMacOS . getComponentPointer ( window ) ;
if ( windowHandle = = 0 ) {
if ( windowHandle = = 0 ) {
return new DecorationInformation ( 0 , false , false , false , false , rootPane , false , 0 , 0 ) ;
return new DecorationInformation ( 0 , false , false , false , rootPane , false , 0 , 0 ) ;
}
}
LOGGER . fine (
LOGGER . fine (
"Installing decorations for window " + windowHandle + "(coloredTitleBar = " + useColoredTitleBar + ")" ) ;
"Installing decorations for window " + windowHandle + "(coloredTitleBar = " + useColoredTitleBar + ")" ) ;
@ -55,9 +55,7 @@ public final class MacOSDecorationsUtil {
float titleFontSize = ( float ) JNIDecorationsMacOS . getTitleFontSize ( windowHandle ) ;
float titleFontSize = ( float ) JNIDecorationsMacOS . getTitleFontSize ( windowHandle ) ;
int titleBarHeight = ( int ) JNIDecorationsMacOS . getTitleBarHeight ( windowHandle ) ;
int titleBarHeight = ( int ) JNIDecorationsMacOS . getTitleBarHeight ( windowHandle ) ;
boolean jniInstall = ! SystemInfo . isJavaVersionAtLeast ( "12" ) ;
setFullSizeContent ( windowHandle , useColoredTitleBar ) ;
setFullSizeContent ( rootPane , windowHandle , jniInstall , useColoredTitleBar ) ;
boolean titleVisible = SystemInfo . isMacOSMojave ;
boolean titleVisible = SystemInfo . isMacOSMojave ;
JNIDecorationsMacOS . setTitleEnabled ( windowHandle , titleVisible ) ;
JNIDecorationsMacOS . setTitleEnabled ( windowHandle , titleVisible ) ;
@ -68,19 +66,12 @@ public final class MacOSDecorationsUtil {
return new DecorationInformation (
return new DecorationInformation (
windowHandle , fullWindowContent ,
windowHandle , fullWindowContent ,
transparentTitleBar , useColoredTitleBar ,
transparentTitleBar , useColoredTitleBar ,
jniInstall , rootPane ,
rootPane , titleVisible , titleBarHeight , titleFontSize ) ;
titleVisible , titleBarHeight , titleFontSize ) ;
}
}
private static void setFullSizeContent ( final JRootPane rootPane , final long windowHandle ,
private static void setFullSizeContent ( final long windowHandle , final boolean enabled ) {
final boolean jniInstall , final boolean enabled ) {
if ( enabled ) {
if ( ! jniInstall ) {
JNIDecorationsMacOS . installDecorations ( windowHandle ) ;
setTransparentTitleBarEnabled ( rootPane , enabled ) ;
setFullWindowContentEnabled ( rootPane , enabled ) ;
} else {
if ( enabled ) {
JNIDecorationsMacOS . installDecorations ( windowHandle ) ;
}
}
}
}
}
@ -89,12 +80,9 @@ public final class MacOSDecorationsUtil {
return ;
return ;
}
}
if ( information . useColoredTitleBar ) {
if ( information . useColoredTitleBar ) {
if ( information . jniInstalled ) {
JNIDecorationsMacOS . uninstallDecorations ( information . windowHandle ,
JNIDecorationsMacOS . uninstallDecorations ( information . windowHandle ) ;
information . fullWindowContentEnabled ,
} else {
information . transparentTitleBarEnabled ) ;
setFullWindowContentEnabled ( information . rootPane , information . fullWindowContentEnabled ) ;
setTransparentTitleBarEnabled ( information . rootPane , information . transparentTitleBarEnabled ) ;
}
}
}
JNIDecorationsMacOS . setTitleEnabled ( information . windowHandle , true ) ;
JNIDecorationsMacOS . setTitleEnabled ( information . windowHandle , true ) ;
JNIDecorationsMacOS . releaseWindow ( information . windowHandle ) ;
JNIDecorationsMacOS . releaseWindow ( information . windowHandle ) ;
@ -107,12 +95,4 @@ public final class MacOSDecorationsUtil {
private static boolean isTransparentTitleBarEnabled ( final JRootPane rootPane ) {
private static boolean isTransparentTitleBarEnabled ( final JRootPane rootPane ) {
return PropertyUtil . getBooleanProperty ( rootPane , TRANSPARENT_TITLE_BAR_KEY ) ;
return PropertyUtil . getBooleanProperty ( rootPane , TRANSPARENT_TITLE_BAR_KEY ) ;
}
}
private static void setFullWindowContentEnabled ( final JRootPane rootPane , final boolean enabled ) {
rootPane . putClientProperty ( FULL_WINDOW_CONTENT_KEY , enabled ) ;
}
private static void setTransparentTitleBarEnabled ( final JRootPane rootPane , final boolean enabled ) {
rootPane . putClientProperty ( TRANSPARENT_TITLE_BAR_KEY , enabled ) ;
}
}
}