mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 10:16:24 +02:00
[FancyZones][Hotfix]Opacity reset fix (#23818)
This commit is contained in:
@@ -213,22 +213,30 @@ void WindowDrag::SetWindowTransparency()
|
||||
if (!SetLayeredWindowAttributes(m_window, 0, (255 * 50) / 100, LWA_ALPHA))
|
||||
{
|
||||
Logger::error(L"Window transparency: SetLayeredWindowAttributes failed, {}", get_last_error_or_default(GetLastError()));
|
||||
return;
|
||||
}
|
||||
|
||||
m_windowProperties.transparencySet = true;
|
||||
}
|
||||
}
|
||||
|
||||
void WindowDrag::ResetWindowTransparency()
|
||||
{
|
||||
if (FancyZonesSettings::settings().makeDraggedWindowTransparent)
|
||||
if (FancyZonesSettings::settings().makeDraggedWindowTransparent && m_windowProperties.transparencySet)
|
||||
{
|
||||
bool reset = true;
|
||||
if (!SetLayeredWindowAttributes(m_window, m_windowProperties.crKey, m_windowProperties.alpha, m_windowProperties.dwFlags))
|
||||
{
|
||||
Logger::error(L"Window transparency: SetLayeredWindowAttributes failed");
|
||||
Logger::error(L"Window transparency: SetLayeredWindowAttributes failed, {}", get_last_error_or_default(GetLastError()));
|
||||
reset = false;
|
||||
}
|
||||
|
||||
if (SetWindowLong(m_window, GWL_EXSTYLE, m_windowProperties.exstyle) == 0)
|
||||
{
|
||||
Logger::error(L"Window transparency: SetWindowLong failed, {}", get_last_error_or_default(GetLastError()));
|
||||
reset = false;
|
||||
}
|
||||
|
||||
m_windowProperties.transparencySet = !reset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ private:
|
||||
COLORREF crKey = RGB(0, 0, 0);
|
||||
DWORD dwFlags = 0;
|
||||
BYTE alpha = 0;
|
||||
bool transparencySet{false};
|
||||
};
|
||||
|
||||
const HWND m_window;
|
||||
|
||||
Reference in New Issue
Block a user