Browse Source

Merge pull request #75 from vlsi/skip_decorations

Skip native library loading when darklaf.decorations=false
pull/77/head
Jannis Weis 5 years ago committed by GitHub
parent
commit
a14812f67d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      core/src/main/java/com/github/weisj/darklaf/platform/Decorations.java
  2. 2
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/JNIDecorationsMacOS.java
  3. 2
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/JNIDecorationsWindows.java

9
core/src/main/java/com/github/weisj/darklaf/platform/Decorations.java

@ -42,14 +42,16 @@ public final class Decorations {
static { static {
try { try {
//Extend for different platforms. //Extend for different platforms.
if (SystemInfo.isWindows) { boolean enableDecorations =
!PropertyValue.FALSE.equals(System.getProperty(DarkLaf.SYSTEM_PROPERTY_PREFIX + "decorations"));
if (SystemInfo.isWindows && enableDecorations) {
decorationsProvider = new WindowsDecorationsProvider(); decorationsProvider = new WindowsDecorationsProvider();
} else if (SystemInfo.isMac) { } else if (SystemInfo.isMac && enableDecorations) {
decorationsProvider = new MacOSDecorationsProvider(); decorationsProvider = new MacOSDecorationsProvider();
} else { } else {
decorationsProvider = new DefaultDecorationsProvider(); decorationsProvider = new DefaultDecorationsProvider();
} }
} catch (Exception e) { } catch (Throwable e) {
//If decorations modules are not available disable them. //If decorations modules are not available disable them.
decorationsProvider = new DefaultDecorationsProvider(); decorationsProvider = new DefaultDecorationsProvider();
} }
@ -62,7 +64,6 @@ public final class Decorations {
public static boolean isCustomDecorationSupported() { public static boolean isCustomDecorationSupported() {
return decorationsProvider.isCustomDecorationSupported() return decorationsProvider.isCustomDecorationSupported()
&& !PropertyValue.FALSE.equals(System.getProperty(DarkLaf.SYSTEM_PROPERTY_PREFIX + "decorations"))
&& LafManager.isDecorationsEnabled() && LafManager.isDecorationsEnabled()
&& LafManager.getTheme().useCustomDecorations(); && LafManager.getTheme().useCustomDecorations();
} }

2
macos/src/main/java/com/github/weisj/darklaf/platform/macos/JNIDecorationsMacOS.java

@ -81,7 +81,7 @@ public class JNIDecorationsMacOS {
+ SystemInfo.jreArchitecture + SystemInfo.jreArchitecture
+ "' not supported. Decorations will be disabled"); + "' not supported. Decorations will be disabled");
} }
} catch (Exception e) { } catch (Throwable e) {
//Library not found, SecurityManager prevents library loading etc. //Library not found, SecurityManager prevents library loading etc.
LOGGER.log(Level.SEVERE, "Could not load decorations library libdarklaf-macos.dylib." + LOGGER.log(Level.SEVERE, "Could not load decorations library libdarklaf-macos.dylib." +
" Decorations will be disabled", e); " Decorations will be disabled", e);

2
windows/src/main/java/com/github/weisj/darklaf/platform/windows/JNIDecorationsWindows.java

@ -81,7 +81,7 @@ public class JNIDecorationsWindows {
} }
loaded = true; loaded = true;
LOGGER.info("Loaded darklaf-windows.dll. Decorations are enabled."); LOGGER.info("Loaded darklaf-windows.dll. Decorations are enabled.");
} catch (Exception e) { } catch (Throwable e) {
//Library not found, SecurityManager prevents library loading etc. //Library not found, SecurityManager prevents library loading etc.
LOGGER.log(Level.SEVERE, "Could not load decorations library darklaf-windows.dll." + LOGGER.log(Level.SEVERE, "Could not load decorations library darklaf-windows.dll." +
" Decorations will be disabled", e); " Decorations will be disabled", e);

Loading…
Cancel
Save