[FancyZones] Window switch shortcut fix (#21426)

* rename Layout -> LayoutData

* simplify zone

* split ZoneSet: Layout

* refactoring

* split ZoneSet: LayoutWindows

* update trace

* split ZoneSet: remove ZoneSet

* fix initialization

* split unit tests

* remove unused

* warning

* nullptr  check

* use current rect

* update work area tests

* use current rect

* simplify

* more meaningful name

* dismiss

* safety checks

* resolve conflicts

* reassign windows after switching vd

* avoid double-processing for window on switching vd

* extend windows fix

* check if window is on current desktop before cycling

* separated extend

* not reinit layout windows
This commit is contained in:
Seraphima Zykova
2022-10-31 13:44:25 +02:00
committed by GitHub
parent 6431ccd370
commit ff290eef9d
43 changed files with 2194 additions and 2242 deletions

View File

@@ -1,7 +1,8 @@
#pragma once
#include <FancyZonesLib/FancyZonesDataTypes.h>
#include <FancyZonesLib/ZoneSet.h>
#include <FancyZonesLib/Layout.h>
#include <FancyZonesLib/LayoutAssignedWindows.h>
#include <FancyZonesLib/util.h>
class ZonesOverlay;
@@ -55,13 +56,14 @@ public:
}
FancyZonesDataTypes::WorkAreaId UniqueId() const noexcept { return { m_uniqueId }; }
IZoneSet* ZoneSet() const noexcept { return m_zoneSet.get(); }
const std::unique_ptr<Layout>& GetLayout() const noexcept { return m_layout; }
const std::unique_ptr<LayoutAssignedWindows>& GetLayoutWindows() const noexcept { return m_layoutWindows; }
ZoneIndexSet GetWindowZoneIndexes(HWND window) const noexcept;
HRESULT MoveSizeEnter(HWND window) noexcept;
HRESULT MoveSizeUpdate(POINT const& ptScreen, bool dragEnabled, bool selectManyZones) noexcept;
HRESULT MoveSizeEnd(HWND window, POINT const& ptScreen) noexcept;
HRESULT MoveSizeEnd(HWND window) noexcept;
void MoveWindowIntoZoneByIndex(HWND window, ZoneIndex index) noexcept;
void MoveWindowIntoZoneByIndexSet(HWND window, const ZoneIndexSet& indexSet) noexcept;
bool MoveWindowIntoZoneByDirectionAndIndex(HWND window, DWORD vkCode, bool cycle) noexcept;
@@ -76,7 +78,7 @@ public:
void FlashZones() noexcept;
void ClearSelectedZones() noexcept;
void CycleTabs(HWND window, bool reverse) noexcept;
void CycleWindows(HWND window, bool reverse) noexcept;
void LogInitializationError();
@@ -86,8 +88,7 @@ protected:
private:
bool InitWindow(HINSTANCE hinstance) noexcept;
void InitLayout(const FancyZonesDataTypes::WorkAreaId& parentUniqueId) noexcept;
void CalculateZoneSet(OverlappingZonesAlgorithm overlappingAlgorithm) noexcept;
void UpdateActiveZoneSet(_In_opt_ IZoneSet* zoneSet) noexcept;
void CalculateZoneSet() noexcept;
LRESULT WndProc(UINT message, WPARAM wparam, LPARAM lparam) noexcept;
ZoneIndexSet ZonesFromPoint(POINT pt) noexcept;
void SetAsTopmostWindow() noexcept;
@@ -97,7 +98,8 @@ private:
const FancyZonesDataTypes::WorkAreaId m_uniqueId;
HWND m_window{}; // Hidden tool window used to represent current monitor desktop work area.
HWND m_windowMoveSize{};
winrt::com_ptr<IZoneSet> m_zoneSet;
std::unique_ptr<Layout> m_layout;
std::unique_ptr<LayoutAssignedWindows> m_layoutWindows;
ZoneIndexSet m_initialHighlightZone;
ZoneIndexSet m_highlightZone;
WPARAM m_keyLast{};