Skip to content

Commit 38f2bdb

Browse files
committed
bug fix
1 parent 80ae7bd commit 38f2bdb

11 files changed

Lines changed: 44 additions & 17 deletions

File tree

DWMBlurGlass/MainWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace MDWMBlurGlass
5353
SendMessageW(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
5454

5555
UIBkgndStyle bgStyle;
56-
bgStyle.bkgndColor = Color::M_RGBA(250, 250, 250, 255);
56+
bgStyle.bkgndColor = Color::M_RGBA(245, 241, 249, 255);
5757
root->SetBackground(bgStyle);
5858

5959
try

DWMBlurGlass/MainWindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
namespace MDWMBlurGlass
2323
{
24-
inline const std::wstring g_vernum = L"2.3.0";
24+
inline const std::wstring g_vernum = L"2.3.1";
2525

2626
Mui::_m_result MainWindow_SrcEventProc(Mui::MWindowCtx*, const Mui::MWndDefEventSource&, Mui::MEventCodeEnum, Mui::_m_param);
2727

DWMBlurGlass/Page/MainPage.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ namespace MDWMBlurGlass
209209
<UILabel pos="0,5" text="https://github.com/Maplespe/DWMBlurGlass" fontColor="30,144,255,255" hyperlink="true" url="https://github.com/Maplespe/DWMBlurGlass" />
210210
<UILabel pos="0,5" text="#curlang" />
211211
<UILabel pos="0,5" name="langauthor" />
212-
<UILabel frame="0,15,10f,20" text="Copyright © 2023-2024 Maplespe" autoSize="false" textAlign="2" hyperlink="true" url="https://github.com/Maplespe/" />
212+
<UILabel frame="0,15,10f,20" text="Copyright © 2023-2025 Maplespe" autoSize="false" textAlign="2" hyperlink="true" url="https://github.com/Maplespe/" />
213213
</UIControl>
214214
</UIControl>);
215215

@@ -911,6 +911,7 @@ namespace MDWMBlurGlass
911911
m_page->Child(L"crossFadeGroup")->SetEnabled(index == blurMethod::CustomBlur && m_cfgData.crossFade);
912912
m_page->Child(L"useaccentcolor")->SetEnabled(index == blurMethod::CustomBlur || index == blurMethod::AccentBlur);
913913
m_page->Child(L"overrideAccent")->SetEnabled(index == blurMethod::CustomBlur);
914+
m_page->Child(L"disableOnBattery")->SetEnabled(index == blurMethod::CustomBlur);
914915
m_page->Child(L"titlebtnGlow")->SetEnabled(index == blurMethod::CustomBlur);
915916
if(index == blurMethod::AccentBlur)
916917
m_page->Child<UICheckBox>(L"overrideAccent")->SetSel(true, false);

DWMBlurGlass/Resource.rc

0 Bytes
Binary file not shown.
2.92 KB
Loading

DWMBlurGlassExt/Common/DWMStruct.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,11 +1035,22 @@ namespace MDWMBlurGlassExt::DWM
10351035

10361036
void CTopLevelWindow::CDWriteTextSetColor(COLORREF color)
10371037
{
1038-
auto text = (CDWriteText*)*((ULONG64*)this + 71);//CDWriteText This
1039-
typedef void(__fastcall**** CDWriteText_SetColor)(CDWriteText*, UINT);//(***((void(__fastcall****)(ULONG64, __int64))This + 71))(*((ULONG64*)This + 71), inputVec);
1040-
auto pfunCDWriteText_SetColor = ***((CDWriteText_SetColor)this + 71);//CDWriteText::SetColor(CDWriteText *this, int a2)
1038+
if(os::buildNumber < 26100)
1039+
{
1040+
auto text = (CDWriteText*)*((ULONG64*)this + 71);//CDWriteText This
1041+
typedef void(__fastcall**** CDWriteText_SetColor)(CDWriteText*, UINT);//(***((void(__fastcall****)(ULONG64, __int64))This + 71))(*((ULONG64*)This + 71), inputVec);
1042+
auto pfunCDWriteText_SetColor = ***((CDWriteText_SetColor)this + 71);//CDWriteText::SetColor(CDWriteText *this, int a2)
1043+
1044+
pfunCDWriteText_SetColor(text, color);
1045+
}
1046+
else
1047+
{
1048+
auto text = (CDWriteText*)*((ULONG64*)this + 66);
1049+
typedef void(__fastcall**** CDWriteText_SetColor)(CDWriteText*, UINT);
1050+
auto pfunCDWriteText_SetColor = ***((CDWriteText_SetColor)this + 66);
10411051

1042-
pfunCDWriteText_SetColor(text, color);
1052+
pfunCDWriteText_SetColor(text, color);
1053+
}
10431054
}
10441055

10451056
bool CTopLevelWindow::TreatAsActiveWindow()

DWMBlurGlassExt/DWMBlurGlass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ namespace MDWMBlurGlassExt
8282
GetCurrentProcessId(),
8383
fileHandle.get(),
8484
static_cast<MINIDUMP_TYPE>(
85+
MINIDUMP_TYPE::MiniDumpNormal |
8586
MINIDUMP_TYPE::MiniDumpWithThreadInfo |
86-
MINIDUMP_TYPE::MiniDumpWithFullMemory |
87-
MINIDUMP_TYPE::MiniDumpWithUnloadedModules
87+
MINIDUMP_TYPE::MiniDumpWithUnloadedModules |
88+
MINIDUMP_TYPE::MiniDumpWithProcessThreadData
8889
),
8990
&minidumpExceptionInfo,
9091
nullptr,

DWMBlurGlassExt/DWMBlurGlassExt.rc

0 Bytes
Binary file not shown.

DWMBlurGlassExt/Section/CustomButton.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "../DWMBlurGlass.h"
2020
#include "../Backdrops/ButtonGlowBackdrop.hpp"
2121
#include <shellscalingapi.h>
22+
#include <mutex>
2223
#pragma comment(lib, "shcore.lib")
2324

2425
namespace MDWMBlurGlassExt::CustomButton
@@ -34,12 +35,13 @@ namespace MDWMBlurGlassExt::CustomButton
3435
};
3536
thread_local std::unordered_map<CTopLevelWindow*, buttonData> g_cbuttonList;
3637
std::unordered_map<CTopLevelWindow*, com_ptr<CButtonGlowBackdrop>> g_glowbackdropMap{};
38+
std::mutex g_dslock;
3739

