added system property flatlaf.useNativeLibrary to allow disabling loading of FlatLaf native library (issue #674)

This commit is contained in:
Karl Tauber
2023-06-21 00:13:35 +02:00
parent 4392c7627b
commit 267defb321
3 changed files with 25 additions and 1 deletions

View File

@@ -3,6 +3,11 @@ FlatLaf Change Log
## 3.2-SNAPSHOT
#### New features and improvements
- Added system property `flatlaf.useNativeLibrary` to allow disabling loading of
FlatLaf native library. (issue #674)
#### Fixed bugs
- Styling: Fixed scaling of some styling properties (`rowHeight` for Table and

View File

@@ -150,10 +150,24 @@ public interface FlatSystemProperties
* <p>
* <strong>Allowed Values</strong> {@code false} and {@code true}<br>
* <strong>Default</strong> {@code true}
*
* @since 2.5
*/
String UPDATE_UI_ON_SYSTEM_FONT_CHANGE = "flatlaf.updateUIOnSystemFontChange";
/**
* Specifies whether FlatLaf native library should be used.
* <p>
* Setting this to {@code false} disables loading native library,
* which also disables some features that depend on the native library.
* <p>
* <strong>Allowed Values</strong> {@code false} and {@code true}<br>
* <strong>Default</strong> {@code true}
*
* @since 3.2
*/
String USE_NATIVE_LIBRARY = "flatlaf.useNativeLibrary";
/**
* Specifies a directory in which the native FlatLaf libraries have been extracted.
* The path can be absolute or relative to current application working directory.

View File

@@ -33,6 +33,7 @@ import com.formdev.flatlaf.util.SystemInfo;
*/
class FlatNativeLibrary
{
private static boolean initialized;
private static NativeLibrary nativeLibrary;
/**
@@ -45,7 +46,11 @@ class FlatNativeLibrary
}
private static void initialize() {
if( nativeLibrary != null )
if( initialized )
return;
initialized = true;
if( !FlatSystemProperties.getBoolean( FlatSystemProperties.USE_NATIVE_LIBRARY, true ) )
return;
String classifier;