@@ -56,25 +56,25 @@ namespace MDWMBlurGlassExt::TitleTextTweaker
5656 WriteMemory (g_pCreateBitmapFromHBITMAP, [&] { *(PVOID*)g_pCreateBitmapFromHBITMAP = MyCreateBitmapFromHBITMAP; });
5757 }
5858
59- if (os::buildNumber < 22000 )
59+ if (os::buildNumber < 22621 )
6060 {
6161 g_funCTopLevelWindow_UpdateWindowVisuals.Attach ();
6262 g_CTopLevelWindow_ValidateVisual_HookDispatcher.enable_hook_routine <1 , true >();
6363 }
64- else if (os::buildNumber >= 22000 )
64+ else if (os::buildNumber >= 22621 )
6565 {
6666 g_funCTopLevelWindow_UpdateText.Attach ();
6767 }
6868
6969 HMODULE udwmModule = GetModuleHandleW (L" udwm.dll" );
70- if (os::buildNumber <= 22621 )
70+ if (os::buildNumber < 22621 )
7171 {
7272 HMODULE hModule = GetModuleHandleW (L" user32.dll" );
7373 g_funFillRect = (decltype (g_funFillRect))GetProcAddress (hModule, " FillRect" );
7474 g_funDrawTextW = (decltype (g_funDrawTextW))GetProcAddress (hModule, " DrawTextW" );
7575 WriteIAT (udwmModule, " User32.dll" , { { " FillRect" , MyFillRect }, { " DrawTextW" , MyDrawTextW } });
7676 }
77- if (os::buildNumber < 22000 )
77+ if (os::buildNumber < 22621 )
7878 {
7979 HMODULE hModule = GetModuleHandleW (L" gdi32.dll" );
8080 g_funCreateBitmap = (decltype (g_funCreateBitmap))GetProcAddress (hModule, " CreateBitmap" );
@@ -84,11 +84,11 @@ namespace MDWMBlurGlassExt::TitleTextTweaker
8484
8585 void Detach ()
8686 {
87- if (os::buildNumber >= 22000 )
87+ if (os::buildNumber >= 22621 )
8888 {
8989 g_funCTopLevelWindow_UpdateText.Detach ();
9090 }
91- else if (os::buildNumber < 22000 )
91+ else if (os::buildNumber < 22621 )
9292 {
9393 g_funCTopLevelWindow_UpdateWindowVisuals.Detach ();
9494 g_CTopLevelWindow_ValidateVisual_HookDispatcher.enable_hook_routine <1 , false >();
@@ -98,11 +98,11 @@ namespace MDWMBlurGlassExt::TitleTextTweaker
9898 WriteMemory (g_pCreateBitmapFromHBITMAP, [&] {*(PVOID*)g_pCreateBitmapFromHBITMAP = g_funCreateBitmapFromHBITMAP; });
9999
100100 HMODULE udwmModule = GetModuleHandleW (L" udwm.dll" );
101- if (os::buildNumber <= 22621 )
101+ if (os::buildNumber < 22621 )
102102 {
103103 WriteIAT (udwmModule, " User32.dll" , { { " DrawTextW" , g_funDrawTextW } , { " FillRect" , g_funFillRect } });
104104 }
105- if (os::buildNumber < 22000 )
105+ if (os::buildNumber < 22621 )
106106 WriteIAT (udwmModule, " gdi32.dll" , { { " CreateBitmap" , g_funCreateBitmap } });
107107 }
108108
@@ -118,15 +118,18 @@ namespace MDWMBlurGlassExt::TitleTextTweaker
118118
119119 if ((format & DT_CALCRECT) || (format & DT_INTERNAL) || (format & DT_NOCLIP))
120120 {
121- // 兼容第三方主题绘制发光字需要预留一些区域
122- if (format & DT_CALCRECT)
121+ if (os::buildNumber < 22621 )
123122 {
124- auto ret = g_funDrawTextW (hdc, lpchText, cchText, lprc, format);
125- lprc->right += 30 ;
126- lprc->bottom += 20 ;
127- lprc->top = 0 ;
128- lprc->left = -10 ;
129- return ret + 20 ;
123+ // 兼容第三方主题绘制发光字需要预留一些区域
124+ if (format & DT_CALCRECT)
125+ {
126+ auto ret = g_funDrawTextW (hdc, lpchText, cchText, lprc, format);
127+ lprc->right += 30 ;
128+ lprc->bottom += 20 ;
129+ lprc->top = 0 ;
130+ lprc->left = -10 ;
131+ return ret + 20 ;
132+ }
130133 }
131134 return g_funDrawTextW (hdc, lpchText, cchText, lprc, format);
132135 }
@@ -160,8 +163,11 @@ namespace MDWMBlurGlassExt::TitleTextTweaker
160163 return g_funDrawTextW (hdc, lpchText, cchText, lprc, format);
161164
162165 RECT offset = *lprc;
163- offset.left += 20 ;
164- offset.top += 10 ;
166+ if (os::buildNumber < 22621 )
167+ {
168+ offset.left += 20 ;
169+ offset.top += 10 ;
170+ }
165171 if (FAILED (DrawThemeTextEx (hTheme, hdc, 0 , 0 , lpchText, cchText, DT_LEFT | DT_TOP, &offset, &Options)))
166172 return g_funDrawTextW (hdc, lpchText, cchText, lprc, format);
167173 return 1 ;
@@ -184,12 +190,25 @@ namespace MDWMBlurGlassExt::TitleTextTweaker
184190
185191 HRESULT CTopLevelWindow_UpdateWindowVisuals (CTopLevelWindow* This)
186192 {
187- auto frame = CTopLevelWindow::s_ChooseWindowFrameFromStyle
188- (
189- (char )*((DWORD*)This + 148 ),
190- false ,
191- (char )(*(BYTE*)(*((ULONG64*)This + 91 ) + 611 ) & 0x20 ) != 0
192- );
193+ CTopLevelWindow::WindowFrame* frame{nullptr };
194+ if (os::buildNumber < 22000 )
195+ {
196+ frame = CTopLevelWindow::s_ChooseWindowFrameFromStyle
197+ (
198+ (char )*((DWORD*)This + 148 ),
199+ false ,
200+ (char )(*(BYTE*)(*((ULONG64*)This + 91 ) + 611 ) & 0x20 ) != 0
201+ );
202+ }
203+ else
204+ {
205+ frame = CTopLevelWindow::s_ChooseWindowFrameFromStyle
206+ (
207+ (char )*((DWORD*)This + 152 ),
208+ false ,
209+ (char )(*(BYTE*)(*((ULONG64*)This + 94 ) + 667 ) & 0x20 ) != 0
210+ );
211+ }
193212
194213 // 对于Ribbon或扩展到NC区域的窗口 我们无法处理标题文本颜色 需要过滤掉 它应该由应用程序处理
195214 if (frame && (*((BYTE*)This + 592 ) & 8 ) != 0 )
@@ -239,7 +258,7 @@ namespace MDWMBlurGlassExt::TitleTextTweaker
239258
240259 g_window = hWnd;
241260
242- if (os::buildNumber < 22000 && This->HasNonClientBackground ())
261+ if (os::buildNumber < 22621 && This->HasNonClientBackground ())
243262 {
244263 // DrawText处给发光字预留了空间 需要刷新文本布局
245264 if (CText* textThis = This->GetCText ())
0 commit comments