3840
inline auto FindWindowFromButton(CButton* btn)
3941
{
40-
for(auto wnditer = g_cbuttonList.begin(); wnditer != g_cbuttonList.end(); ++wnditer)
42+
for (auto wnditer = g_cbuttonList.begin(); wnditer != g_cbuttonList.end(); ++wnditer)
4143
{
42-
if(auto iter = wnditer->second.buttonList.find(btn); iter != wnditer->second.buttonList.end())
44+
if (auto iter = wnditer->second.buttonList.find(btn); iter != wnditer->second.buttonList.end())
4345
return wnditer;
4446
}
4547
return g_cbuttonList.end();
@@ -123,7 +125,7 @@ namespace MDWMBlurGlassExt::CustomButton
123125
&& (
124126
(g_configData.blurmethod != blurMethod::DWMAPIBlur && g_configData.oldBtnHeight)
125127
|| (g_configData.blurmethod == blurMethod::CustomBlur && g_configData.titlebtnGlow)
126-
))
128+
))
127129
Attach();
128130
else if (g_startup
129131
&& ((!g_configData.oldBtnHeight && !g_configData.titlebtnGlow) || g_configData.blurmethod == blurMethod::DWMAPIBlur)
@@ -200,7 +202,7 @@ namespace MDWMBlurGlassExt::CustomButton
200202
if (scale != 1.f)
201203
borderW -= (int)ceil(1.1f * scale);
202204

203-
if(os::buildNumber < 22000 && borderW <= 0)
205+
if (os::buildNumber < 22000 && borderW <= 0)
204206
{
205207
borderW = 6;
206208
if (IsZoomed(g_window))
@@ -279,8 +281,11 @@ namespace MDWMBlurGlassExt::CustomButton
279281
{
280282
RemoveGlow(This);
281283
}
284+
std::lock_guard lock{ g_dslock };
282285
if (auto iter = g_cbuttonList.find(This); iter != g_cbuttonList.end())
286+
{
283287
g_cbuttonList.erase(iter);
288+
}
284289
}
285290

286291
void CButton_Destructor(CButton* This)
@@ -322,18 +327,21 @@ namespace MDWMBlurGlassExt::CustomButton
322327
auto hr = g_funCButton_RedrawVisual.call_org(This);
323328
if (!g_configData.titlebtnGlow) return hr;
324329

330+
std::lock_guard lock{ g_dslock };
325331
auto iter = FindWindowFromButton(This);
326332
if (iter == g_cbuttonList.end())
327333
return hr;
328334

335+
auto cwnd = iter->first;
336+
329337
RECT rect;
330-
iter->first->GetActualWindowRect(&rect, 0, 0, false);
338+
cwnd->GetActualWindowRect(&rect, 0, 0, false);
331339
auto monitor = MonitorFromPoint({ max(0, rect.left), max(0, rect.top) }, 0);
332340
UINT dpi = 96;
333341
GetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &dpi, &dpi);
334342
const float scale = (float)dpi / 96.f;
335343

336-
if (auto backdrop = GetOrCreateGlow(iter->first, false))
344+
if (auto backdrop = GetOrCreateGlow(cwnd, false))
337345
{
338346
auto& data = iter->second.buttonList[This];
339347

DWMBlurGlassExt/Section/OcclusionCulling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ namespace MDWMBlurGlassExt::OcclusionCulling
8383

8484
if (os::buildNumber < 22000)
8585
{
86+
g_funCOcclusionContext_PostSubgraph.Attach();
8687
g_funCVisual_GetWindowBackgroundTreatmentInternal.Attach();
8788
g_funCArrayBasedCoverageSet_AddAntiOccluderRect.Attach();
8889
g_funCArrayBasedCoverageSet_IsCovered.Attach();
89-
g_funCOcclusionContext_PostSubgraph.Attach();
9090
}
9191
}
9292

0 commit comments

Comments
 (0)