Skip to content

Commit

Permalink
Expose InMoveSize from WindowMoveHandler. (#3525)
Browse files Browse the repository at this point in the history
  • Loading branch information
vldmr11080 committed May 22, 2020
1 parent c7fb1f6 commit 1792849
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
15 changes: 7 additions & 8 deletions src/modules/fancyzones/lib/FancyZones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ struct FancyZones : public winrt::implements<FancyZones, IFancyZones, IFancyZone
IFACEMETHODIMP_(void)
Destroy() noexcept;

// IFancyZonesCallback
IFACEMETHODIMP_(bool)
InMoveSize() noexcept
{
std::shared_lock readLock(m_lock);
return m_windowMoveHandler.InMoveSize();
}

void MoveSizeStart(HWND window, HMONITOR monitor, POINT const& ptScreen) noexcept
{
std::unique_lock writeLock(m_lock);
Expand Down Expand Up @@ -185,6 +177,13 @@ struct FancyZones : public winrt::implements<FancyZones, IFancyZones, IFancyZone
return m_settings->GetSettings()->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;
Expand Down
6 changes: 5 additions & 1 deletion src/modules/fancyzones/lib/FancyZones.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<IFancyZones> MakeFancyZones(HINSTANCE hinstance, const winrt::com_ptr<IFancyZonesSettings>& settings) noexcept;
2 changes: 1 addition & 1 deletion src/modules/fancyzones/lib/ZoneWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
5 changes: 5 additions & 0 deletions src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ namespace FancyZonesUnitTests
{
return true;
}
IFACEMETHODIMP_(bool)
InMoveSize() noexcept
{
return true;
}

IZoneWindow* m_zoneWindow;
};
Expand Down

0 comments on commit 1792849

Please sign in to comment.