mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-20 16:03:17 +08:00
[FancyZones] Zone indexes type change (#12724)
This commit is contained in:
parent
7278d62307
commit
7ea1f26209
@ -11,6 +11,7 @@
|
||||
#include <common/SettingsAPI/FileWatcher.h>
|
||||
|
||||
#include <FancyZonesLib/FancyZonesData.h>
|
||||
#include <FancyZonesLib/FancyZonesWindowProperties.h>
|
||||
#include <FancyZonesLib/FancyZonesWinHookEventIDs.h>
|
||||
#include <FancyZonesLib/MonitorUtils.h>
|
||||
#include <FancyZonesLib/Settings.h>
|
||||
@ -156,8 +157,8 @@ private:
|
||||
|
||||
void OnSettingsChanged() noexcept;
|
||||
|
||||
std::pair<winrt::com_ptr<IWorkArea>, std::vector<size_t>> GetAppZoneHistoryInfo(HWND window, HMONITOR monitor, bool isPrimaryMonitor) noexcept;
|
||||
void MoveWindowIntoZone(HWND window, winrt::com_ptr<IWorkArea> zoneWindow, const std::vector<size_t>& zoneIndexSet) noexcept;
|
||||
std::pair<winrt::com_ptr<IWorkArea>, ZoneIndexSet> GetAppZoneHistoryInfo(HWND window, HMONITOR monitor, bool isPrimaryMonitor) noexcept;
|
||||
void MoveWindowIntoZone(HWND window, winrt::com_ptr<IWorkArea> zoneWindow, const ZoneIndexSet& zoneIndexSet) noexcept;
|
||||
|
||||
void OnEditorExitEvent() noexcept;
|
||||
void UpdateZoneSets() noexcept;
|
||||
@ -265,9 +266,9 @@ FancyZones::VirtualDesktopChanged() noexcept
|
||||
PostMessage(m_window, WM_PRIV_VD_SWITCH, 0, 0);
|
||||
}
|
||||
|
||||
std::pair<winrt::com_ptr<IWorkArea>, std::vector<size_t>> FancyZones::GetAppZoneHistoryInfo(HWND window, HMONITOR monitor, bool isPrimaryMonitor) noexcept
|
||||
std::pair<winrt::com_ptr<IWorkArea>, ZoneIndexSet> FancyZones::GetAppZoneHistoryInfo(HWND window, HMONITOR monitor, bool isPrimaryMonitor) noexcept
|
||||
{
|
||||
std::pair<winrt::com_ptr<IWorkArea>, std::vector<size_t>> appZoneHistoryInfo{ nullptr, {} };
|
||||
std::pair<winrt::com_ptr<IWorkArea>, ZoneIndexSet> appZoneHistoryInfo{ nullptr, {} };
|
||||
auto workAreaMap = m_workAreaHandler.GetWorkAreasByDesktopId(m_currentDesktopId);
|
||||
if (workAreaMap.empty())
|
||||
{
|
||||
@ -301,7 +302,7 @@ std::pair<winrt::com_ptr<IWorkArea>, std::vector<size_t>> FancyZones::GetAppZone
|
||||
return appZoneHistoryInfo;
|
||||
}
|
||||
|
||||
void FancyZones::MoveWindowIntoZone(HWND window, winrt::com_ptr<IWorkArea> zoneWindow, const std::vector<size_t>& zoneIndexSet) noexcept
|
||||
void FancyZones::MoveWindowIntoZone(HWND window, winrt::com_ptr<IWorkArea> zoneWindow, const ZoneIndexSet& zoneIndexSet) noexcept
|
||||
{
|
||||
_TRACER_;
|
||||
auto& fancyZonesData = FancyZonesDataInstance();
|
||||
@ -328,7 +329,7 @@ void FancyZones::WindowCreated(HWND window) noexcept
|
||||
// Avoid processing splash screens, already stamped (zoned) windows, or those windows
|
||||
// that belong to excluded applications list.
|
||||
const bool isSplashScreen = FancyZonesUtils::IsSplashScreen(window);
|
||||
const bool isZoned = reinterpret_cast<size_t>(::GetProp(window, ZonedWindowProperties::PropertyMultipleZoneID)) != 0;
|
||||
const bool isZoned = reinterpret_cast<ZoneIndex>(::GetProp(window, ZonedWindowProperties::PropertyMultipleZoneID)) != 0;
|
||||
const bool isCandidateForLastKnownZone = FancyZonesUtils::IsCandidateForLastKnownZone(window, m_settings->GetSettings()->excludedAppsArray);
|
||||
const bool shouldProcessNewWindow = !isSplashScreen && !isZoned && isCandidateForLastKnownZone;
|
||||
|
||||
@ -347,7 +348,7 @@ void FancyZones::WindowCreated(HWND window) noexcept
|
||||
if (moveToAppLastZone)
|
||||
{
|
||||
const bool primaryActive = (primary == active);
|
||||
std::pair<winrt::com_ptr<IWorkArea>, std::vector<size_t>> appZoneHistoryInfo = GetAppZoneHistoryInfo(window, active, primaryActive);
|
||||
std::pair<winrt::com_ptr<IWorkArea>, ZoneIndexSet> appZoneHistoryInfo = GetAppZoneHistoryInfo(window, active, primaryActive);
|
||||
|
||||
if (!appZoneHistoryInfo.second.empty())
|
||||
{
|
||||
@ -828,31 +829,18 @@ void FancyZones::UpdateZoneWindows() noexcept
|
||||
void FancyZones::UpdateWindowsPositions() noexcept
|
||||
{
|
||||
auto callback = [](HWND window, LPARAM data) -> BOOL {
|
||||
size_t bitmask = reinterpret_cast<size_t>(::GetProp(window, ZonedWindowProperties::PropertyMultipleZoneID));
|
||||
|
||||
if (bitmask != 0)
|
||||
auto zoneIndexSet = GetZoneIndexSet(window);
|
||||
auto strongThis = reinterpret_cast<FancyZones*>(data);
|
||||
auto desktopId = strongThis->m_virtualDesktop.GetWindowDesktopId(window);
|
||||
if (desktopId.has_value())
|
||||
{
|
||||
std::vector<size_t> indexSet;
|
||||
for (int i = 0; i < std::numeric_limits<size_t>::digits; i++)
|
||||
auto zoneWindow = strongThis->m_workAreaHandler.GetWorkArea(window, *desktopId);
|
||||
if (zoneWindow)
|
||||
{
|
||||
if ((1ull << i) & bitmask)
|
||||
{
|
||||
indexSet.push_back(i);
|
||||
}
|
||||
strongThis->m_windowMoveHandler.MoveWindowIntoZoneByIndexSet(window, zoneIndexSet, zoneWindow);
|
||||
}
|
||||
|
||||
auto strongThis = reinterpret_cast<FancyZones*>(data);
|
||||
auto desktopId = strongThis->m_virtualDesktop.GetWindowDesktopId(window);
|
||||
if (desktopId.has_value())
|
||||
{
|
||||
auto zoneWindow = strongThis->m_workAreaHandler.GetWorkArea(window, *desktopId);
|
||||
if (zoneWindow)
|
||||
{
|
||||
strongThis->m_windowMoveHandler.MoveWindowIntoZoneByIndexSet(window, indexSet, zoneWindow);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
};
|
||||
EnumWindows(callback, reinterpret_cast<LPARAM>(this));
|
||||
@ -933,7 +921,7 @@ bool FancyZones::OnSnapHotkeyBasedOnPosition(HWND window, DWORD vkCode) noexcept
|
||||
|
||||
// If that didn't work, extract zones from all other monitors and target one of them
|
||||
std::vector<RECT> zoneRects;
|
||||
std::vector<std::pair<size_t, winrt::com_ptr<IWorkArea>>> zoneRectsInfo;
|
||||
std::vector<std::pair<ZoneIndex, winrt::com_ptr<IWorkArea>>> zoneRectsInfo;
|
||||
RECT currentMonitorRect{ .top = 0, .bottom = -1 };
|
||||
|
||||
for (const auto& [monitor, monitorRect] : allMonitors)
|
||||
@ -975,7 +963,7 @@ bool FancyZones::OnSnapHotkeyBasedOnPosition(HWND window, DWORD vkCode) noexcept
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t chosenIdx = FancyZonesUtils::ChooseNextZoneByPosition(vkCode, windowRect, zoneRects);
|
||||
auto chosenIdx = FancyZonesUtils::ChooseNextZoneByPosition(vkCode, windowRect, zoneRects);
|
||||
|
||||
if (chosenIdx < zoneRects.size())
|
||||
{
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <common/Display/dpi_aware.h>
|
||||
#include <common/utils/json.h>
|
||||
#include <FancyZonesLib/util.h>
|
||||
#include <FancyZonesLib/FancyZonesWindowProperties.h>
|
||||
|
||||
#include <shlwapi.h>
|
||||
#include <filesystem>
|
||||
@ -375,7 +376,7 @@ void FancyZonesData::UpdateProcessIdToHandleMap(HWND window, const std::wstring_
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<size_t> FancyZonesData::GetAppLastZoneIndexSet(HWND window, const std::wstring_view& deviceId, const std::wstring_view& zoneSetId) const
|
||||
ZoneIndexSet FancyZonesData::GetAppLastZoneIndexSet(HWND window, const std::wstring_view& deviceId, const std::wstring_view& zoneSetId) const
|
||||
{
|
||||
std::scoped_lock lock{ dataLock };
|
||||
auto processPath = get_process_path(window);
|
||||
@ -422,10 +423,10 @@ bool FancyZonesData::RemoveAppLastZone(HWND window, const std::wstring_view& dev
|
||||
}
|
||||
|
||||
// if there is another instance of same application placed in the same zone don't erase history
|
||||
size_t windowZoneStamp = reinterpret_cast<size_t>(::GetProp(window, ZonedWindowProperties::PropertyMultipleZoneID));
|
||||
ZoneIndex windowZoneStamp = reinterpret_cast<ZoneIndex>(::GetProp(window, ZonedWindowProperties::PropertyMultipleZoneID));
|
||||
for (auto placedWindow : data->processIdToHandleMap)
|
||||
{
|
||||
size_t placedWindowZoneStamp = reinterpret_cast<size_t>(::GetProp(placedWindow.second, ZonedWindowProperties::PropertyMultipleZoneID));
|
||||
ZoneIndex placedWindowZoneStamp = reinterpret_cast<ZoneIndex>(::GetProp(placedWindow.second, ZonedWindowProperties::PropertyMultipleZoneID));
|
||||
if (IsWindow(placedWindow.second) && (windowZoneStamp == placedWindowZoneStamp))
|
||||
{
|
||||
return false;
|
||||
@ -451,7 +452,7 @@ bool FancyZonesData::RemoveAppLastZone(HWND window, const std::wstring_view& dev
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FancyZonesData::SetAppLastZones(HWND window, const std::wstring& deviceId, const std::wstring& zoneSetId, const std::vector<size_t>& zoneIndexSet)
|
||||
bool FancyZonesData::SetAppLastZones(HWND window, const std::wstring& deviceId, const std::wstring& zoneSetId, const ZoneIndexSet& zoneIndexSet)
|
||||
{
|
||||
_TRACER_;
|
||||
std::scoped_lock lock{ dataLock };
|
||||
|
@ -77,9 +77,9 @@ public:
|
||||
|
||||
bool IsAnotherWindowOfApplicationInstanceZoned(HWND window, const std::wstring_view& deviceId) const;
|
||||
void UpdateProcessIdToHandleMap(HWND window, const std::wstring_view& deviceId);
|
||||
std::vector<size_t> GetAppLastZoneIndexSet(HWND window, const std::wstring_view& deviceId, const std::wstring_view& zoneSetId) const;
|
||||
ZoneIndexSet GetAppLastZoneIndexSet(HWND window, const std::wstring_view& deviceId, const std::wstring_view& zoneSetId) const;
|
||||
bool RemoveAppLastZone(HWND window, const std::wstring_view& deviceId, const std::wstring_view& zoneSetId);
|
||||
bool SetAppLastZones(HWND window, const std::wstring& deviceId, const std::wstring& zoneSetId, const std::vector<size_t>& zoneIndexSet);
|
||||
bool SetAppLastZones(HWND window, const std::wstring& deviceId, const std::wstring& zoneSetId, const ZoneIndexSet& zoneIndexSet);
|
||||
|
||||
void SetActiveZoneSet(const std::wstring& deviceId, const FancyZonesDataTypes::ZoneSetData& zoneSet);
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include <windef.h>
|
||||
|
||||
#include <FancyZonesLib/Zone.h>
|
||||
|
||||
namespace FancyZonesDataTypes
|
||||
{
|
||||
enum class ZoneSetLayoutType : int
|
||||
@ -117,7 +119,7 @@ namespace FancyZonesDataTypes
|
||||
|
||||
std::wstring zoneSetUuid;
|
||||
std::wstring deviceId;
|
||||
std::vector<size_t> zoneIndexSet;
|
||||
ZoneIndexSet zoneIndexSet;
|
||||
};
|
||||
|
||||
struct DeviceIdData
|
||||
|
@ -56,6 +56,7 @@
|
||||
<ClInclude Include="util.h" />
|
||||
<ClInclude Include="VirtualDesktop.h" />
|
||||
<ClInclude Include="WindowMoveHandler.h" />
|
||||
<ClInclude Include="FancyZonesWindowProperties.h" />
|
||||
<ClInclude Include="Zone.h" />
|
||||
<ClInclude Include="ZoneColors.h" />
|
||||
<ClInclude Include="ZoneSet.h" />
|
||||
|
@ -87,6 +87,9 @@
|
||||
<ClInclude Include="ZoneColors.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FancyZonesWindowProperties.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp">
|
||||
|
@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <FancyZonesLib/Zone.h>
|
||||
|
||||
// Zoned window properties are not localized.
|
||||
namespace ZonedWindowProperties
|
||||
{
|
||||
const wchar_t PropertyMultipleZoneID[] = L"FancyZones_zones";
|
||||
const wchar_t PropertyRestoreSizeID[] = L"FancyZones_RestoreSize";
|
||||
const wchar_t PropertyRestoreOriginID[] = L"FancyZones_RestoreOrigin";
|
||||
|
||||
const wchar_t MultiMonitorDeviceID[] = L"FancyZones#MultiMonitorDevice";
|
||||
}
|
||||
|
||||
inline ZoneIndexSet GetZoneIndexSet(HWND window)
|
||||
{
|
||||
HANDLE handle = ::GetProp(window, ZonedWindowProperties::PropertyMultipleZoneID);
|
||||
ZoneIndexSet zoneIndexSet;
|
||||
|
||||
std::array<int, 2> data;
|
||||
memcpy(data.data(), &handle, sizeof data);
|
||||
uint64_t bitmask = ((uint64_t)data[0] << 32) + data[1];
|
||||
|
||||
if (bitmask != 0)
|
||||
{
|
||||
for (int i = 0; i < std::numeric_limits<ZoneIndex>::digits; i++)
|
||||
{
|
||||
if ((1ull << i) & bitmask)
|
||||
{
|
||||
zoneIndexSet.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return zoneIndexSet;
|
||||
}
|
||||
|
||||
inline void StampWindow(HWND window, Bitmask bitmask) noexcept
|
||||
{
|
||||
std::array<int, 2> data = { (bitmask >> 32), static_cast<int>(bitmask) };
|
||||
HANDLE rawData;
|
||||
memcpy(&rawData, data.data(), sizeof data);
|
||||
SetProp(window, ZonedWindowProperties::PropertyMultipleZoneID, rawData);
|
||||
}
|
@ -101,12 +101,12 @@ namespace
|
||||
data.zoneIndexSet = {};
|
||||
for (const auto& value : json.GetNamedArray(NonLocalizable::ZoneIndexSetStr))
|
||||
{
|
||||
data.zoneIndexSet.push_back(static_cast<size_t>(value.GetNumber()));
|
||||
data.zoneIndexSet.push_back(static_cast<ZoneIndex>(value.GetNumber()));
|
||||
}
|
||||
}
|
||||
else if (json.HasKey(NonLocalizable::ZoneIndexStr))
|
||||
{
|
||||
data.zoneIndexSet = { static_cast<size_t>(json.GetNamedNumber(NonLocalizable::ZoneIndexStr)) };
|
||||
data.zoneIndexSet = { static_cast<ZoneIndex>(json.GetNamedNumber(NonLocalizable::ZoneIndexStr)) };
|
||||
}
|
||||
|
||||
data.deviceId = json.GetNamedString(NonLocalizable::DeviceIdStr);
|
||||
@ -371,7 +371,7 @@ namespace JSONHelpers
|
||||
{
|
||||
json::JsonObject desktopData;
|
||||
json::JsonArray jsonIndexSet;
|
||||
for (size_t index : data.zoneIndexSet)
|
||||
for (ZoneIndex index : data.zoneIndexSet)
|
||||
{
|
||||
jsonIndexSet.Append(json::value(static_cast<int>(index)));
|
||||
}
|
||||
|
@ -2,16 +2,6 @@
|
||||
|
||||
#include <common/SettingsAPI/settings_objects.h>
|
||||
|
||||
// Zoned window properties are not localized.
|
||||
namespace ZonedWindowProperties
|
||||
{
|
||||
const wchar_t PropertyMultipleZoneID[] = L"FancyZones_zones";
|
||||
const wchar_t PropertyRestoreSizeID[] = L"FancyZones_RestoreSize";
|
||||
const wchar_t PropertyRestoreOriginID[] = L"FancyZones_RestoreOrigin";
|
||||
|
||||
const wchar_t MultiMonitorDeviceID[] = L"FancyZones#MultiMonitorDevice";
|
||||
}
|
||||
|
||||
enum struct OverlappingZonesAlgorithm : int
|
||||
{
|
||||
Smallest = 0,
|
||||
|
@ -273,7 +273,7 @@ void WindowMoveHandler::MoveSizeEnd(HWND window, POINT const& ptScreen, const st
|
||||
}
|
||||
}
|
||||
|
||||
void WindowMoveHandler::MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<size_t>& indexSet, winrt::com_ptr<IWorkArea> zoneWindow) noexcept
|
||||
void WindowMoveHandler::MoveWindowIntoZoneByIndexSet(HWND window, const ZoneIndexSet& indexSet, winrt::com_ptr<IWorkArea> zoneWindow) noexcept
|
||||
{
|
||||
if (window != m_windowMoveSize)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "FancyZonesWindowProperties.h"
|
||||
#include "KeyState.h"
|
||||
#include "SecondaryMouseButtonsHook.h"
|
||||
|
||||
@ -17,7 +18,7 @@ public:
|
||||
void MoveSizeUpdate(HMONITOR monitor, POINT const& ptScreen, const std::unordered_map<HMONITOR, winrt::com_ptr<IWorkArea>>& zoneWindowMap) noexcept;
|
||||
void MoveSizeEnd(HWND window, POINT const& ptScreen, const std::unordered_map<HMONITOR, winrt::com_ptr<IWorkArea>>& zoneWindowMap) noexcept;
|
||||
|
||||
void MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<size_t>& indexSet, winrt::com_ptr<IWorkArea> zoneWindow) noexcept;
|
||||
void MoveWindowIntoZoneByIndexSet(HWND window, const ZoneIndexSet& indexSet, winrt::com_ptr<IWorkArea> zoneWindow) noexcept;
|
||||
bool MoveWindowIntoZoneByDirectionAndIndex(HWND window, DWORD vkCode, bool cycle, winrt::com_ptr<IWorkArea> zoneWindow) noexcept;
|
||||
bool MoveWindowIntoZoneByDirectionAndPosition(HWND window, DWORD vkCode, bool cycle, winrt::com_ptr<IWorkArea> zoneWindow) noexcept;
|
||||
bool ExtendWindowByDirectionAndPosition(HWND window, DWORD vkCode, winrt::com_ptr<IWorkArea> zoneWindow) noexcept;
|
||||
|
@ -115,9 +115,9 @@ public:
|
||||
IFACEMETHODIMP MoveSizeUpdate(POINT const& ptScreen, bool dragEnabled, bool selectManyZones) noexcept;
|
||||
IFACEMETHODIMP MoveSizeEnd(HWND window, POINT const& ptScreen) noexcept;
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByIndex(HWND window, size_t index) noexcept;
|
||||
MoveWindowIntoZoneByIndex(HWND window, ZoneIndex index) noexcept;
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<size_t>& indexSet) noexcept;
|
||||
MoveWindowIntoZoneByIndexSet(HWND window, const ZoneIndexSet& indexSet) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
MoveWindowIntoZoneByDirectionAndIndex(HWND window, DWORD vkCode, bool cycle) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
@ -130,7 +130,7 @@ public:
|
||||
SaveWindowProcessToZoneIndex(HWND window) noexcept;
|
||||
IFACEMETHODIMP_(IZoneSet*)
|
||||
ActiveZoneSet() const noexcept { return m_activeZoneSet.get(); }
|
||||
IFACEMETHODIMP_(std::vector<size_t>)
|
||||
IFACEMETHODIMP_(ZoneIndexSet)
|
||||
GetWindowZoneIndexes(HWND window) const noexcept;
|
||||
IFACEMETHODIMP_(void)
|
||||
ShowZoneWindow() noexcept;
|
||||
@ -155,7 +155,7 @@ private:
|
||||
void CalculateZoneSet(OverlappingZonesAlgorithm overlappingAlgorithm) noexcept;
|
||||
void UpdateActiveZoneSet(_In_opt_ IZoneSet* zoneSet) noexcept;
|
||||
LRESULT WndProc(UINT message, WPARAM wparam, LPARAM lparam) noexcept;
|
||||
std::vector<size_t> ZonesFromPoint(POINT pt) noexcept;
|
||||
ZoneIndexSet ZonesFromPoint(POINT pt) noexcept;
|
||||
void SetAsTopmostWindow() noexcept;
|
||||
|
||||
HMONITOR m_monitor{};
|
||||
@ -164,8 +164,8 @@ private:
|
||||
HWND m_windowMoveSize{};
|
||||
winrt::com_ptr<IZoneSet> m_activeZoneSet;
|
||||
std::vector<winrt::com_ptr<IZoneSet>> m_zoneSets;
|
||||
std::vector<size_t> m_initialHighlightZone;
|
||||
std::vector<size_t> m_highlightZone;
|
||||
ZoneIndexSet m_initialHighlightZone;
|
||||
ZoneIndexSet m_highlightZone;
|
||||
WPARAM m_keyLast{};
|
||||
size_t m_keyCycle{};
|
||||
std::unique_ptr<ZoneWindowDrawing> m_zoneWindowDrawing;
|
||||
@ -305,13 +305,13 @@ IFACEMETHODIMP WorkArea::MoveSizeEnd(HWND window, POINT const& ptScreen) noexcep
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
WorkArea::MoveWindowIntoZoneByIndex(HWND window, size_t index) noexcept
|
||||
WorkArea::MoveWindowIntoZoneByIndex(HWND window, ZoneIndex index) noexcept
|
||||
{
|
||||
MoveWindowIntoZoneByIndexSet(window, { index });
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
WorkArea::MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<size_t>& indexSet) noexcept
|
||||
WorkArea::MoveWindowIntoZoneByIndexSet(HWND window, const ZoneIndexSet& indexSet) noexcept
|
||||
{
|
||||
if (m_activeZoneSet)
|
||||
{
|
||||
@ -383,7 +383,7 @@ WorkArea::SaveWindowProcessToZoneIndex(HWND window) noexcept
|
||||
}
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(std::vector<size_t>)
|
||||
IFACEMETHODIMP_(ZoneIndexSet)
|
||||
WorkArea::GetWindowZoneIndexes(HWND window) const noexcept
|
||||
{
|
||||
if (m_activeZoneSet)
|
||||
@ -575,7 +575,7 @@ LRESULT WorkArea::WndProc(UINT message, WPARAM wparam, LPARAM lparam) noexcept
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<size_t> WorkArea::ZonesFromPoint(POINT pt) noexcept
|
||||
ZoneIndexSet WorkArea::ZonesFromPoint(POINT pt) noexcept
|
||||
{
|
||||
if (m_activeZoneSet)
|
||||
{
|
||||
|
@ -44,14 +44,14 @@ interface __declspec(uuid("{7F017528-8110-4FB3-BE41-F472969C2560}")) IWorkArea :
|
||||
* @param window Handle of window which should be assigned to zone.
|
||||
* @param index Zone index within zone layout.
|
||||
*/
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndex)(HWND window, size_t index) = 0;
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndex)(HWND window, ZoneIndex index) = 0;
|
||||
/**
|
||||
* Assign window to the zones based on the set of zone indices inside zone layout.
|
||||
*
|
||||
* @param window Handle of window which should be assigned to zone.
|
||||
* @param indexSet The set of zone indices within zone layout.
|
||||
*/
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndexSet)(HWND window, const std::vector<size_t>& indexSet) = 0;
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndexSet)(HWND window, const ZoneIndexSet& indexSet) = 0;
|
||||
/**
|
||||
* Assign window to the zone based on direction (using WIN + LEFT/RIGHT arrow), based on zone index numbers,
|
||||
* not their on-screen position.
|
||||
@ -105,7 +105,7 @@ interface __declspec(uuid("{7F017528-8110-4FB3-BE41-F472969C2560}")) IWorkArea :
|
||||
/*
|
||||
* @returns Zone index of the window
|
||||
*/
|
||||
IFACEMETHOD_(std::vector<size_t>, GetWindowZoneIndexes)(HWND window) const = 0;
|
||||
IFACEMETHOD_(ZoneIndexSet, GetWindowZoneIndexes)(HWND window) const = 0;
|
||||
IFACEMETHOD_(void, ShowZoneWindow)() = 0;
|
||||
IFACEMETHOD_(void, HideZoneWindow)() = 0;
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@ namespace
|
||||
struct Zone : winrt::implements<Zone, IZone>
|
||||
{
|
||||
public:
|
||||
Zone(RECT zoneRect, const size_t zoneId) :
|
||||
Zone(RECT zoneRect, const ZoneIndex zoneId) :
|
||||
m_zoneRect(zoneRect),
|
||||
m_id(zoneId)
|
||||
{
|
||||
@ -34,12 +34,12 @@ public:
|
||||
|
||||
IFACEMETHODIMP_(RECT) GetZoneRect() const noexcept { return m_zoneRect; }
|
||||
IFACEMETHODIMP_(long) GetZoneArea() const noexcept { return max(m_zoneRect.bottom - m_zoneRect.top, 0) * max(m_zoneRect.right - m_zoneRect.left, 0); }
|
||||
IFACEMETHODIMP_(size_t) Id() const noexcept { return m_id; }
|
||||
IFACEMETHODIMP_(ZoneIndex) Id() const noexcept { return m_id; }
|
||||
IFACEMETHODIMP_(RECT) ComputeActualZoneRect(HWND window, HWND zoneWindow) const noexcept;
|
||||
|
||||
private:
|
||||
RECT m_zoneRect{};
|
||||
const size_t m_id{};
|
||||
const ZoneIndex m_id{};
|
||||
std::map<HWND, RECT> m_windows{};
|
||||
};
|
||||
|
||||
@ -75,7 +75,7 @@ RECT Zone::ComputeActualZoneRect(HWND window, HWND zoneWindow) const noexcept
|
||||
return newWindowRect;
|
||||
}
|
||||
|
||||
winrt::com_ptr<IZone> MakeZone(const RECT& zoneRect, const size_t zoneId) noexcept
|
||||
winrt::com_ptr<IZone> MakeZone(const RECT& zoneRect, const ZoneIndex zoneId) noexcept
|
||||
{
|
||||
if (ValidateZoneRect(zoneRect) && zoneId >= 0)
|
||||
{
|
||||
|
@ -5,6 +5,10 @@ namespace ZoneConstants
|
||||
constexpr int MAX_NEGATIVE_SPACING = -10;
|
||||
}
|
||||
|
||||
using ZoneIndex = int64_t;
|
||||
using ZoneIndexSet = std::vector<ZoneIndex>;
|
||||
using Bitmask = ZoneIndex;
|
||||
|
||||
/**
|
||||
* Class representing one zone inside applied zone layout, which is basically wrapper around rectangle structure.
|
||||
*/
|
||||
@ -21,7 +25,7 @@ interface __declspec(uuid("{8228E934-B6EF-402A-9892-15A1441BF8B0}")) IZone : pub
|
||||
/**
|
||||
* @returns Zone identifier.
|
||||
*/
|
||||
IFACEMETHOD_(size_t, Id)() const = 0;
|
||||
IFACEMETHOD_(ZoneIndex, Id)() const = 0;
|
||||
/**
|
||||
* Compute the coordinates of the rectangle to which a window should be resized.
|
||||
*
|
||||
@ -34,4 +38,4 @@ interface __declspec(uuid("{8228E934-B6EF-402A-9892-15A1441BF8B0}")) IZone : pub
|
||||
|
||||
};
|
||||
|
||||
winrt::com_ptr<IZone> MakeZone(const RECT& zoneRect, const size_t zoneId) noexcept;
|
||||
winrt::com_ptr<IZone> MakeZone(const RECT& zoneRect, const ZoneIndex zoneId) noexcept;
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "FancyZonesData.h"
|
||||
#include "FancyZonesDataTypes.h"
|
||||
#include "FancyZonesWindowProperties.h"
|
||||
#include "Settings.h"
|
||||
#include "Zone.h"
|
||||
#include "util.h"
|
||||
@ -102,11 +103,6 @@ namespace
|
||||
.columnsPercents = { 2500, 2500, 2500, 2500 },
|
||||
.cellChildMap = { { 0, 1, 2, 3 }, { 4, 1, 5, 6 }, { 7, 8, 9, 10 } } }),
|
||||
};
|
||||
|
||||
inline void StampWindow(HWND window, size_t bitmask) noexcept
|
||||
{
|
||||
SetProp(window, ZonedWindowProperties::PropertyMultipleZoneID, reinterpret_cast<HANDLE>(bitmask));
|
||||
}
|
||||
}
|
||||
|
||||
struct ZoneSet : winrt::implements<ZoneSet, IZoneSet>
|
||||
@ -128,16 +124,13 @@ public:
|
||||
IFACEMETHODIMP_(FancyZonesDataTypes::ZoneSetLayoutType)
|
||||
LayoutType() const noexcept { return m_config.LayoutType; }
|
||||
IFACEMETHODIMP AddZone(winrt::com_ptr<IZone> zone) noexcept;
|
||||
IFACEMETHODIMP_(std::vector<size_t>)
|
||||
ZonesFromPoint(POINT pt) const noexcept;
|
||||
IFACEMETHODIMP_(std::vector<size_t>)
|
||||
GetZoneIndexSetFromWindow(HWND window) const noexcept;
|
||||
IFACEMETHODIMP_(ZonesMap)
|
||||
GetZones()const noexcept override { return m_zones; }
|
||||
IFACEMETHODIMP_(ZoneIndexSet) ZonesFromPoint(POINT pt) const noexcept;
|
||||
IFACEMETHODIMP_(ZoneIndexSet) GetZoneIndexSetFromWindow(HWND window) const noexcept;
|
||||
IFACEMETHODIMP_(ZonesMap) GetZones()const noexcept override { return m_zones; }
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByIndex(HWND window, HWND workAreaWindow, size_t index) noexcept;
|
||||
MoveWindowIntoZoneByIndex(HWND window, HWND workAreaWindow, ZoneIndex index) noexcept;
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByIndexSet(HWND window, HWND workAreaWindow, const std::vector<size_t>& indexSet) noexcept;
|
||||
MoveWindowIntoZoneByIndexSet(HWND window, HWND workAreaWindow, const ZoneIndexSet& indexSet) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
MoveWindowIntoZoneByDirectionAndIndex(HWND window, HWND workAreaWindow, DWORD vkCode, bool cycle) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
@ -148,10 +141,8 @@ public:
|
||||
MoveWindowIntoZoneByPoint(HWND window, HWND workAreaWindow, POINT ptClient) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
CalculateZones(RECT workArea, int zoneCount, int spacing) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
IsZoneEmpty(int zoneIndex) const noexcept;
|
||||
IFACEMETHODIMP_(std::vector<size_t>)
|
||||
GetCombinedZoneRange(const std::vector<size_t>& initialZones, const std::vector<size_t>& finalZones) const noexcept;
|
||||
IFACEMETHODIMP_(bool) IsZoneEmpty(ZoneIndex zoneIndex) const noexcept;
|
||||
IFACEMETHODIMP_(ZoneIndexSet) GetCombinedZoneRange(const ZoneIndexSet& initialZones, const ZoneIndexSet& finalZones) const noexcept;
|
||||
|
||||
private:
|
||||
bool CalculateFocusLayout(Rect workArea, int zoneCount) noexcept;
|
||||
@ -160,19 +151,19 @@ private:
|
||||
bool CalculateUniquePriorityGridLayout(Rect workArea, int zoneCount, int spacing) noexcept;
|
||||
bool CalculateCustomLayout(Rect workArea, int spacing) noexcept;
|
||||
bool CalculateGridZones(Rect workArea, FancyZonesDataTypes::GridLayoutInfo gridLayoutInfo, int spacing);
|
||||
std::vector<size_t> ZoneSelectSubregion(const std::vector<size_t>& capturedZones, POINT pt) const;
|
||||
std::vector<size_t> ZoneSelectClosestCenter(const std::vector<size_t>& capturedZones, POINT pt) const;
|
||||
ZoneIndexSet ZoneSelectSubregion(const ZoneIndexSet& capturedZones, POINT pt) const;
|
||||
ZoneIndexSet ZoneSelectClosestCenter(const ZoneIndexSet& capturedZones, POINT pt) const;
|
||||
|
||||
// `compare` should return true if the first argument is a better choice than the second argument.
|
||||
template<class CompareF>
|
||||
std::vector<size_t> ZoneSelectPriority(const std::vector<size_t>& capturedZones, CompareF compare) const;
|
||||
ZoneIndexSet ZoneSelectPriority(const ZoneIndexSet& capturedZones, CompareF compare) const;
|
||||
|
||||
ZonesMap m_zones;
|
||||
std::map<HWND, std::vector<size_t>> m_windowIndexSet;
|
||||
std::map<HWND, ZoneIndexSet> m_windowIndexSet;
|
||||
|
||||
// Needed for ExtendWindowByDirectionAndPosition
|
||||
std::map<HWND, std::vector<size_t>> m_windowInitialIndexSet;
|
||||
std::map<HWND, size_t> m_windowFinalIndex;
|
||||
std::map<HWND, ZoneIndexSet> m_windowInitialIndexSet;
|
||||
std::map<HWND, ZoneIndex> m_windowFinalIndex;
|
||||
bool m_inExtendWindow = false;
|
||||
|
||||
ZoneSetConfig m_config;
|
||||
@ -190,11 +181,11 @@ IFACEMETHODIMP ZoneSet::AddZone(winrt::com_ptr<IZone> zone) noexcept
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(std::vector<size_t>)
|
||||
IFACEMETHODIMP_(ZoneIndexSet)
|
||||
ZoneSet::ZonesFromPoint(POINT pt) const noexcept
|
||||
{
|
||||
std::vector<size_t> capturedZones;
|
||||
std::vector<size_t> strictlyCapturedZones;
|
||||
ZoneIndexSet capturedZones;
|
||||
ZoneIndexSet strictlyCapturedZones;
|
||||
for (const auto& [zoneId, zone] : m_zones)
|
||||
{
|
||||
const RECT& zoneRect = zone->GetZoneRect();
|
||||
@ -278,7 +269,7 @@ ZoneSet::ZonesFromPoint(POINT pt) const noexcept
|
||||
return capturedZones;
|
||||
}
|
||||
|
||||
std::vector<size_t> ZoneSet::GetZoneIndexSetFromWindow(HWND window) const noexcept
|
||||
ZoneIndexSet ZoneSet::GetZoneIndexSetFromWindow(HWND window) const noexcept
|
||||
{
|
||||
auto it = m_windowIndexSet.find(window);
|
||||
if (it == m_windowIndexSet.end())
|
||||
@ -292,13 +283,13 @@ std::vector<size_t> ZoneSet::GetZoneIndexSetFromWindow(HWND window) const noexce
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
ZoneSet::MoveWindowIntoZoneByIndex(HWND window, HWND workAreaWindow, size_t index) noexcept
|
||||
ZoneSet::MoveWindowIntoZoneByIndex(HWND window, HWND workAreaWindow, ZoneIndex index) noexcept
|
||||
{
|
||||
MoveWindowIntoZoneByIndexSet(window, workAreaWindow, { index });
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
ZoneSet::MoveWindowIntoZoneByIndexSet(HWND window, HWND workAreaWindow, const std::vector<size_t>& zoneIds) noexcept
|
||||
ZoneSet::MoveWindowIntoZoneByIndexSet(HWND window, HWND workAreaWindow, const ZoneIndexSet& zoneIds) noexcept
|
||||
{
|
||||
if (m_zones.empty())
|
||||
{
|
||||
@ -314,11 +305,11 @@ ZoneSet::MoveWindowIntoZoneByIndexSet(HWND window, HWND workAreaWindow, const st
|
||||
|
||||
RECT size;
|
||||
bool sizeEmpty = true;
|
||||
size_t bitmask = 0;
|
||||
Bitmask bitmask = 0;
|
||||
|
||||
m_windowIndexSet[window] = {};
|
||||
|
||||
for (size_t id : zoneIds)
|
||||
for (ZoneIndex id : zoneIds)
|
||||
{
|
||||
if (m_zones.contains(id))
|
||||
{
|
||||
@ -340,7 +331,7 @@ ZoneSet::MoveWindowIntoZoneByIndexSet(HWND window, HWND workAreaWindow, const st
|
||||
m_windowIndexSet[window].push_back(id);
|
||||
}
|
||||
|
||||
if (id < std::numeric_limits<size_t>::digits)
|
||||
if (id < std::numeric_limits<ZoneIndex>::digits)
|
||||
{
|
||||
bitmask |= 1ull << id;
|
||||
}
|
||||
@ -363,7 +354,7 @@ ZoneSet::MoveWindowIntoZoneByDirectionAndIndex(HWND window, HWND workAreaWindow,
|
||||
}
|
||||
|
||||
auto indexSet = GetZoneIndexSetFromWindow(window);
|
||||
size_t numZones = m_zones.size();
|
||||
auto numZones = m_zones.size();
|
||||
|
||||
// The window was not assigned to any zone here
|
||||
if (indexSet.size() == 0)
|
||||
@ -372,7 +363,7 @@ ZoneSet::MoveWindowIntoZoneByDirectionAndIndex(HWND window, HWND workAreaWindow,
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t oldId = indexSet[0];
|
||||
ZoneIndex oldId = indexSet[0];
|
||||
|
||||
// We reached the edge
|
||||
if ((vkCode == VK_LEFT && oldId == 0) || (vkCode == VK_RIGHT && oldId == numZones - 1))
|
||||
@ -410,13 +401,13 @@ ZoneSet::MoveWindowIntoZoneByDirectionAndPosition(HWND window, HWND workAreaWind
|
||||
}
|
||||
|
||||
std::vector<bool> usedZoneIndices(m_zones.size(), false);
|
||||
for (size_t id : GetZoneIndexSetFromWindow(window))
|
||||
for (ZoneIndex id : GetZoneIndexSetFromWindow(window))
|
||||
{
|
||||
usedZoneIndices[id] = true;
|
||||
}
|
||||
|
||||
std::vector<RECT> zoneRects;
|
||||
std::vector<size_t> freeZoneIndices;
|
||||
ZoneIndexSet freeZoneIndices;
|
||||
|
||||
for (const auto& [zoneId, zone] : m_zones)
|
||||
{
|
||||
@ -436,7 +427,7 @@ ZoneSet::MoveWindowIntoZoneByDirectionAndPosition(HWND window, HWND workAreaWind
|
||||
windowRect.left -= windowZoneRect.left;
|
||||
windowRect.right -= windowZoneRect.left;
|
||||
|
||||
size_t result = FancyZonesUtils::ChooseNextZoneByPosition(vkCode, windowRect, zoneRects);
|
||||
auto result = FancyZonesUtils::ChooseNextZoneByPosition(vkCode, windowRect, zoneRects);
|
||||
if (result < zoneRects.size())
|
||||
{
|
||||
MoveWindowIntoZoneByIndex(window, workAreaWindow, freeZoneIndices[result]);
|
||||
@ -476,7 +467,7 @@ ZoneSet::ExtendWindowByDirectionAndPosition(HWND window, HWND workAreaWindow, DW
|
||||
auto oldZones = GetZoneIndexSetFromWindow(window);
|
||||
std::vector<bool> usedZoneIndices(m_zones.size(), false);
|
||||
std::vector<RECT> zoneRects;
|
||||
std::vector<size_t> freeZoneIndices;
|
||||
ZoneIndexSet freeZoneIndices;
|
||||
|
||||
// If selectManyZones = true for the second time, use the last zone into which we moved
|
||||
// instead of the window rect and enable moving to all zones except the old one
|
||||
@ -488,7 +479,7 @@ ZoneSet::ExtendWindowByDirectionAndPosition(HWND window, HWND workAreaWindow, DW
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t idx : oldZones)
|
||||
for (ZoneIndex idx : oldZones)
|
||||
{
|
||||
usedZoneIndices[idx] = true;
|
||||
}
|
||||
@ -508,11 +499,11 @@ ZoneSet::ExtendWindowByDirectionAndPosition(HWND window, HWND workAreaWindow, DW
|
||||
}
|
||||
}
|
||||
|
||||
size_t result = FancyZonesUtils::ChooseNextZoneByPosition(vkCode, windowRect, zoneRects);
|
||||
auto result = FancyZonesUtils::ChooseNextZoneByPosition(vkCode, windowRect, zoneRects);
|
||||
if (result < zoneRects.size())
|
||||
{
|
||||
size_t targetZone = freeZoneIndices[result];
|
||||
std::vector<size_t> resultIndexSet;
|
||||
ZoneIndex targetZone = freeZoneIndices[result];
|
||||
ZoneIndexSet resultIndexSet;
|
||||
|
||||
// First time with selectManyZones = true for this window?
|
||||
if (finalIndexIt == m_windowFinalIndex.end())
|
||||
@ -593,7 +584,7 @@ ZoneSet::CalculateZones(RECT workAreaRect, int zoneCount, int spacing) noexcept
|
||||
return success;
|
||||
}
|
||||
|
||||
bool ZoneSet::IsZoneEmpty(int zoneIndex) const noexcept
|
||||
bool ZoneSet::IsZoneEmpty(ZoneIndex zoneIndex) const noexcept
|
||||
{
|
||||
for (auto& [window, zones] : m_windowIndexSet)
|
||||
{
|
||||
@ -903,15 +894,15 @@ bool ZoneSet::CalculateGridZones(Rect workArea, FancyZonesDataTypes::GridLayoutI
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<size_t> ZoneSet::GetCombinedZoneRange(const std::vector<size_t>& initialZones, const std::vector<size_t>& finalZones) const noexcept
|
||||
ZoneIndexSet ZoneSet::GetCombinedZoneRange(const ZoneIndexSet& initialZones, const ZoneIndexSet& finalZones) const noexcept
|
||||
{
|
||||
std::vector<size_t> combinedZones, result;
|
||||
ZoneIndexSet combinedZones, result;
|
||||
std::set_union(begin(initialZones), end(initialZones), begin(finalZones), end(finalZones), std::back_inserter(combinedZones));
|
||||
|
||||
RECT boundingRect;
|
||||
bool boundingRectEmpty = true;
|
||||
|
||||
for (size_t zoneId : combinedZones)
|
||||
for (ZoneIndex zoneId : combinedZones)
|
||||
{
|
||||
if (m_zones.contains(zoneId))
|
||||
{
|
||||
@ -947,7 +938,7 @@ std::vector<size_t> ZoneSet::GetCombinedZoneRange(const std::vector<size_t>& ini
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<size_t> ZoneSet::ZoneSelectSubregion(const std::vector<size_t>& capturedZones, POINT pt) const
|
||||
ZoneIndexSet ZoneSet::ZoneSelectSubregion(const ZoneIndexSet& capturedZones, POINT pt) const
|
||||
{
|
||||
auto expand = [&](RECT& rect) {
|
||||
rect.top -= m_config.SensitivityRadius / 2;
|
||||
@ -976,7 +967,7 @@ std::vector<size_t> ZoneSet::ZoneSelectSubregion(const std::vector<size_t>& capt
|
||||
int height = max(overlap.bottom - overlap.top, 1);
|
||||
|
||||
bool verticalSplit = height > width;
|
||||
size_t zoneIndex;
|
||||
ZoneIndex zoneIndex;
|
||||
|
||||
if (verticalSplit)
|
||||
{
|
||||
@ -987,12 +978,12 @@ std::vector<size_t> ZoneSet::ZoneSelectSubregion(const std::vector<size_t>& capt
|
||||
zoneIndex = (pt.x - overlap.left) * capturedZones.size() / width;
|
||||
}
|
||||
|
||||
zoneIndex = std::clamp(zoneIndex, size_t(0), capturedZones.size() - 1);
|
||||
zoneIndex = std::clamp(zoneIndex, ZoneIndex(0), static_cast<ZoneIndex>(capturedZones.size()) - 1);
|
||||
|
||||
return { capturedZones[zoneIndex] };
|
||||
}
|
||||
|
||||
std::vector<size_t> ZoneSet::ZoneSelectClosestCenter(const std::vector<size_t>& capturedZones, POINT pt) const
|
||||
ZoneIndexSet ZoneSet::ZoneSelectClosestCenter(const ZoneIndexSet& capturedZones, POINT pt) const
|
||||
{
|
||||
auto getCenter = [](auto zone) {
|
||||
RECT rect = zone->GetZoneRect();
|
||||
@ -1019,7 +1010,7 @@ std::vector<size_t> ZoneSet::ZoneSelectClosestCenter(const std::vector<size_t>&
|
||||
}
|
||||
|
||||
template<class CompareF>
|
||||
std::vector<size_t> ZoneSet::ZoneSelectPriority(const std::vector<size_t>& capturedZones, CompareF compare) const
|
||||
ZoneIndexSet ZoneSet::ZoneSelectPriority(const ZoneIndexSet& capturedZones, CompareF compare) const
|
||||
{
|
||||
size_t chosen = 0;
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace FancyZonesDataTypes
|
||||
interface __declspec(uuid("{E4839EB7-669D-49CF-84A9-71A2DFD851A3}")) IZoneSet : public IUnknown
|
||||
{
|
||||
// Mapping zone id to zone
|
||||
using ZonesMap = std::map<size_t, winrt::com_ptr<IZone>>;
|
||||
using ZonesMap = std::map<ZoneIndex, winrt::com_ptr<IZone>>;
|
||||
|
||||
/**
|
||||
* @returns Unique identifier of zone layout.
|
||||
@ -36,15 +36,14 @@ interface __declspec(uuid("{E4839EB7-669D-49CF-84A9-71A2DFD851A3}")) IZoneSet :
|
||||
* @param pt Cursor coordinates.
|
||||
* @returns Vector of indices, corresponding to the current set of zones - the zones considered active.
|
||||
*/
|
||||
IFACEMETHOD_(std::vector<size_t>, ZonesFromPoint)(POINT pt) const = 0;
|
||||
IFACEMETHOD_(ZoneIndexSet, ZonesFromPoint)(POINT pt) const = 0;
|
||||
/**
|
||||
* Get index set of the zones to which the window was assigned.
|
||||
*
|
||||
* @param window Handle of the window.
|
||||
* @returns A vector of size_t, 0-based index set.
|
||||
* @returns A vector of ZoneIndex, 0-based index set.
|
||||
*/
|
||||
IFACEMETHOD_(std::vector<size_t>, GetZoneIndexSetFromWindow)
|
||||
(HWND window) const = 0;
|
||||
IFACEMETHOD_(ZoneIndexSet, GetZoneIndexSetFromWindow)(HWND window) const = 0;
|
||||
/**
|
||||
* @returns Array of zone objects (defining coordinates of the zone) inside this zone layout.
|
||||
*/
|
||||
@ -57,8 +56,7 @@ interface __declspec(uuid("{E4839EB7-669D-49CF-84A9-71A2DFD851A3}")) IZoneSet :
|
||||
* current monitor desktop work area.
|
||||
* @param index Zone index within zone layout.
|
||||
*/
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndex)
|
||||
(HWND window, HWND workAreaWindow, size_t index) = 0;
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndex)(HWND window, HWND workAreaWindow, ZoneIndex index) = 0;
|
||||
/**
|
||||
* Assign window to the zones based on the set of zone indices inside zone layout.
|
||||
*
|
||||
@ -67,8 +65,7 @@ interface __declspec(uuid("{E4839EB7-669D-49CF-84A9-71A2DFD851A3}")) IZoneSet :
|
||||
* current monitor desktop work area.
|
||||
* @param indexSet The set of zone indices within zone layout.
|
||||
*/
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndexSet)
|
||||
(HWND window, HWND workAreaWindow, const std::vector<size_t>& indexSet) = 0;
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndexSet)(HWND window, HWND workAreaWindow, const ZoneIndexSet& indexSet) = 0;
|
||||
/**
|
||||
* Assign window to the zone based on direction (using WIN + LEFT/RIGHT arrow), based on zone index numbers,
|
||||
* not their on-screen position.
|
||||
@ -82,8 +79,7 @@ interface __declspec(uuid("{E4839EB7-669D-49CF-84A9-71A2DFD851A3}")) IZoneSet :
|
||||
* @returns Boolean which is always true if cycle argument is set, otherwise indicating if there is more
|
||||
* zones left in the zone layout in which window can move.
|
||||
*/
|
||||
IFACEMETHOD_(bool, MoveWindowIntoZoneByDirectionAndIndex)
|
||||
(HWND window, HWND workAreaWindow, DWORD vkCode, bool cycle) = 0;
|
||||
IFACEMETHOD_(bool, MoveWindowIntoZoneByDirectionAndIndex)(HWND window, HWND workAreaWindow, DWORD vkCode, bool cycle) = 0;
|
||||
/**
|
||||
* Assign window to the zone based on direction (using WIN + LEFT/RIGHT/UP/DOWN arrow), based on
|
||||
* their on-screen position.
|
||||
@ -140,7 +136,7 @@ interface __declspec(uuid("{E4839EB7-669D-49CF-84A9-71A2DFD851A3}")) IZoneSet :
|
||||
*
|
||||
* @returns Boolean indicating whether the zone is empty.
|
||||
*/
|
||||
IFACEMETHOD_(bool, IsZoneEmpty)(int zoneIndex) const = 0;
|
||||
IFACEMETHOD_(bool, IsZoneEmpty)(ZoneIndex zoneIndex) const = 0;
|
||||
/**
|
||||
* Returns all zones spanned by the minimum bounding rectangle containing the two given zone index sets.
|
||||
*
|
||||
@ -149,7 +145,7 @@ interface __declspec(uuid("{E4839EB7-669D-49CF-84A9-71A2DFD851A3}")) IZoneSet :
|
||||
*
|
||||
* @returns A vector indicating describing the chosen zone index set.
|
||||
*/
|
||||
IFACEMETHOD_(std::vector<size_t>, GetCombinedZoneRange)(const std::vector<size_t>& initialZones, const std::vector<size_t>& finalZones) const = 0;
|
||||
IFACEMETHOD_(ZoneIndexSet, GetCombinedZoneRange)(const ZoneIndexSet& initialZones, const ZoneIndexSet& finalZones) const = 0;
|
||||
};
|
||||
|
||||
struct ZoneSetConfig
|
||||
|
@ -278,7 +278,7 @@ void ZoneWindowDrawing::Flash()
|
||||
}
|
||||
|
||||
void ZoneWindowDrawing::DrawActiveZoneSet(const IZoneSet::ZonesMap& zones,
|
||||
const std::vector<size_t>& highlightZones,
|
||||
const ZoneIndexSet& highlightZones,
|
||||
const ZoneColors& colors)
|
||||
{
|
||||
_TRACER_;
|
||||
@ -294,7 +294,7 @@ void ZoneWindowDrawing::DrawActiveZoneSet(const IZoneSet::ZonesMap& zones,
|
||||
highlightColor.a = colors.highlightOpacity / 100.f;
|
||||
|
||||
std::vector<bool> isHighlighted(zones.size() + 1, false);
|
||||
for (size_t x : highlightZones)
|
||||
for (ZoneIndex x : highlightZones)
|
||||
{
|
||||
isHighlighted[x] = true;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class ZoneWindowDrawing
|
||||
D2D1_RECT_F rect;
|
||||
D2D1_COLOR_F borderColor;
|
||||
D2D1_COLOR_F fillColor;
|
||||
size_t id;
|
||||
ZoneIndex id;
|
||||
};
|
||||
|
||||
struct AnimationInfo
|
||||
@ -65,6 +65,6 @@ public:
|
||||
void Show();
|
||||
void Flash();
|
||||
void DrawActiveZoneSet(const IZoneSet::ZonesMap& zones,
|
||||
const std::vector<size_t>& highlightZones,
|
||||
const ZoneIndexSet& highlightZones,
|
||||
const ZoneColors& colors);
|
||||
};
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <wil/Resource.h>
|
||||
|
||||
#include <fancyzones/FancyZonesLib/FancyZonesDataTypes.h>
|
||||
#include <fancyzones/FancyZonesLib/FancyZonesWindowProperties.h>
|
||||
|
||||
// Non-Localizable strings
|
||||
namespace NonLocalizable
|
||||
|
@ -1201,7 +1201,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::AreEqual(expected.data.size(), entryData.size());
|
||||
Assert::AreEqual(expectedZoneSetId.c_str(), entryData[0].zoneSetUuid.c_str());
|
||||
Assert::AreEqual(expectedDeviceId.c_str(), entryData[0].deviceId.c_str());
|
||||
Assert::IsTrue(std::vector<size_t>{ expectedIndex } == entryData[0].zoneIndexSet);
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ expectedIndex } == entryData[0].zoneIndexSet);
|
||||
}
|
||||
|
||||
TEST_METHOD (AppZoneHistoryParseManyApps)
|
||||
@ -1842,11 +1842,11 @@ namespace FancyZonesUnitTests
|
||||
FancyZonesData data;
|
||||
data.SetSettingsModulePath(m_moduleName);
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{} == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{} == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
|
||||
const int expectedZoneIndex = 10;
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceId, zoneSetId, { expectedZoneIndex } ));
|
||||
Assert::IsTrue(std::vector<size_t>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
}
|
||||
|
||||
TEST_METHOD (AppLastZoneIndexZero)
|
||||
@ -1859,7 +1859,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
const int expectedZoneIndex = 0;
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceId, zoneSetId, { expectedZoneIndex }));
|
||||
Assert::IsTrue(std::vector<size_t>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
}
|
||||
|
||||
TEST_METHOD (AppLastZoneIndexNegative)
|
||||
@ -1870,9 +1870,9 @@ namespace FancyZonesUnitTests
|
||||
FancyZonesData data;
|
||||
data.SetSettingsModulePath(m_moduleName);
|
||||
|
||||
const size_t expectedZoneIndex = -1;
|
||||
const ZoneIndex expectedZoneIndex = -1;
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceId, zoneSetId, { expectedZoneIndex }));
|
||||
Assert::IsTrue(std::vector<size_t>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
}
|
||||
|
||||
TEST_METHOD (AppLastZoneIndexOverflow)
|
||||
@ -1883,9 +1883,9 @@ namespace FancyZonesUnitTests
|
||||
FancyZonesData data;
|
||||
data.SetSettingsModulePath(m_moduleName);
|
||||
|
||||
const size_t expectedZoneIndex = ULLONG_MAX;
|
||||
const ZoneIndex expectedZoneIndex = ULLONG_MAX;
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceId, zoneSetId, { expectedZoneIndex }));
|
||||
Assert::IsTrue(std::vector<size_t>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
}
|
||||
|
||||
TEST_METHOD (AppLastZoneIndexOverride)
|
||||
@ -1900,7 +1900,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceId, zoneSetId, { 1 }));
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceId, zoneSetId, { 2 }));
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceId, zoneSetId, { expectedZoneIndex }));
|
||||
Assert::IsTrue(std::vector<size_t>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
}
|
||||
|
||||
TEST_METHOD (AppLastZoneInvalidWindow)
|
||||
@ -1911,7 +1911,7 @@ namespace FancyZonesUnitTests
|
||||
FancyZonesData data;
|
||||
data.SetSettingsModulePath(m_moduleName);
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{} == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{} == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
|
||||
const int expectedZoneIndex = 1;
|
||||
Assert::IsFalse(data.SetAppLastZones(window, deviceId, zoneSetId, { expectedZoneIndex }));
|
||||
@ -1939,8 +1939,8 @@ namespace FancyZonesUnitTests
|
||||
|
||||
const int expectedZoneIndex = 10;
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceId1, zoneSetId, { expectedZoneIndex }));
|
||||
Assert::IsTrue(std::vector<size_t>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId1, zoneSetId));
|
||||
Assert::IsTrue(std::vector<size_t>{} == data.GetAppLastZoneIndexSet(window, deviceId2, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId1, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{} == data.GetAppLastZoneIndexSet(window, deviceId2, zoneSetId));
|
||||
}
|
||||
|
||||
TEST_METHOD (AppLastZoneSetIdTest)
|
||||
@ -1954,8 +1954,8 @@ namespace FancyZonesUnitTests
|
||||
|
||||
const int expectedZoneIndex = 10;
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceId, zoneSetId1, { expectedZoneIndex }));
|
||||
Assert::IsTrue(std::vector<size_t>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId1));
|
||||
Assert::IsTrue(std::vector<size_t>{} == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId2));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ expectedZoneIndex } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId1));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{} == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId2));
|
||||
}
|
||||
|
||||
TEST_METHOD (AppLastZoneRemoveWindow)
|
||||
@ -1968,7 +1968,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceId, zoneSetId, { 1 }));
|
||||
Assert::IsTrue(data.RemoveAppLastZone(window, deviceId, zoneSetId));
|
||||
Assert::IsTrue(std::vector<size_t>{} == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{} == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
}
|
||||
|
||||
TEST_METHOD (AppLastZoneRemoveUnknownWindow)
|
||||
@ -1980,7 +1980,7 @@ namespace FancyZonesUnitTests
|
||||
data.SetSettingsModulePath(m_moduleName);
|
||||
|
||||
Assert::IsFalse(data.RemoveAppLastZone(window, deviceId, zoneSetId));
|
||||
Assert::IsTrue(std::vector<size_t>{} == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{} == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetId));
|
||||
}
|
||||
|
||||
TEST_METHOD (AppLastZoneRemoveUnknownZoneSetId)
|
||||
@ -1994,7 +1994,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceId, zoneSetIdToInsert, { 1 }));
|
||||
Assert::IsFalse(data.RemoveAppLastZone(window, deviceId, zoneSetIdToRemove));
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetIdToInsert));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == data.GetAppLastZoneIndexSet(window, deviceId, zoneSetIdToInsert));
|
||||
}
|
||||
|
||||
TEST_METHOD (AppLastZoneRemoveUnknownWindowId)
|
||||
@ -2008,7 +2008,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
Assert::IsTrue(data.SetAppLastZones(window, deviceIdToInsert, zoneSetId, { 1 }));
|
||||
Assert::IsFalse(data.RemoveAppLastZone(window, deviceIdToRemove, zoneSetId));
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == data.GetAppLastZoneIndexSet(window, deviceIdToInsert, zoneSetId));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == data.GetAppLastZoneIndexSet(window, deviceIdToInsert, zoneSetId));
|
||||
}
|
||||
|
||||
TEST_METHOD (AppLastZoneRemoveNullWindow)
|
||||
|
@ -271,7 +271,7 @@ namespace FancyZonesUnitTests
|
||||
const auto zoneSet = workArea->ActiveZoneSet();
|
||||
zoneSet->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
|
||||
const auto actualZoneIndexSet = zoneSet->GetZoneIndexSetFromWindow(window);
|
||||
Assert::IsFalse(std::vector<size_t>{} == actualZoneIndexSet);
|
||||
Assert::IsFalse(std::vector<ZoneIndex>{} == actualZoneIndexSet);
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveSizeEndWindowNotAdded)
|
||||
@ -287,7 +287,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
const auto zoneSet = workArea->ActiveZoneSet();
|
||||
const auto actualZoneIndexSet = zoneSet->GetZoneIndexSetFromWindow(window);
|
||||
Assert::IsTrue(std::vector<size_t>{} == actualZoneIndexSet);
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{} == actualZoneIndexSet);
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveSizeEndDifferentWindows)
|
||||
@ -327,7 +327,7 @@ namespace FancyZonesUnitTests
|
||||
const auto zoneSet = workArea->ActiveZoneSet();
|
||||
zoneSet->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
|
||||
const auto actualZoneIndex = zoneSet->GetZoneIndexSetFromWindow(window);
|
||||
Assert::IsFalse(std::vector<size_t>{} == actualZoneIndex); // with invalid point zone remains the same
|
||||
Assert::IsFalse(std::vector<ZoneIndex>{} == actualZoneIndex); // with invalid point zone remains the same
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByIndex)
|
||||
@ -352,7 +352,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::AreEqual((size_t)1, actualAppZoneHistory.size());
|
||||
const auto& appHistoryArray = actualAppZoneHistory.begin()->second;
|
||||
Assert::AreEqual((size_t)1, appHistoryArray.size());
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == appHistoryArray[0].zoneIndexSet);
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == appHistoryArray[0].zoneIndexSet);
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByDirectionManyTimes)
|
||||
@ -369,7 +369,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::AreEqual((size_t)1, actualAppZoneHistory.size());
|
||||
const auto& appHistoryArray = actualAppZoneHistory.begin()->second;
|
||||
Assert::AreEqual((size_t)1, appHistoryArray.size());
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == appHistoryArray[0].zoneIndexSet);
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == appHistoryArray[0].zoneIndexSet);
|
||||
}
|
||||
|
||||
TEST_METHOD (SaveWindowProcessToZoneIndexNullptrWindow)
|
||||
@ -413,7 +413,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::AreEqual((size_t)1, m_fancyZonesData.GetAppZoneHistoryMap().size());
|
||||
const auto& appHistoryArray1 = m_fancyZonesData.GetAppZoneHistoryMap().at(processPath);
|
||||
Assert::AreEqual((size_t)1, appHistoryArray1.size());
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == appHistoryArray1[0].zoneIndexSet);
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == appHistoryArray1[0].zoneIndexSet);
|
||||
|
||||
// add zone without window
|
||||
const auto zone = MakeZone(RECT{ 0, 0, 100, 100 }, 1);
|
||||
@ -423,7 +423,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::AreEqual((size_t)1, m_fancyZonesData.GetAppZoneHistoryMap().size());
|
||||
const auto& appHistoryArray2 = m_fancyZonesData.GetAppZoneHistoryMap().at(processPath);
|
||||
Assert::AreEqual((size_t)1, appHistoryArray2.size());
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == appHistoryArray2[0].zoneIndexSet);
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == appHistoryArray2[0].zoneIndexSet);
|
||||
}
|
||||
|
||||
TEST_METHOD (SaveWindowProcessToZoneIndexWindowAdded)
|
||||
@ -445,7 +445,7 @@ namespace FancyZonesUnitTests
|
||||
Assert::AreEqual((size_t)1, m_fancyZonesData.GetAppZoneHistoryMap().size());
|
||||
const auto& appHistoryArray = m_fancyZonesData.GetAppZoneHistoryMap().at(processPath);
|
||||
Assert::AreEqual((size_t)1, appHistoryArray.size());
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == appHistoryArray[0].zoneIndexSet);
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == appHistoryArray[0].zoneIndexSet);
|
||||
|
||||
workArea->SaveWindowProcessToZoneIndex(window);
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
TEST_METHOD(GetSetId)
|
||||
{
|
||||
constexpr size_t zoneId = 123;
|
||||
constexpr ZoneIndex zoneId = 123;
|
||||
winrt::com_ptr<IZone> zone = MakeZone(m_zoneRect, zoneId);
|
||||
|
||||
Assert::AreEqual(zone->Id(), zoneId);
|
||||
|
@ -85,7 +85,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
TEST_METHOD (AddOne)
|
||||
{
|
||||
constexpr size_t zoneId = 0;
|
||||
constexpr ZoneIndex zoneId = 0;
|
||||
winrt::com_ptr<IZone> zone = MakeZone({ 0, 0, 100, 100 }, zoneId);
|
||||
Assert::IsNotNull(zone.get());
|
||||
m_set->AddZone(zone);
|
||||
@ -99,7 +99,7 @@ namespace FancyZonesUnitTests
|
||||
{
|
||||
for (size_t i = 0; i < 1024; i++)
|
||||
{
|
||||
size_t zoneId = i;
|
||||
ZoneIndex zoneId = i;
|
||||
winrt::com_ptr<IZone> zone = MakeZone({ 0, 0, 100, 100 }, zoneId);
|
||||
Assert::IsNotNull(zone.get());
|
||||
m_set->AddZone(zone);
|
||||
@ -114,7 +114,7 @@ namespace FancyZonesUnitTests
|
||||
{
|
||||
for (size_t i = 0; i < 1024; i++)
|
||||
{
|
||||
size_t zoneId = i;
|
||||
ZoneIndex zoneId = i;
|
||||
int left = rand() % 10;
|
||||
int top = rand() % 10;
|
||||
int right = left + 1 + rand() % 100;
|
||||
@ -302,7 +302,7 @@ namespace FancyZonesUnitTests
|
||||
m_set->MoveWindowIntoZoneByIndexSet(window, zoneWindow, { 0 });
|
||||
|
||||
auto actual = m_set->GetZoneIndexSetFromWindow(Mocks::Window());
|
||||
Assert::IsTrue(std::vector<size_t>{} == actual);
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{} == actual);
|
||||
}
|
||||
|
||||
TEST_METHOD (ZoneIndexFromWindowNull)
|
||||
@ -314,7 +314,7 @@ namespace FancyZonesUnitTests
|
||||
m_set->MoveWindowIntoZoneByIndexSet(window, zoneWindow, { 0 });
|
||||
|
||||
auto actual = m_set->GetZoneIndexSetFromWindow(nullptr);
|
||||
Assert::IsTrue(std::vector<size_t>{} == actual);
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{} == actual);
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByIndex)
|
||||
@ -328,7 +328,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 1);
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByIndexWithNoZones)
|
||||
@ -348,7 +348,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 100);
|
||||
Assert::IsTrue(std::vector<size_t>{} == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{} == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByIndexSeveralTimesSameWindow)
|
||||
@ -363,13 +363,13 @@ namespace FancyZonesUnitTests
|
||||
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 1);
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 2);
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByIndexSeveralTimesSameIndex)
|
||||
@ -386,7 +386,7 @@ namespace FancyZonesUnitTests
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointEmpty)
|
||||
@ -402,7 +402,7 @@ namespace FancyZonesUnitTests
|
||||
auto window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByPoint(window, Mocks::Window(), POINT{ 200, 200 });
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{} == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{} == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointInnerPoint)
|
||||
@ -413,7 +413,7 @@ namespace FancyZonesUnitTests
|
||||
auto window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByPoint(window, Mocks::Window(), POINT{ 50, 50 });
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointInnerPointOverlappingZones)
|
||||
@ -426,7 +426,7 @@ namespace FancyZonesUnitTests
|
||||
auto window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByPoint(window, Mocks::Window(), POINT{ 50, 50 });
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointDropAddWindow)
|
||||
@ -444,7 +444,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
m_set->MoveWindowIntoZoneByPoint(window, Mocks::Window(), POINT{ 50, 50 });
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointDropAddWindowToSameZone)
|
||||
@ -462,7 +462,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
m_set->MoveWindowIntoZoneByPoint(window, Mocks::Window(), POINT{ 50, 50 });
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByPointSeveralZonesWithSameWindow)
|
||||
@ -482,7 +482,7 @@ namespace FancyZonesUnitTests
|
||||
|
||||
m_set->MoveWindowIntoZoneByPoint(window, Mocks::Window(), POINT{ 50, 50 });
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
};
|
||||
|
||||
@ -528,14 +528,14 @@ namespace FancyZonesUnitTests
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveLeftNoZones)
|
||||
{
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveRightTwice)
|
||||
@ -543,7 +543,7 @@ namespace FancyZonesUnitTests
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveLeftTwice)
|
||||
@ -551,7 +551,7 @@ namespace FancyZonesUnitTests
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveRightMoreThanZonesCount)
|
||||
@ -562,7 +562,7 @@ namespace FancyZonesUnitTests
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
|
||||
}
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveLeftMoreThanZonesCount)
|
||||
@ -573,7 +573,7 @@ namespace FancyZonesUnitTests
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
|
||||
}
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByDirectionRight)
|
||||
@ -581,10 +581,10 @@ namespace FancyZonesUnitTests
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveRightWithSameWindowAdded)
|
||||
@ -592,13 +592,13 @@ namespace FancyZonesUnitTests
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByIndexSet(window, Mocks::Window(), { 0, 1 });
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 0, 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0, 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveRightWithDifferentWindowsAdded)
|
||||
@ -608,18 +608,18 @@ namespace FancyZonesUnitTests
|
||||
m_set->MoveWindowIntoZoneByIndex(window1, Mocks::Window(), { 0 });
|
||||
m_set->MoveWindowIntoZoneByIndex(window2, Mocks::Window(), { 1 });
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window1, Mocks::Window(), VK_RIGHT, true);
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window1, Mocks::Window(), VK_RIGHT, true);
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByDirectionLeft)
|
||||
@ -627,10 +627,10 @@ namespace FancyZonesUnitTests
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 2);
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveLeftWithSameWindowAdded)
|
||||
@ -638,13 +638,13 @@ namespace FancyZonesUnitTests
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByIndexSet(window, Mocks::Window(), { 1, 2 });
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 1, 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1, 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveLeftWithDifferentWindowsAdded)
|
||||
@ -654,16 +654,16 @@ namespace FancyZonesUnitTests
|
||||
m_set->MoveWindowIntoZoneByIndex(window1, Mocks::Window(), 1);
|
||||
m_set->MoveWindowIntoZoneByIndex(window2, Mocks::Window(), 2);
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window2, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window2, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 1 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByDirectionWrapAroundRight)
|
||||
@ -671,7 +671,7 @@ namespace FancyZonesUnitTests
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 2);
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_RIGHT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveWindowIntoZoneByDirectionWrapAroundLeft)
|
||||
@ -679,7 +679,7 @@ namespace FancyZonesUnitTests
|
||||
HWND window = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByIndex(window, Mocks::Window(), 0);
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window, Mocks::Window(), VK_LEFT, true);
|
||||
Assert::IsTrue(std::vector<size_t>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 2 } == m_set->GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveSecondWindowIntoSameZone)
|
||||
@ -690,8 +690,8 @@ namespace FancyZonesUnitTests
|
||||
HWND window2 = Mocks::Window();
|
||||
m_set->MoveWindowIntoZoneByDirectionAndIndex(window2, Mocks::Window(), VK_RIGHT, true);
|
||||
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<size_t>{ 0 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window1));
|
||||
Assert::IsTrue(std::vector<ZoneIndex>{ 0 } == m_set->GetZoneIndexSetFromWindow(window2));
|
||||
}
|
||||
|
||||
TEST_METHOD (MoveRightMoreThanZoneCountReturnsFalse)
|
||||
|
Loading…
Reference in New Issue
Block a user