mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
[AlwaysOnTop] Corners scaling (#20352)
This commit is contained in:
@@ -20,9 +20,9 @@ enum DWM_WINDOW_CORNER_PREFERENCE
|
||||
DWMWCP_ROUNDSMALL = 3
|
||||
};
|
||||
|
||||
bool WindowBordersUtils::AreCornersRounded(HWND window) noexcept
|
||||
int WindowCornerUtils::CornerPreference(HWND window) noexcept
|
||||
{
|
||||
int cornerPreference = DWMWCP_DEFAULT;
|
||||
int cornerPreference = -1;
|
||||
auto res = DwmGetWindowAttribute(window, DWMWA_WINDOW_CORNER_PREFERENCE, &cornerPreference, sizeof(cornerPreference));
|
||||
if (res != S_OK)
|
||||
{
|
||||
@@ -31,9 +31,24 @@ bool WindowBordersUtils::AreCornersRounded(HWND window) noexcept
|
||||
{
|
||||
Logger::error(L"Get corner preference error: {}", get_last_error_or_default(res));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return cornerPreference != DWM_WINDOW_CORNER_PREFERENCE::DWMWCP_DONOTROUND;
|
||||
return cornerPreference;
|
||||
}
|
||||
|
||||
int WindowCornerUtils::CornersRadius(HWND window) noexcept
|
||||
{
|
||||
int cornerPreference = CornerPreference(window);
|
||||
|
||||
switch (cornerPreference)
|
||||
{
|
||||
case DWM_WINDOW_CORNER_PREFERENCE::DWMWCP_ROUND:
|
||||
return 8;
|
||||
case DWM_WINDOW_CORNER_PREFERENCE::DWMWCP_ROUNDSMALL:
|
||||
return 4;
|
||||
case DWM_WINDOW_CORNER_PREFERENCE::DWMWCP_DEFAULT:
|
||||
return 8;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user