diff --git a/CHANGELOG.md b/CHANGELOG.md index 327a4aa2..8ed1b298 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ FlatLaf Change Log `FlatPopupFactory.fixToolTipLocation()`. (issue #305) - IntelliJ Themes: Fixed background colors of DesktopPane and DesktopIcon in all themes. +- Native window decorations: Fixed occasional double window title bar when + creating many frames or dialogs. (issue #315) ## 1.1.2 diff --git a/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/HWNDMap.cpp b/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/HWNDMap.cpp index ae909ee1..8f9ae24a 100644 --- a/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/HWNDMap.cpp +++ b/flatlaf-natives/flatlaf-natives-windows/src/main/cpp/HWNDMap.cpp @@ -102,17 +102,17 @@ void HWNDMap::remove( HWND key ) { } int HWNDMap::binarySearch( HWND key ) { + __int64 ikey = reinterpret_cast<__int64>( key ); int low = 0; int high = size - 1; while( low <= high ) { int mid = (low + high) >> 1; - HWND midKey = table[mid].key; - int cmp = midKey - key; - if( cmp < 0 ) + __int64 midKey = reinterpret_cast<__int64>( table[mid].key ); + if( midKey < ikey ) low = mid + 1; - else if( cmp > 0 ) + else if( midKey > ikey ) high = mid - 1; else return mid;