Skip to content

Commit

Permalink
24h2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ALTaleX531 committed Nov 2, 2024
1 parent d8a837b commit eea513b
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 23 deletions.
30 changes: 28 additions & 2 deletions OpenGlass/GlassFramework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,22 @@ HRESULT STDMETHODCALLTYPE GlassFramework::MyCTopLevelWindow_UpdateNCAreaBackgrou
oldSystemBackdropType = *reinterpret_cast<DWORD*>(reinterpret_cast<ULONG_PTR>(data) + 204);
*reinterpret_cast<DWORD*>(reinterpret_cast<ULONG_PTR>(data) + 204) = 0;
}
if (os::buildNumber >= os::build_w11_24h2)
{
oldSystemBackdropType = reinterpret_cast<DWORD*>(data)[200];
reinterpret_cast<DWORD*>(data)[200] = 0;
}

hr = g_CTopLevelWindow_UpdateNCAreaBackground_Org(This);

if (os::buildNumber == os::build_w11_21h2)
{
*reinterpret_cast<DWORD*>(reinterpret_cast<ULONG_PTR>(data) + 204) = oldSystemBackdropType;
}
if (os::buildNumber >= os::build_w11_24h2)
{
reinterpret_cast<DWORD*>(data)[200] = oldSystemBackdropType;
}

if (SUCCEEDED(hr))
{
Expand Down Expand Up @@ -426,8 +435,25 @@ void STDMETHODCALLTYPE GlassFramework::MyCTopLevelWindow_Destructor(uDwm::CTopLe
// thumbnail/aero peek
HRESULT STDMETHODCALLTYPE GlassFramework::MyCTopLevelWindow_InitializeVisualTreeClone(uDwm::CTopLevelWindow* This, uDwm::CTopLevelWindow* window, UINT cloneOptions)
{
auto data{ This->GetData() };
if (!data)
{
return g_CTopLevelWindow_InitializeVisualTreeClone_Org(This, window, cloneOptions);
}

DWORD oldSystemBackdropType{ 0 };
if (os::buildNumber >= os::build_w11_24h2)
{
oldSystemBackdropType = reinterpret_cast<DWORD*>(data)[200];
reinterpret_cast<DWORD*>(data)[200] = 0;
}

HRESULT hr{ g_CTopLevelWindow_InitializeVisualTreeClone_Org(This, window, cloneOptions) };


if (os::buildNumber == os::build_w11_21h2)
{
*reinterpret_cast<DWORD*>(reinterpret_cast<ULONG_PTR>(data) + 204) = oldSystemBackdropType;
}
if (SUCCEEDED(hr))
{
BackdropManager::TryClone(This, window);
Expand Down Expand Up @@ -506,7 +532,7 @@ HRESULT STDMETHODCALLTYPE GlassFramework::MyCWindowList_UpdateAccentBlurRect(uDw
uDwm::CWindowData* data{ nullptr };
uDwm::CTopLevelWindow* window{ nullptr };
auto lock{ wil::EnterCriticalSection(uDwm::CDesktopManager::s_csDwmInstance) };
if (SUCCEEDED(hr) && SUCCEEDED(This->GetSyncedWindowDataByHwnd(milCmd->GetHwnd(), &data)) && data && (window = data->GetWindow()))
if (SUCCEEDED(hr) && SUCCEEDED(hr = This->GetSyncedWindowDataByHwnd(milCmd->GetHwnd(), &data)) && data && (window = data->GetWindow()))
{
auto kind{ static_cast<BackdropManager::CompositedBackdropKind>(GetActualBackdropKind(window)) };
auto lprc{ milCmd->GetRect() };
Expand Down
3 changes: 2 additions & 1 deletion OpenGlass/OSHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,9 @@ namespace OpenGlass::os
constexpr ULONG build_w11_21h2{ 22000 };
constexpr ULONG build_w11_22h2{ 22621 };
constexpr ULONG build_w11_23h2{ 22635 };
constexpr ULONG build_w11_24h2{ 26100 };
constexpr ULONG build_openglass_minimum_support{ build_w10_1809 };
constexpr ULONG build_openglass_maximum_support{ build_w11_23h2 };
constexpr ULONG build_openglass_maximum_support{ build_w11_24h2 };

FORCEINLINE bool IsOpenGlassUnsupported()
{
Expand Down
Loading

0 comments on commit eea513b

Please sign in to comment.