Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Maplespe committed Jan 7, 2025
1 parent 80ae7bd commit 38f2bdb
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DWMBlurGlass/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace MDWMBlurGlass
SendMessageW(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);

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

try
Expand Down
2 changes: 1 addition & 1 deletion DWMBlurGlass/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace MDWMBlurGlass
{
inline const std::wstring g_vernum = L"2.3.0";
inline const std::wstring g_vernum = L"2.3.1";

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

Expand Down
3 changes: 2 additions & 1 deletion DWMBlurGlass/Page/MainPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ namespace MDWMBlurGlass
<UILabel pos="0,5" text="https://github.com/Maplespe/DWMBlurGlass" fontColor="30,144,255,255" hyperlink="true" url="https://github.com/Maplespe/DWMBlurGlass" />
<UILabel pos="0,5" text="#curlang" />
<UILabel pos="0,5" name="langauthor" />
<UILabel frame="0,15,10f,20" text="Copyright © 2023-2024 Maplespe" autoSize="false" textAlign="2" hyperlink="true" url="https://github.com/Maplespe/" />
<UILabel frame="0,15,10f,20" text="Copyright © 2023-2025 Maplespe" autoSize="false" textAlign="2" hyperlink="true" url="https://github.com/Maplespe/" />
</UIControl>
</UIControl>);

Expand Down Expand Up @@ -911,6 +911,7 @@ namespace MDWMBlurGlass
m_page->Child(L"crossFadeGroup")->SetEnabled(index == blurMethod::CustomBlur && m_cfgData.crossFade);
m_page->Child(L"useaccentcolor")->SetEnabled(index == blurMethod::CustomBlur || index == blurMethod::AccentBlur);
m_page->Child(L"overrideAccent")->SetEnabled(index == blurMethod::CustomBlur);
m_page->Child(L"disableOnBattery")->SetEnabled(index == blurMethod::CustomBlur);
m_page->Child(L"titlebtnGlow")->SetEnabled(index == blurMethod::CustomBlur);
if(index == blurMethod::AccentBlur)
m_page->Child<UICheckBox>(L"overrideAccent")->SetSel(true, false);
Expand Down
Binary file modified DWMBlurGlass/Resource.rc
Binary file not shown.
Binary file modified DWMBlurGlass/uiproject/DWMBlurGlass/icon/checkbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 15 additions & 4 deletions DWMBlurGlassExt/Common/DWMStruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,11 +1035,22 @@ namespace MDWMBlurGlassExt::DWM

void CTopLevelWindow::CDWriteTextSetColor(COLORREF color)
{
auto text = (CDWriteText*)*((ULONG64*)this + 71);//CDWriteText This
typedef void(__fastcall**** CDWriteText_SetColor)(CDWriteText*, UINT);//(***((void(__fastcall****)(ULONG64, __int64))This + 71))(*((ULONG64*)This + 71), inputVec);
auto pfunCDWriteText_SetColor = ***((CDWriteText_SetColor)this + 71);//CDWriteText::SetColor(CDWriteText *this, int a2)
if(os::buildNumber < 26100)
{
auto text = (CDWriteText*)*((ULONG64*)this + 71);//CDWriteText This
typedef void(__fastcall**** CDWriteText_SetColor)(CDWriteText*, UINT);//(***((void(__fastcall****)(ULONG64, __int64))This + 71))(*((ULONG64*)This + 71), inputVec);
auto pfunCDWriteText_SetColor = ***((CDWriteText_SetColor)this + 71);//CDWriteText::SetColor(CDWriteText *this, int a2)

pfunCDWriteText_SetColor(text, color);
}
else
{
auto text = (CDWriteText*)*((ULONG64*)this + 66);
typedef void(__fastcall**** CDWriteText_SetColor)(CDWriteText*, UINT);
auto pfunCDWriteText_SetColor = ***((CDWriteText_SetColor)this + 66);

pfunCDWriteText_SetColor(text, color);
pfunCDWriteText_SetColor(text, color);
}
}

bool CTopLevelWindow::TreatAsActiveWindow()
Expand Down
5 changes: 3 additions & 2 deletions DWMBlurGlassExt/DWMBlurGlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ namespace MDWMBlurGlassExt
GetCurrentProcessId(),
fileHandle.get(),
static_cast<MINIDUMP_TYPE>(
MINIDUMP_TYPE::MiniDumpNormal |
MINIDUMP_TYPE::MiniDumpWithThreadInfo |
MINIDUMP_TYPE::MiniDumpWithFullMemory |
MINIDUMP_TYPE::MiniDumpWithUnloadedModules
MINIDUMP_TYPE::MiniDumpWithUnloadedModules |
MINIDUMP_TYPE::MiniDumpWithProcessThreadData
),
&minidumpExceptionInfo,
nullptr,
Expand Down
Binary file modified DWMBlurGlassExt/DWMBlurGlassExt.rc
Binary file not shown.
20 changes: 14 additions & 6 deletions DWMBlurGlassExt/Section/CustomButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "../DWMBlurGlass.h"
#include "../Backdrops/ButtonGlowBackdrop.hpp"
#include <shellscalingapi.h>
#include <mutex>
#pragma comment(lib, "shcore.lib")

