diff --git a/bin/WinLauncher/WinLauncher.exe b/bin/WinLauncher/WinLauncher.exe index 7b4b83cc8940..ec7b3edf4c1b 100644 Binary files a/bin/WinLauncher/WinLauncher.exe and b/bin/WinLauncher/WinLauncher.exe differ diff --git a/bin/WinLauncher/WinLauncher64.exe b/bin/WinLauncher/WinLauncher64.exe index a2a81c602487..1e2f0331938f 100644 Binary files a/bin/WinLauncher/WinLauncher64.exe and b/bin/WinLauncher/WinLauncher64.exe differ diff --git a/native/WinLauncher/WinLauncher/WinLauncher.cpp b/native/WinLauncher/WinLauncher/WinLauncher.cpp index c0c8d9dc231a..257e42ce479d 100644 --- a/native/WinLauncher/WinLauncher/WinLauncher.cpp +++ b/native/WinLauncher/WinLauncher/WinLauncher.cpp @@ -564,17 +564,24 @@ bool LoadJVMLibrary() return true; } -bool IsHiDPIJBRE() // JetBrains RE supporting HiDPI +bool IsJBRE() { if (!env) return false; - jclass cls = env->FindClass("sun/java2d/SunGraphicsEnvironment"); + jclass cls = env->FindClass("java/lang/System"); if (!cls) return false; - jmethodID method = env->GetMethodID(cls, "isUIScaleOn", "()Z"); + jmethodID method = env->GetStaticMethodID(cls, "getProperty", "(Ljava/lang/String;)Ljava/lang/String;"); if (!method) return false; - return true; + jstring jvendor = (jstring)env->CallStaticObjectMethod(cls, method, env->NewStringUTF("java.vendor")); + if (!jvendor) return false; + + const char *cvendor = env->GetStringUTFChars(jvendor, NULL); + bool isJB = strstr(cvendor, "JetBrains") != NULL; + env->ReleaseStringUTFChars(jvendor, cvendor); + + return isJB; } void SetProcessDPIAwareProperty() @@ -621,8 +628,8 @@ bool CreateJVM() MessageBoxA(NULL, buf.str().c_str(), error.c_str(), MB_OK); } - // Set DPI-awareness here or let HiDPI JBRE do that. - if (!IsHiDPIJBRE()) SetProcessDPIAwareProperty(); + // Set DPI-awareness here or let JBRE do that. + if (!IsJBRE()) SetProcessDPIAwareProperty(); return result == JNI_OK; }