From 1792849b981016f13493c800fddbd31588c60bbb Mon Sep 17 00:00:00 2001 From: vldmr11080 <57061786+vldmr11080@users.noreply.github.com> Date: Fri, 22 May 2020 16:42:29 +0200 Subject: [PATCH] Expose InMoveSize from WindowMoveHandler. (#3525) --- src/modules/fancyzones/lib/FancyZones.cpp | 15 +++++++-------- src/modules/fancyzones/lib/FancyZones.h | 6 +++++- src/modules/fancyzones/lib/ZoneWindow.cpp | 2 +- .../tests/UnitTests/ZoneWindow.Spec.cpp | 5 +++++ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/modules/fancyzones/lib/FancyZones.cpp b/src/modules/fancyzones/lib/FancyZones.cpp index 883017257f09..d1445bee58f2 100644 --- a/src/modules/fancyzones/lib/FancyZones.cpp +++ b/src/modules/fancyzones/lib/FancyZones.cpp @@ -55,14 +55,6 @@ struct FancyZones : public winrt::implementsGetSettings()->makeDraggedWindowTransparent; } + IFACEMETHODIMP_(bool) + InMoveSize() noexcept + { + std::shared_lock readLock(m_lock); + return m_windowMoveHandler.InMoveSize(); + } + LRESULT WndProc(HWND, UINT, WPARAM, LPARAM) noexcept; void OnDisplayChange(DisplayChangeType changeType) noexcept; void AddZoneWindow(HMONITOR monitor, PCWSTR deviceId) noexcept; diff --git a/src/modules/fancyzones/lib/FancyZones.h b/src/modules/fancyzones/lib/FancyZones.h index 698cd2af8cdf..26ccb5c32a89 100644 --- a/src/modules/fancyzones/lib/FancyZones.h +++ b/src/modules/fancyzones/lib/FancyZones.h @@ -81,9 +81,13 @@ interface __declspec(uuid("{5C8D99D6-34B2-4F4A-A8E5-7483F6869775}")) IZoneWindow */ IFACEMETHOD_(int, GetZoneHighlightOpacity)() = 0; /** - * @returns Bool indicating if dragged window should be transparrent + * @returns Boolean indicating if dragged window should be transparrent. */ IFACEMETHOD_(bool, isMakeDraggedWindowTransparentActive) () = 0; + /** + * @returns Boolean indicating if move/size operation is currently active. + */ + IFACEMETHOD_(bool, InMoveSize) () = 0; }; winrt::com_ptr MakeFancyZones(HINSTANCE hinstance, const winrt::com_ptr& settings) noexcept; diff --git a/src/modules/fancyzones/lib/ZoneWindow.cpp b/src/modules/fancyzones/lib/ZoneWindow.cpp index 060dc6ae867a..61a00577c6be 100644 --- a/src/modules/fancyzones/lib/ZoneWindow.cpp +++ b/src/modules/fancyzones/lib/ZoneWindow.cpp @@ -522,7 +522,7 @@ ZoneWindow::ShowZoneWindow() noexcept std::thread{ [=]() { AnimateWindow(window, m_showAnimationDuration, AW_BLEND); InvalidateRect(window, nullptr, true); - if (m_windowMoveSize == nullptr) + if (!m_host->InMoveSize()) { HideZoneWindow(); } diff --git a/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp b/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp index e0f3ccca09c2..7d845b82c9e1 100644 --- a/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp +++ b/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp @@ -47,6 +47,11 @@ namespace FancyZonesUnitTests { return true; } + IFACEMETHODIMP_(bool) + InMoveSize() noexcept + { + return true; + } IZoneWindow* m_zoneWindow; };