Skip to content

Commit

Permalink
fix: should not call "rounding cancel" dwm api for versions before 22000
Browse files Browse the repository at this point in the history
  • Loading branch information
seven-mile committed Sep 5, 2023
1 parent 53260ee commit b635e16
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions dcomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,23 @@ CreateCompositorForWindow(HWND hWnd) {
wData.cbData = sizeof(BOOL);
winrt::check_bool(lSetWindowCompositionAttribute(hWnd, &wData));

BOOL disable = FALSE;
winrt::check_hresult(DwmSetWindowAttribute(hWnd, DWMWA_WINDOW_CORNER_PREFERENCE, &disable, sizeof(disable)));
// if > 22000, then disable corner rounding
OSVERSIONINFOEX info{
.dwMajorVersion = 10,
.dwMinorVersion = 0,
.dwBuildNumber = 22000,
};
DWORDLONG dwlConditionMask = 0;
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_BUILDNUMBER, VER_GREATER_EQUAL);
if (VerifyVersionInfo(&info,
VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER,
dwlConditionMask)) {
BOOL disable = FALSE;
winrt::check_hresult(DwmSetWindowAttribute(
hWnd, DWMWA_WINDOW_CORNER_PREFERENCE, &disable, sizeof(disable)));
}

return {compositor, rootVisual};
}
Expand Down

0 comments on commit b635e16

Please sign in to comment.