mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-5285 Add doPrivileged for WFramePeer#WIN11_OR_NEWER os.name & os.version check.
This commit is contained in:
@@ -266,17 +266,20 @@ class WFramePeer extends WWindowPeer implements FramePeer {
|
||||
}
|
||||
private static native void updateCustomTitleBar(WWindowPeer peer);
|
||||
|
||||
// Used from native
|
||||
private static final boolean WIN11_OR_NEWER;
|
||||
static {
|
||||
if ("Windows 10".equals(System.getProperty("os.name"))) {
|
||||
WIN11_OR_NEWER = false;
|
||||
@SuppressWarnings("removal")
|
||||
private static boolean isWin11OrNewer() {
|
||||
String osName = AccessController.doPrivileged(new GetPropertyAction("os.name"));
|
||||
String osVersion = AccessController.doPrivileged(new GetPropertyAction("os.version"));
|
||||
if ("Windows 10".equals(osName)) {
|
||||
return false;
|
||||
} else {
|
||||
int version = 10;
|
||||
try {
|
||||
version = (int) Double.parseDouble(System.getProperty("os.version"));
|
||||
version = (int) Double.parseDouble(osVersion);
|
||||
} catch (NullPointerException | NumberFormatException ignored) {}
|
||||
WIN11_OR_NEWER = version >= 10;
|
||||
return version >= 10;
|
||||
}
|
||||
}
|
||||
// Used from native
|
||||
private static final boolean WIN11_OR_NEWER = isWin11OrNewer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user