Browse Source

Rename isWindows10 to isWindows10OrGreater

This value does report true for Windows 11 and should indicate this in its name.
spotless
Jannis Weis 3 years ago
parent
commit
02a15f1351
No known key found for this signature in database
GPG Key ID: 7C9D8D4B558049AB
  1. 2
      core/src/main/java/com/github/weisj/darklaf/platform/ThemePreferencesHandler.java
  2. 2
      core/src/main/java/com/github/weisj/darklaf/task/PlatformDefaultsInitTask.java
  3. 10
      utils/src/main/java/com/github/weisj/darklaf/util/SystemInfo.java
  4. 2
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java
  5. 2
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsLibrary.java
  6. 5
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

2
core/src/main/java/com/github/weisj/darklaf/platform/ThemePreferencesHandler.java

@ -56,7 +56,7 @@ public class ThemePreferencesHandler {
try {
// Extend for different platforms.
boolean enableNativePreferences = isNativePreferencesEnabled();
if (SystemInfo.isWindows10 && enableNativePreferences) {
if (SystemInfo.isWindows10OrGreater && enableNativePreferences) {
preferenceProvider = new WindowsThemePreferenceProvider();
} else if (SystemInfo.isMac && enableNativePreferences) {
preferenceProvider = new MacOSThemePreferenceProvider();

2
core/src/main/java/com/github/weisj/darklaf/task/PlatformDefaultsInitTask.java

@ -32,7 +32,7 @@ public class PlatformDefaultsInitTask implements DefaultsInitTask {
@Override
public void run(final Theme currentTheme, final UIDefaults defaults) {
String key = DarkPopupMenuUI.KEY_DEFAULT_LIGHTWEIGHT_POPUPS;
if (SystemInfo.isWindows10 && DecorationsHandler.getSharedInstance().isCustomDecorationSupported()) {
if (SystemInfo.isWindows10OrGreater && DecorationsHandler.getSharedInstance().isCustomDecorationSupported()) {
JPopupMenu.setDefaultLightWeightPopupEnabled(Boolean.TRUE.equals(defaults.get(key + ".windows10")));
} else {
JPopupMenu.setDefaultLightWeightPopupEnabled(Boolean.TRUE.equals(defaults.get(key)));

10
utils/src/main/java/com/github/weisj/darklaf/util/SystemInfo.java

@ -69,7 +69,7 @@ public final class SystemInfo {
public static final boolean isMacOSMojave;
public static final boolean isMacOSCatalina;
public static final boolean isMacOSYosemite;
public static final boolean isWindows10;
public static final boolean isWindows10OrGreater;
public static final boolean isWindows7;
public static final boolean isWindowsVista;
@ -94,8 +94,12 @@ public final class SystemInfo {
isMacOSCatalina = isMac && isOsVersionAtLeast("10.15");
isMacOSMojave = isMacOSCatalina || (isMac && isOsVersionAtLeast("10.14"));
isMacOSYosemite = isMacOSCatalina || (isMac && isOsVersionAtLeast("10.10"));
isWindows10 = isWindows && isOsVersionAtLeast("10.0");
isWindows7 = isWindows10 || (isWindows && isOsVersionAtLeast("6.1"));
isWindows10OrGreater = isWindows && isOsVersionAtLeast("10.0");
System.out.println(OS_VERSION);
System.out.println(OS_NAME);
isWindows7 = isWindows10OrGreater || (isWindows && isOsVersionAtLeast("6.1"));
isWindowsVista = isWindows7 || (isWindows && isOsVersionAtLeast("6.0"));
isJava9OrGreater = isJavaVersionAtLeast("9");
isJava16OrGreater = isJava9OrGreater && isJavaVersionAtLeast("16");

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

@ -38,7 +38,7 @@ import com.github.weisj.darklaf.util.SystemInfo;
public class WindowsDecorationsProvider implements DecorationsProvider {
public WindowsDecorationsProvider() throws UnsupportedProviderException {
if (!SystemInfo.isWindows10)
if (!SystemInfo.isWindows10OrGreater)
throw new UnsupportedProviderException("Only supported on Windows 10 or later");
if (!WindowsLibrary.get().canLoad())
throw new UnsupportedProviderException("Native components aren't supported");

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

@ -66,6 +66,6 @@ public class WindowsLibrary extends AbstractLibrary {
@Override
protected boolean canLoad() {
return !SystemInfo.undefinedArchitecture && SystemInfo.isX86Compatible && SystemInfo.isWindows10;
return !SystemInfo.undefinedArchitecture && SystemInfo.isX86Compatible && SystemInfo.isWindows10OrGreater;
}
}

5
windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

@ -743,8 +743,9 @@ public class WindowsTitlePane extends CustomTitlePane {
}
protected void updateDragArea(final GraphicsConfiguration gc) {
JNIDecorationsWindows.updateValues(windowHandle, (int) Scale.scaleWidth(left, gc),
(int) Scale.scaleWidth(right, gc), (int) Scale.scaleHeight(height, gc));
JNIDecorationsWindows.updateValues(windowHandle,
(int) Scale.scaleWidth(left, gc), (int) Scale.scaleWidth(right, gc),
(int) Scale.scaleHeight(height, gc), (int) Scale.scaleHeight(BUTTON_WIDTH, gc));
}
private Dimension getPreferredMenuSize() {

Loading…
Cancel
Save