namespace MDWMBlurGlassExt::CustomButton
Expand All @@ -34,12 +35,13 @@ namespace MDWMBlurGlassExt::CustomButton
};
thread_local std::unordered_map<CTopLevelWindow*, buttonData> g_cbuttonList;
std::unordered_map<CTopLevelWindow*, com_ptr<CButtonGlowBackdrop>> g_glowbackdropMap{};
std::mutex g_dslock;

inline auto FindWindowFromButton(CButton* btn)
{
for(auto wnditer = g_cbuttonList.begin(); wnditer != g_cbuttonList.end(); ++wnditer)
for (auto wnditer = g_cbuttonList.begin(); wnditer != g_cbuttonList.end(); ++wnditer)
{
if(auto iter = wnditer->second.buttonList.find(btn); iter != wnditer->second.buttonList.end())
if (auto iter = wnditer->second.buttonList.find(btn); iter != wnditer->second.buttonList.end())
return wnditer;
}
return g_cbuttonList.end();
Expand Down Expand Up @@ -123,7 +125,7 @@ namespace MDWMBlurGlassExt::CustomButton
&& (
(g_configData.blurmethod != blurMethod::DWMAPIBlur && g_configData.oldBtnHeight)
|| (g_configData.blurmethod == blurMethod::CustomBlur && g_configData.titlebtnGlow)
))
))
Attach();
else if (g_startup
&& ((!g_configData.oldBtnHeight && !g_configData.titlebtnGlow) || g_configData.blurmethod == blurMethod::DWMAPIBlur)
Expand Down Expand Up @@ -200,7 +202,7 @@ namespace MDWMBlurGlassExt::CustomButton
if (scale != 1.f)
borderW -= (int)ceil(1.1f * scale);

if(os::buildNumber < 22000 && borderW <= 0)
if (os::buildNumber < 22000 && borderW <= 0)
{
borderW = 6;
if (IsZoomed(g_window))
Expand Down Expand Up @@ -279,8 +281,11 @@ namespace MDWMBlurGlassExt::CustomButton
{
RemoveGlow(This);
}
std::lock_guard lock{ g_dslock };
if (auto iter = g_cbuttonList.find(This); iter != g_cbuttonList.end())
{
g_cbuttonList.erase(iter);
}
}

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

std::lock_guard lock{ g_dslock };
auto iter = FindWindowFromButton(This);
if (iter == g_cbuttonList.end())
return hr;

auto cwnd = iter->first;

RECT rect;
iter->first->GetActualWindowRect(&rect, 0, 0, false);
cwnd->GetActualWindowRect(&rect, 0, 0, false);
auto monitor = MonitorFromPoint({ max(0, rect.left), max(0, rect.top) }, 0);
UINT dpi = 96;
GetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &dpi, &dpi);
const float scale = (float)dpi / 96.f;

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

Expand Down
2 changes: 1 addition & 1 deletion DWMBlurGlassExt/Section/OcclusionCulling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ namespace MDWMBlurGlassExt::OcclusionCulling

if (os::buildNumber < 22000)
{
g_funCOcclusionContext_PostSubgraph.Attach();
g_funCVisual_GetWindowBackgroundTreatmentInternal.Attach();
g_funCArrayBasedCoverageSet_AddAntiOccluderRect.Attach();
g_funCArrayBasedCoverageSet_IsCovered.Attach();
g_funCOcclusionContext_PostSubgraph.Attach();
}
}

Expand Down
8 changes: 7 additions & 1 deletion DWMBlurGlassExt/Section/TitleTextTweaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,13 @@ namespace MDWMBlurGlassExt::TitleTextTweaker

HRESULT CTopLevelWindow_UpdateText(CTopLevelWindow* This, CTopLevelWindow::WindowFrame* a2, double a3)
{
if (a2 && (*((BYTE*)This + 624) & 8) != 0)
BYTE flag = 0;
if(os::buildNumber < 26100)
flag = (*((BYTE*)This + 624) & 8);
else
flag = (*((BYTE*)This + 584) & 8);

if (a2 && flag != 0)
{
auto ret = g_funCTopLevelWindow_UpdateText.call_org(This, a2, a3);

Expand Down

0 comments on commit 38f2bdb

Please sign in to comment.