mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
FZ: run AnimateWindow and InvalidateRect in a dedicated thread (#2582)
This commit is contained in:
@@ -499,23 +499,28 @@ ZoneWindow::SaveWindowProcessToZoneIndex(HWND window) noexcept
|
||||
IFACEMETHODIMP_(void)
|
||||
ZoneWindow::ShowZoneWindow() noexcept
|
||||
{
|
||||
if (m_window)
|
||||
auto window = m_window.get();
|
||||
if (!window)
|
||||
{
|
||||
m_flashMode = false;
|
||||
|
||||
UINT flags = SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE;
|
||||
|
||||
HWND windowInsertAfter = m_windowMoveSize;
|
||||
if (windowInsertAfter == nullptr)
|
||||
{
|
||||
windowInsertAfter = HWND_TOPMOST;
|
||||
}
|
||||
|
||||
SetWindowPos(m_window.get(), windowInsertAfter, 0, 0, 0, 0, flags);
|
||||
|
||||
AnimateWindow(m_window.get(), m_showAnimationDuration, AW_BLEND);
|
||||
InvalidateRect(m_window.get(), nullptr, true);
|
||||
return;
|
||||
}
|
||||
|
||||
m_flashMode = false;
|
||||
|
||||
UINT flags = SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE;
|
||||
|
||||
HWND windowInsertAfter = m_windowMoveSize;
|
||||
if (windowInsertAfter == nullptr)
|
||||
{
|
||||
windowInsertAfter = HWND_TOPMOST;
|
||||
}
|
||||
|
||||
SetWindowPos(window, windowInsertAfter, 0, 0, 0, 0, flags);
|
||||
|
||||
std::thread{ [=]() {
|
||||
AnimateWindow(window, m_showAnimationDuration, AW_BLEND);
|
||||
InvalidateRect(window, nullptr, true);
|
||||
} }.detach();
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
|
||||
Reference in New Issue
Block a user