mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
[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:
36
src/modules/fancyzones/FancyZonesLib/LayoutAssignedWindows.h
Normal file
36
src/modules/fancyzones/FancyZonesLib/LayoutAssignedWindows.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <FancyZonesLib/Zone.h>
|
||||
|
||||
class LayoutAssignedWindows
|
||||
{
|
||||
public:
|
||||
struct ExtendWindowModeData
|
||||
{
|
||||
std::map<HWND, ZoneIndexSet> windowInitialIndexSet;
|
||||
std::map<HWND, ZoneIndex> windowFinalIndex;
|
||||
};
|
||||
|
||||
public :
|
||||
LayoutAssignedWindows();
|
||||
~LayoutAssignedWindows() = default;
|
||||
|
||||
void Assign(HWND window, const ZoneIndexSet& zones);
|
||||
void Extend(HWND window, const ZoneIndexSet& zones);
|
||||
void Dismiss(HWND window);
|
||||
|
||||
ZoneIndexSet GetZoneIndexSetFromWindow(HWND window) const noexcept;
|
||||
bool IsZoneEmpty(ZoneIndex zoneIndex) const noexcept;
|
||||
|
||||
void CycleWindows(HWND window, bool reverse);
|
||||
|
||||
const std::unique_ptr<ExtendWindowModeData>& ExtendWindowData();
|
||||
|
||||
private:
|
||||
std::map<HWND, ZoneIndexSet> m_windowIndexSet{};
|
||||
std::map<ZoneIndexSet, std::vector<HWND>> m_windowsByIndexSets{};
|
||||
std::unique_ptr<ExtendWindowModeData> m_extendData{}; // Needed for ExtendWindowByDirectionAndPosition
|
||||
|
||||
void InsertWindowIntoZone(HWND window, std::optional<size_t> tabSortKeyWithinZone, const ZoneIndexSet& indexSet);
|
||||
HWND GetNextZoneWindow(ZoneIndexSet indexSet, HWND current, bool reverse) noexcept;
|
||||
};
|
||||
Reference in New Issue
Block a user