diff --git a/CHANGELOG.md b/CHANGELOG.md index dc88bb42e..40feda24e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,8 @@ FlatLaf Change Log regression in 3.5) - Popup: Fixed NPE if `GraphicsConfiguration` is `null` on Windows. (issue #921) - Theme Editor: Fixed using color picker on secondary screen. - +- Fixed detection of Windows 11 if custom exe launcher does not specify Windows + 10+ compatibility in application manifest. (issue #916) ## 3.5.2 diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-arm64.dll b/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-arm64.dll index d9ebcfb5f..716527e57 100644 Binary files a/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-arm64.dll and b/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-arm64.dll differ diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-x86.dll b/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-x86.dll index ab1cbfd2e..fb0f8325d 100644 Binary files a/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-x86.dll and b/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-x86.dll differ diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-x86_64.dll b/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-x86_64.dll index 9d31677bb..e810d4a4e 100644 Binary files a/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-x86_64.dll and b/flatlaf-core/src/main/resources/com/formdev/flatlaf/natives/flatlaf-windows-x86_64.dll differ diff --git a/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/WinWrapper.cpp b/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/WinWrapper.cpp index 1983a075b..c1276973f 100644 --- a/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/WinWrapper.cpp +++ b/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/WinWrapper.cpp @@ -30,12 +30,26 @@ HWND getWindowHandle( JNIEnv* env, jobject window ); //---- Utility ---------------------------------------------------------------- +typedef LONG (WINAPI *RtlGetVersion_Type)( OSVERSIONINFO* ); + extern "C" JNIEXPORT jlong JNICALL Java_com_formdev_flatlaf_ui_FlatNativeWindowsLibrary_getOSBuildNumberImpl ( JNIEnv* env, jclass cls ) { OSVERSIONINFO info; info.dwOSVersionInfoSize = sizeof( info ); + info.dwBuildNumber = 0; + + // use RtlGetVersion for the case that app manifest does not specify Windows 10+ compatibility + // https://www.codeproject.com/Articles/5336372/Windows-Version-Detection + HMODULE ntdllModule = ::GetModuleHandleA( "ntdll.dll" ); + if( ntdllModule != NULL ) { + RtlGetVersion_Type pRtlGetVersion = (RtlGetVersion_Type) ::GetProcAddress( ntdllModule, "RtlGetVersion" ); + if( pRtlGetVersion != NULL && pRtlGetVersion( &info ) == 0 ) + return info.dwBuildNumber; + } + + // fallback if( !::GetVersionEx( &info ) ) return 0; return info.dwBuildNumber;