Skip to content

Commit 32158e3

Browse files
committed
[Win32] Move OS-version-related functionality to OsVersion class
With the separation of the OS version check to the separate OsVersion class/DLL, version concerns have been spread over the OS and the OsVersion classes. This change consistently moves every such logic to the OsVersion class. It also replaces the manual checks of the current OS version against a specified version by an easy-to-read access to according constants identifying whether the current system is at least a specific Windows build version.
1 parent eac27cd commit 32158e3

File tree

10 files changed

+25
-197
lines changed

10 files changed

+25
-197
lines changed

bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6519,18 +6519,6 @@ JNIEXPORT void JNICALL OS_NATIVE(NotifyWinEvent)
65196519
}
65206520
#endif
65216521

6522-
#ifndef NO_OSVERSIONINFOEX_1sizeof
6523-
JNIEXPORT jint JNICALL OS_NATIVE(OSVERSIONINFOEX_1sizeof)
6524-
(JNIEnv *env, jclass that)
6525-
{
6526-
jint rc = 0;
6527-
OS_NATIVE_ENTER(env, that, OSVERSIONINFOEX_1sizeof_FUNC);
6528-
rc = (jint)OSVERSIONINFOEX_sizeof();
6529-
OS_NATIVE_EXIT(env, that, OSVERSIONINFOEX_1sizeof_FUNC);
6530-
return rc;
6531-
}
6532-
#endif
6533-
65346522
#ifndef NO_OUTLINETEXTMETRIC_1sizeof
65356523
JNIEXPORT jint JNICALL OS_NATIVE(OUTLINETEXTMETRIC_1sizeof)
65366524
(JNIEnv *env, jclass that)
@@ -7322,30 +7310,6 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(RoundRect)
73227310
}
73237311
#endif
73247312

7325-
#ifndef NO_RtlGetVersion
7326-
JNIEXPORT jint JNICALL OS_NATIVE(RtlGetVersion)
7327-
(JNIEnv *env, jclass that, jobject arg0)
7328-
{
7329-
OSVERSIONINFOEX _arg0, *lparg0=NULL;
7330-
jint rc = 0;
7331-
OS_NATIVE_ENTER(env, that, RtlGetVersion_FUNC);
7332-
if (arg0) if ((lparg0 = getOSVERSIONINFOEXFields(env, arg0, &_arg0)) == NULL) goto fail;
7333-
/*
7334-
rc = (jint)RtlGetVersion(lparg0);
7335-
*/
7336-
{
7337-
OS_LOAD_FUNCTION(fp, RtlGetVersion)
7338-
if (fp) {
7339-
rc = (jint)((jint (CALLING_CONVENTION*)(OSVERSIONINFOEX *))fp)(lparg0);
7340-
}
7341-
}
7342-
fail:
7343-
if (arg0 && lparg0) setOSVERSIONINFOEXFields(env, arg0, lparg0);
7344-
OS_NATIVE_EXIT(env, that, RtlGetVersion_FUNC);
7345-
return rc;
7346-
}
7347-
#endif
7348-
73497313
#ifndef NO_SAFEARRAYBOUND_1sizeof
73507314
JNIEXPORT jint JNICALL OS_NATIVE(SAFEARRAYBOUND_1sizeof)
73517315
(JNIEnv *env, jclass that)

bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ typedef enum {
499499
NONCLIENTMETRICS_1sizeof_FUNC,
500500
NOTIFYICONDATA_1V2_1SIZE_FUNC,
501501
NotifyWinEvent_FUNC,
502-
OSVERSIONINFOEX_1sizeof_FUNC,
503502
OUTLINETEXTMETRIC_1sizeof_FUNC,
504503
OffsetRect_FUNC,
505504
OffsetRgn_FUNC,
@@ -554,7 +553,6 @@ typedef enum {
554553
ReplyMessage_FUNC,
555554
RestoreDC_FUNC,
556555
RoundRect_FUNC,
557-
RtlGetVersion_FUNC,
558556
SAFEARRAYBOUND_1sizeof_FUNC,
559557
SAFEARRAY_1sizeof_FUNC,
560558
SCRIPT_1ANALYSIS_1sizeof_FUNC,

bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4213,73 +4213,6 @@ void setNOTIFYICONDATAFields(JNIEnv *env, jobject lpObject, NOTIFYICONDATA *lpSt
42134213
}
42144214
#endif
42154215

4216-
#ifndef NO_OSVERSIONINFOEX
4217-
typedef struct OSVERSIONINFOEX_FID_CACHE {
4218-
int cached;
4219-
jclass clazz;
4220-
jfieldID dwOSVersionInfoSize, dwMajorVersion, dwMinorVersion, dwBuildNumber, dwPlatformId, szCSDVersion, wServicePackMajor, wServicePackMinor, wSuiteMask, wProductType, wReserved;
4221-
} OSVERSIONINFOEX_FID_CACHE;
4222-
4223-
OSVERSIONINFOEX_FID_CACHE OSVERSIONINFOEXFc;
4224-
4225-
void cacheOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject)
4226-
{
4227-
if (OSVERSIONINFOEXFc.cached) return;
4228-
OSVERSIONINFOEXFc.clazz = (*env)->GetObjectClass(env, lpObject);
4229-
OSVERSIONINFOEXFc.dwOSVersionInfoSize = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwOSVersionInfoSize", "I");
4230-
OSVERSIONINFOEXFc.dwMajorVersion = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwMajorVersion", "I");
4231-
OSVERSIONINFOEXFc.dwMinorVersion = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwMinorVersion", "I");
4232-
OSVERSIONINFOEXFc.dwBuildNumber = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwBuildNumber", "I");
4233-
OSVERSIONINFOEXFc.dwPlatformId = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwPlatformId", "I");
4234-
OSVERSIONINFOEXFc.szCSDVersion = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "szCSDVersion", "[C");
4235-
OSVERSIONINFOEXFc.wServicePackMajor = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wServicePackMajor", "I");
4236-
OSVERSIONINFOEXFc.wServicePackMinor = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wServicePackMinor", "I");
4237-
OSVERSIONINFOEXFc.wSuiteMask = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wSuiteMask", "I");
4238-
OSVERSIONINFOEXFc.wProductType = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wProductType", "I");
4239-
OSVERSIONINFOEXFc.wReserved = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wReserved", "I");
4240-
OSVERSIONINFOEXFc.cached = 1;
4241-
}
4242-
4243-
OSVERSIONINFOEX *getOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct)
4244-
{
4245-
if (!OSVERSIONINFOEXFc.cached) cacheOSVERSIONINFOEXFields(env, lpObject);
4246-
lpStruct->dwOSVersionInfoSize = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwOSVersionInfoSize);
4247-
lpStruct->dwMajorVersion = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMajorVersion);
4248-
lpStruct->dwMinorVersion = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMinorVersion);
4249-
lpStruct->dwBuildNumber = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwBuildNumber);
4250-
lpStruct->dwPlatformId = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwPlatformId);
4251-
{
4252-
jcharArray lpObject1 = (jcharArray)(*env)->GetObjectField(env, lpObject, OSVERSIONINFOEXFc.szCSDVersion);
4253-
(*env)->GetCharArrayRegion(env, lpObject1, 0, sizeof(lpStruct->szCSDVersion) / sizeof(jchar), (jchar *)lpStruct->szCSDVersion);
4254-
}
4255-
lpStruct->wServicePackMajor = (WORD)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMajor);
4256-
lpStruct->wServicePackMinor = (WORD)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMinor);
4257-
lpStruct->wSuiteMask = (WORD)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wSuiteMask);
4258-
lpStruct->wProductType = (BYTE)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wProductType);
4259-
lpStruct->wReserved = (BYTE)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wReserved);
4260-
return lpStruct;
4261-
}
4262-
4263-
void setOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct)
4264-
{
4265-
if (!OSVERSIONINFOEXFc.cached) cacheOSVERSIONINFOEXFields(env, lpObject);
4266-
(*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwOSVersionInfoSize, (jint)lpStruct->dwOSVersionInfoSize);
4267-
(*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMajorVersion, (jint)lpStruct->dwMajorVersion);
4268-
(*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMinorVersion, (jint)lpStruct->dwMinorVersion);
4269-
(*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwBuildNumber, (jint)lpStruct->dwBuildNumber);
4270-
(*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwPlatformId, (jint)lpStruct->dwPlatformId);
4271-
{
4272-
jcharArray lpObject1 = (jcharArray)(*env)->GetObjectField(env, lpObject, OSVERSIONINFOEXFc.szCSDVersion);
4273-
(*env)->SetCharArrayRegion(env, lpObject1, 0, sizeof(lpStruct->szCSDVersion) / sizeof(jchar), (jchar *)lpStruct->szCSDVersion);
4274-
}
4275-
(*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMajor, (jint)lpStruct->wServicePackMajor);
4276-
(*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMinor, (jint)lpStruct->wServicePackMinor);
4277-
(*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wSuiteMask, (jint)lpStruct->wSuiteMask);
4278-
(*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wProductType, (jint)lpStruct->wProductType);
4279-
(*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wReserved, (jint)lpStruct->wReserved);
4280-
}
4281-
#endif
4282-
42834216
#ifndef NO_OUTLINETEXTMETRIC
42844217
typedef struct OUTLINETEXTMETRIC_FID_CACHE {
42854218
int cached;

bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -965,18 +965,6 @@ void setNOTIFYICONDATAFields(JNIEnv *env, jobject lpObject, NOTIFYICONDATA *lpSt
965965
#define NOTIFYICONDATA_sizeof() 0
966966
#endif
967967

968-
#ifndef NO_OSVERSIONINFOEX
969-
void cacheOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject);
970-
OSVERSIONINFOEX *getOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct);
971-
void setOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct);
972-
#define OSVERSIONINFOEX_sizeof() sizeof(OSVERSIONINFOEX)
973-
#else
974-
#define cacheOSVERSIONINFOEXFields(a,b)
975-
#define getOSVERSIONINFOEXFields(a,b,c) NULL
976-
#define setOSVERSIONINFOEXFields(a,b,c)
977-
#define OSVERSIONINFOEX_sizeof() 0
978-
#endif
979-
980968
#ifndef NO_OUTLINETEXTMETRIC
981969
void cacheOUTLINETEXTMETRICFields(JNIEnv *env, jobject lpObject);
982970
OUTLINETEXTMETRIC *getOUTLINETEXTMETRICFields(JNIEnv *env, jobject lpObject, OUTLINETEXTMETRIC *lpStruct);

bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.eclipse.swt.graphics.*;
2121
import org.eclipse.swt.internal.*;
22+
import org.eclipse.swt.internal.win32.version.*;
2223
import org.eclipse.swt.widgets.*;
2324

2425
public class OS extends C {
@@ -30,18 +31,6 @@ public class OS extends C {
3031
* SWT Windows flags
3132
*/
3233
public static final boolean IsDBLocale;
33-
/**
34-
* Always reports the correct build number, regardless of manifest and
35-
* compatibility GUIDs. Note that build number alone is sufficient to
36-
* identify Windows version.
37-
*/
38-
public static final int WIN32_BUILD;
39-
/**
40-
* Values taken from https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
41-
*/
42-
public static final int WIN32_BUILD_WIN10_1809 = 17763; // "Windows 10 October 2018 Update"
43-
public static final int WIN32_BUILD_WIN10_2004 = 19041; // "Windows 10 May 2020 Update"
44-
public static final int WIN32_BUILD_WIN11_21H2 = 22000; // Initial Windows 11 release
4534

4635
public static final String NO_MANIFEST = "org.eclipse.swt.internal.win32.OS.NO_MANIFEST";
4736

@@ -53,20 +42,6 @@ public class OS extends C {
5342
public static final int SM_IMMENABLED = 0x52;
5443

5544
static {
56-
/*
57-
* Starting with Windows 10, GetVersionEx() lies about version unless
58-
* application manifest has a proper entry. RtlGetVersion() always
59-
* reports true version.
60-
*/
61-
OSVERSIONINFOEX osVersionInfoEx = new OSVERSIONINFOEX ();
62-
osVersionInfoEx.dwOSVersionInfoSize = OSVERSIONINFOEX.sizeof;
63-
if (0 == OS.RtlGetVersion (osVersionInfoEx)) {
64-
WIN32_BUILD = osVersionInfoEx.dwBuildNumber;
65-
} else {
66-
System.err.println ("SWT: OS: Failed to detect Windows build number");
67-
WIN32_BUILD = 0;
68-
}
69-
7045
/* Load the manifest to force the XP Theme */
7146
if (System.getProperty (NO_MANIFEST) == null) {
7247
ACTCTX pActCtx = new ACTCTX ();
@@ -1974,7 +1949,6 @@ public static int VERSION (int major, int minor) {
19741949
/** @method flags=const */
19751950
public static final native int NOTIFYICONDATA_V2_SIZE ();
19761951
public static final native int OUTLINETEXTMETRIC_sizeof ();
1977-
public static final native int OSVERSIONINFOEX_sizeof ();
19781952
public static final native int PAINTSTRUCT_sizeof ();
19791953
public static final native int POINT_sizeof ();
19801954
public static final native int PRINTDLG_sizeof ();
@@ -3964,8 +3938,6 @@ public static int HRESULT_FROM_WIN32(int x) {
39643938
public static final native boolean RestoreDC (long hdc, int nSavedDC);
39653939
/** @param hdc cast=(HDC) */
39663940
public static final native boolean RoundRect (long hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidth, int nHeight);
3967-
/** @method flags=dynamic */
3968-
public static final native int RtlGetVersion (OSVERSIONINFOEX lpVersionInformation);
39693941
/** @param hdc cast=(HDC) */
39703942
public static final native int SaveDC (long hdc);
39713943
/** @param hWnd cast=(HWND) */
@@ -4616,7 +4588,7 @@ public static final native boolean DuplicateHandle(long hSourceProcessHandle, lo
46164588

46174589

46184590
public static long OpenThemeData(long hwnd, char[] themeName, int dpi) {
4619-
if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1809) {
4591+
if (OsVersion.IS_WIN10_1809) {
46204592
return OS.OpenThemeDataForDpi(hwnd, themeName, dpi);
46214593
} else {
46224594
return OS.OpenThemeData(hwnd, themeName);

bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OSVERSIONINFOEX.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/version/OsVersion.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,25 @@ public class OsVersion extends Platform {
3131
* compatibility GUIDs. Note that build number alone is sufficient to
3232
* identify Windows version.
3333
*/
34-
public static final int WIN32_BUILD;
34+
private static final int WIN32_BUILD = getCurrentOsVersion();
35+
3536
/**
3637
* Values taken from https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
3738
*/
38-
public static final int WIN32_BUILD_WIN10_1607 = 14393; // "Windows 10 August 2016 Update"
39+
private static final int WIN10_1607 = 14393;
40+
public static final boolean IS_WIN10_1607 = WIN32_BUILD >= WIN10_1607; // "Windows 10 August 2016 Update"
41+
public static final boolean IS_WIN10_1809 = WIN32_BUILD >= 17763; // "Windows 10 October 2018 Update"
42+
public static final boolean IS_WIN10_2004 = WIN32_BUILD >= 19041; // "Windows 10 May 2020 Update"
43+
public static final boolean IS_WIN11_21H2 = WIN32_BUILD >= 22000; // Initial Windows 11 release
3944

4045
/**
4146
* The minimum supported Windows build version for using this SWT version
4247
*/
43-
public static final int WIN32_MINIMUM_COMPATIBLE_BUILD = WIN32_BUILD_WIN10_1607;
48+
private static final int MINIMUM_COMPATIBLE_BUILD = WIN10_1607;
4449

4550
private static final String DISABLE_WINDOWS_VERSION_CHECK_PROPERTY = "swt.disableWindowsVersionCheck";
4651

47-
static {
52+
private static int getCurrentOsVersion() {
4853
/*
4954
* Starting with Windows 10, GetVersionEx() lies about version unless
5055
* application manifest has a proper entry. RtlGetVersion() always
@@ -53,19 +58,19 @@ public class OsVersion extends Platform {
5358
OSVERSIONINFOEX osVersionInfoEx = new OSVERSIONINFOEX ();
5459
osVersionInfoEx.dwOSVersionInfoSize = OSVERSIONINFOEX.sizeof;
5560
if (0 == OsVersion.RtlGetVersion (osVersionInfoEx)) {
56-
WIN32_BUILD = osVersionInfoEx.dwBuildNumber;
61+
return osVersionInfoEx.dwBuildNumber;
5762
} else {
5863
System.err.println ("SWT: OS: Failed to detect Windows build number");
59-
WIN32_BUILD = 0;
64+
return 0;
6065
}
6166
}
6267

6368
public static void checkCompatibleWindowsVersion() {
6469
String disableVersionCheckPropertyValue = System.getProperty(DISABLE_WINDOWS_VERSION_CHECK_PROPERTY, Boolean.FALSE.toString());
6570
boolean versionCheckDisabled = "".equals(disableVersionCheckPropertyValue) || Boolean.TRUE.toString().equalsIgnoreCase(disableVersionCheckPropertyValue);
66-
if (!versionCheckDisabled && WIN32_BUILD < WIN32_MINIMUM_COMPATIBLE_BUILD) {
71+
if (!versionCheckDisabled && WIN32_BUILD < MINIMUM_COMPATIBLE_BUILD) {
6772
System.err.println(String.format("Incompatible OS: Minimum Windows build version is %s but current is %s",
68-
WIN32_MINIMUM_COMPATIBLE_BUILD, WIN32_BUILD));
73+
MINIMUM_COMPATIBLE_BUILD, WIN32_BUILD));
6974
System.exit(1);
7075
}
7176
}

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.eclipse.swt.graphics.*;
2121
import org.eclipse.swt.internal.*;
2222
import org.eclipse.swt.internal.win32.*;
23+
import org.eclipse.swt.internal.win32.version.*;
2324

2425
/**
2526
* Instances of this class represent a selectable user interface object that
@@ -1351,7 +1352,7 @@ LRESULT wmNotifyChild (NMHDR hdr, long wParam, long lParam) {
13511352

13521353
int inset = 2;
13531354
int radius = 3;
1354-
if (useDarkModeExplorerTheme && (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN11_21H2)) {
1355+
if (useDarkModeExplorerTheme && OsVersion.IS_WIN11_21H2) {
13551356
// On Win11, Light theme and Dark theme images have different sizes
13561357
inset = 1;
13571358
radius = 4;
@@ -1362,7 +1363,7 @@ LRESULT wmNotifyChild (NMHDR hdr, long wParam, long lParam) {
13621363
int r = nmcd.right - inset;
13631364
int b = nmcd.bottom - inset;
13641365

1365-
if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN11_21H2) {
1366+
if (OsVersion.IS_WIN11_21H2) {
13661367
// 'RoundRect' has left/top pixel reserved for border
13671368
l += 1;
13681369
t += 1;
@@ -1488,7 +1489,7 @@ static int getThemeStateId(int style, boolean pressed, boolean enabled) {
14881489
* The workaround is to use hot image in place of default.
14891490
*/
14901491
boolean hot = false;
1491-
if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN11_21H2) {
1492+
if (OsVersion.IS_WIN11_21H2) {
14921493
if (!pressed && enabled) {
14931494
hot = true;
14941495
}

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.eclipse.swt.internal.*;
2626
import org.eclipse.swt.internal.ole.win32.*;
2727
import org.eclipse.swt.internal.win32.*;
28+
import org.eclipse.swt.internal.win32.version.*;
2829

2930
/**
3031
* Instances of this class are responsible for managing the
@@ -2158,7 +2159,7 @@ public static boolean isSystemDarkTheme () {
21582159
/*
21592160
* The registry settings, and Dark Theme itself, is present since Win10 1809
21602161
*/
2161-
if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1809) {
2162+
if (OsVersion.IS_WIN10_1809) {
21622163
int[] result = OS.readRegistryDwords(OS.HKEY_CURRENT_USER,
21632164
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme");
21642165
if (result!=null) {
@@ -5397,7 +5398,7 @@ private boolean setDPIAwareness(int desiredDpiAwareness) {
53975398
}
53985399
if (desiredDpiAwareness == OS.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) {
53995400
// "Per Monitor V2" only available in more recent Windows version
5400-
boolean perMonitorV2Available = OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1809;
5401+
boolean perMonitorV2Available = OsVersion.IS_WIN10_1809;
54015402
if (!perMonitorV2Available) {
54025403
System.err.println("***WARNING: the OS version does not support DPI awareness mode PerMonitorV2.");
54035404
return false;

0 commit comments

Comments
 (0)