Merge pull request #267 from native-window-decorations

Native window decorations for Windows 10 (using JNI)
This commit is contained in:
Karl Tauber
2021-03-12 23:15:19 +01:00
36 changed files with 1669 additions and 89 deletions

View File

@@ -0,0 +1,10 @@
FlatLaf Natives using JNA
=========================
This sub-project contains source code that uses
[JNA](https://github.com/java-native-access/jna) to access native operating
system API.
**Note:** Code in this sub-project is **not used** in FlatLaf libraries. It was
used to develop/test usage of some native operating system API in Java (with the
help of JNA) and was then converted to C++.

View File

@@ -207,20 +207,20 @@ public class FlatWindowsNativeWindowBorder
String subKey = "SOFTWARE\\Microsoft\\Windows\\DWM";
int value = RegGetDword( HKEY_CURRENT_USER, subKey, "ColorPrevalence" );
int value = registryGetIntValue( subKey, "ColorPrevalence", -1 );
colorizationColorAffectsBorders = (value > 0);
value = RegGetDword( HKEY_CURRENT_USER, subKey, "ColorizationColor" );
value = registryGetIntValue( subKey, "ColorizationColor", -1 );
colorizationColor = (value != -1) ? new Color( value ) : null;
colorizationColorBalance = RegGetDword( HKEY_CURRENT_USER, subKey, "ColorizationColorBalance" );
colorizationColorBalance = registryGetIntValue( subKey, "ColorizationColorBalance", -1 );
}
private static int RegGetDword( HKEY hkey, String lpSubKey, String lpValue ) {
private static int registryGetIntValue( String key, String valueName, int defaultValue ) {
try {
return Advapi32Util.registryGetIntValue( hkey, lpSubKey, lpValue );
return Advapi32Util.registryGetIntValue( HKEY_CURRENT_USER, key, valueName );
} catch( RuntimeException ex ) {
return -1;
return defaultValue;
}
}