mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
[FancyZones] fix warnings (#6095)
unified data type to size_t in all methods that process the zone index set
This commit is contained in:
@@ -227,10 +227,10 @@ private:
|
||||
|
||||
bool IsSplashScreen(HWND window);
|
||||
bool ShouldProcessNewWindow(HWND window) noexcept;
|
||||
std::vector<int> GetZoneIndexSetFromWorkAreaHistory(HWND window, winrt::com_ptr<IZoneWindow> workArea) noexcept;
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<int>> GetAppZoneHistoryInfo(HWND window, HMONITOR monitor, std::unordered_map<HMONITOR, winrt::com_ptr<IZoneWindow>>& workAreaMap) noexcept;
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<int>> GetAppZoneHistoryInfo(HWND window, HMONITOR monitor, bool isPrimaryMonitor) noexcept;
|
||||
void MoveWindowIntoZone(HWND window, winrt::com_ptr<IZoneWindow> zoneWindow, const std::vector<int>& zoneIndexSet) noexcept;
|
||||
std::vector<size_t> GetZoneIndexSetFromWorkAreaHistory(HWND window, winrt::com_ptr<IZoneWindow> workArea) noexcept;
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<size_t>> GetAppZoneHistoryInfo(HWND window, HMONITOR monitor, std::unordered_map<HMONITOR, winrt::com_ptr<IZoneWindow>>& workAreaMap) noexcept;
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<size_t>> GetAppZoneHistoryInfo(HWND window, HMONITOR monitor, bool isPrimaryMonitor) noexcept;
|
||||
void MoveWindowIntoZone(HWND window, winrt::com_ptr<IZoneWindow> zoneWindow, const std::vector<size_t>& zoneIndexSet) noexcept;
|
||||
|
||||
void OnEditorExitEvent() noexcept;
|
||||
bool ShouldProcessSnapHotkey(DWORD vkCode) noexcept;
|
||||
@@ -357,7 +357,7 @@ bool FancyZones::ShouldProcessNewWindow(HWND window) noexcept
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<int> FancyZones::GetZoneIndexSetFromWorkAreaHistory(
|
||||
std::vector<size_t> FancyZones::GetZoneIndexSetFromWorkAreaHistory(
|
||||
HWND window,
|
||||
winrt::com_ptr<IZoneWindow> workArea) noexcept
|
||||
{
|
||||
@@ -373,7 +373,7 @@ std::vector<int> FancyZones::GetZoneIndexSetFromWorkAreaHistory(
|
||||
return {};
|
||||
}
|
||||
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<int>> FancyZones::GetAppZoneHistoryInfo(
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<size_t>> FancyZones::GetAppZoneHistoryInfo(
|
||||
HWND window,
|
||||
HMONITOR monitor,
|
||||
std::unordered_map<HMONITOR, winrt::com_ptr<IZoneWindow>>& workAreaMap) noexcept
|
||||
@@ -387,9 +387,9 @@ std::pair<winrt::com_ptr<IZoneWindow>, std::vector<int>> FancyZones::GetAppZoneH
|
||||
return { nullptr, {} };
|
||||
}
|
||||
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<int>> FancyZones::GetAppZoneHistoryInfo(HWND window, HMONITOR monitor, bool isPrimaryMonitor) noexcept
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<size_t>> FancyZones::GetAppZoneHistoryInfo(HWND window, HMONITOR monitor, bool isPrimaryMonitor) noexcept
|
||||
{
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<int>> appZoneHistoryInfo{ nullptr, {} };
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<size_t>> appZoneHistoryInfo{ nullptr, {} };
|
||||
auto workAreaMap = m_workAreaHandler.GetWorkAreasByDesktopId(m_currentDesktopId);
|
||||
|
||||
// Search application history on currently active monitor.
|
||||
@@ -411,7 +411,7 @@ std::pair<winrt::com_ptr<IZoneWindow>, std::vector<int>> FancyZones::GetAppZoneH
|
||||
return appZoneHistoryInfo;
|
||||
}
|
||||
|
||||
void FancyZones::MoveWindowIntoZone(HWND window, winrt::com_ptr<IZoneWindow> zoneWindow, const std::vector<int>& zoneIndexSet) noexcept
|
||||
void FancyZones::MoveWindowIntoZone(HWND window, winrt::com_ptr<IZoneWindow> zoneWindow, const std::vector<size_t>& zoneIndexSet) noexcept
|
||||
{
|
||||
auto& fancyZonesData = FancyZonesDataInstance();
|
||||
if (!fancyZonesData.IsAnotherWindowOfApplicationInstanceZoned(window, zoneWindow->UniqueId()))
|
||||
@@ -517,7 +517,7 @@ FancyZones::WindowCreated(HWND window) noexcept
|
||||
if (moveToAppLastZone)
|
||||
{
|
||||
const bool primaryActive = (primary == active);
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<int>> appZoneHistoryInfo = GetAppZoneHistoryInfo(window, active, primaryActive);
|
||||
std::pair<winrt::com_ptr<IZoneWindow>, std::vector<size_t>> appZoneHistoryInfo = GetAppZoneHistoryInfo(window, active, primaryActive);
|
||||
if (!appZoneHistoryInfo.second.empty())
|
||||
{
|
||||
MoveWindowIntoZone(window, appZoneHistoryInfo.first, appZoneHistoryInfo.second);
|
||||
@@ -1006,7 +1006,7 @@ void FancyZones::UpdateWindowsPositions() noexcept
|
||||
|
||||
if (bitmask != 0)
|
||||
{
|
||||
std::vector<int> indexSet;
|
||||
std::vector<size_t> indexSet;
|
||||
for (int i = 0; i < std::numeric_limits<size_t>::digits; i++)
|
||||
{
|
||||
if ((1ull << i) & bitmask)
|
||||
@@ -1110,6 +1110,8 @@ bool FancyZones::OnSnapHotkeyBasedOnZoneNumber(HWND window, DWORD vkCode) noexce
|
||||
return m_windowMoveHandler.MoveWindowIntoZoneByDirectionAndIndex(window, vkCode, true /* cycle through zones */, m_workAreaHandler.GetWorkArea(m_currentDesktopId, current));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FancyZones::OnSnapHotkeyBasedOnPosition(HWND window, DWORD vkCode) noexcept
|
||||
@@ -1185,7 +1187,7 @@ bool FancyZones::OnSnapHotkeyBasedOnPosition(HWND window, DWORD vkCode) noexcept
|
||||
{
|
||||
// Moving to another monitor succeeded
|
||||
const auto& [trueZoneIdx, zoneWindow] = zoneRectsInfo[chosenIdx];
|
||||
m_windowMoveHandler.MoveWindowIntoZoneByIndexSet(window, { static_cast<int>(trueZoneIdx) }, zoneWindow);
|
||||
m_windowMoveHandler.MoveWindowIntoZoneByIndexSet(window, { trueZoneIdx }, zoneWindow);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1227,7 +1229,7 @@ bool FancyZones::OnSnapHotkeyBasedOnPosition(HWND window, DWORD vkCode) noexcept
|
||||
{
|
||||
// Moving to another monitor succeeded
|
||||
const auto& [trueZoneIdx, zoneWindow] = zoneRectsInfo[chosenIdx];
|
||||
m_windowMoveHandler.MoveWindowIntoZoneByIndexSet(window, { static_cast<int>(trueZoneIdx) }, zoneWindow);
|
||||
m_windowMoveHandler.MoveWindowIntoZoneByIndexSet(window, { trueZoneIdx }, zoneWindow);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -244,7 +244,7 @@ void FancyZonesData::UpdateProcessIdToHandleMap(HWND window, const std::wstring_
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<int> FancyZonesData::GetAppLastZoneIndexSet(HWND window, const std::wstring_view& deviceId, const std::wstring_view& zoneSetId) const
|
||||
std::vector<size_t> 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);
|
||||
@@ -319,7 +319,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<int>& zoneIndexSet)
|
||||
bool FancyZonesData::SetAppLastZones(HWND window, const std::wstring& deviceId, const std::wstring& zoneSetId, const std::vector<size_t>& zoneIndexSet)
|
||||
{
|
||||
std::scoped_lock lock{ dataLock };
|
||||
|
||||
|
||||
@@ -65,9 +65,9 @@ public:
|
||||
|
||||
bool IsAnotherWindowOfApplicationInstanceZoned(HWND window, const std::wstring_view& deviceId) const;
|
||||
void UpdateProcessIdToHandleMap(HWND window, const std::wstring_view& deviceId);
|
||||
std::vector<int> GetAppLastZoneIndexSet(HWND window, const std::wstring_view& deviceId, const std::wstring_view& zoneSetId) const;
|
||||
std::vector<size_t> 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<int>& zoneIndexSet);
|
||||
bool SetAppLastZones(HWND window, const std::wstring& deviceId, const std::wstring& zoneSetId, const std::vector<size_t>& zoneIndexSet);
|
||||
|
||||
void SetActiveZoneSet(const std::wstring& deviceId, const FancyZonesDataTypes::ZoneSetData& zoneSet);
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace FancyZonesDataTypes
|
||||
|
||||
std::wstring zoneSetUuid;
|
||||
std::wstring deviceId;
|
||||
std::vector<int> zoneIndexSet;
|
||||
std::vector<size_t> zoneIndexSet;
|
||||
};
|
||||
|
||||
struct DeviceInfoData
|
||||
|
||||
@@ -79,12 +79,12 @@ namespace
|
||||
data.zoneIndexSet = {};
|
||||
for (auto& value : json.GetNamedArray(NonLocalizable::ZoneIndexSetStr))
|
||||
{
|
||||
data.zoneIndexSet.push_back(static_cast<int>(value.GetNumber()));
|
||||
data.zoneIndexSet.push_back(static_cast<size_t>(value.GetNumber()));
|
||||
}
|
||||
}
|
||||
else if (json.HasKey(NonLocalizable::ZoneIndexStr))
|
||||
{
|
||||
data.zoneIndexSet = { static_cast<int>(json.GetNamedNumber(NonLocalizable::ZoneIndexStr)) };
|
||||
data.zoneIndexSet = { static_cast<size_t>(json.GetNamedNumber(NonLocalizable::ZoneIndexStr)) };
|
||||
}
|
||||
|
||||
data.deviceId = json.GetNamedString(NonLocalizable::DeviceIdStr);
|
||||
@@ -338,9 +338,9 @@ namespace JSONHelpers
|
||||
{
|
||||
json::JsonObject desktopData;
|
||||
json::JsonArray jsonIndexSet;
|
||||
for (int index : data.zoneIndexSet)
|
||||
for (size_t index : data.zoneIndexSet)
|
||||
{
|
||||
jsonIndexSet.Append(json::value(index));
|
||||
jsonIndexSet.Append(json::value(static_cast<int>(index)));
|
||||
}
|
||||
|
||||
desktopData.SetNamedValue(NonLocalizable::ZoneIndexSetStr, jsonIndexSet);
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
void MoveSizeUpdate(HMONITOR monitor, POINT const& ptScreen, const std::unordered_map<HMONITOR, winrt::com_ptr<IZoneWindow>>& zoneWindowMap) noexcept;
|
||||
void MoveSizeEnd(HWND window, POINT const& ptScreen, const std::unordered_map<HMONITOR, winrt::com_ptr<IZoneWindow>>& zoneWindowMap) noexcept;
|
||||
|
||||
void MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<int>& indexSet, winrt::com_ptr<IZoneWindow> zoneWindow) noexcept;
|
||||
void MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<size_t>& indexSet, winrt::com_ptr<IZoneWindow> zoneWindow) noexcept;
|
||||
bool MoveWindowIntoZoneByDirectionAndIndex(HWND window, DWORD vkCode, bool cycle, winrt::com_ptr<IZoneWindow> zoneWindow);
|
||||
bool MoveWindowIntoZoneByDirectionAndPosition(HWND window, DWORD vkCode, bool cycle, winrt::com_ptr<IZoneWindow> zoneWindow);
|
||||
|
||||
@@ -155,7 +155,7 @@ void WindowMoveHandler::MoveSizeEnd(HWND window, POINT const& ptScreen, const st
|
||||
pimpl->MoveSizeEnd(window, ptScreen, zoneWindowMap);
|
||||
}
|
||||
|
||||
void WindowMoveHandler::MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<int>& indexSet, winrt::com_ptr<IZoneWindow> zoneWindow) noexcept
|
||||
void WindowMoveHandler::MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<size_t>& indexSet, winrt::com_ptr<IZoneWindow> zoneWindow) noexcept
|
||||
{
|
||||
pimpl->MoveWindowIntoZoneByIndexSet(window, indexSet, zoneWindow);
|
||||
}
|
||||
@@ -362,7 +362,7 @@ void WindowMoveHandlerPrivate::MoveSizeEnd(HWND window, POINT const& ptScreen, c
|
||||
}
|
||||
}
|
||||
|
||||
void WindowMoveHandlerPrivate::MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<int>& indexSet, winrt::com_ptr<IZoneWindow> zoneWindow) noexcept
|
||||
void WindowMoveHandlerPrivate::MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<size_t>& indexSet, winrt::com_ptr<IZoneWindow> zoneWindow) noexcept
|
||||
{
|
||||
if (window != m_windowMoveSize)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
void MoveSizeUpdate(HMONITOR monitor, POINT const& ptScreen, const std::unordered_map<HMONITOR, winrt::com_ptr<IZoneWindow>>& zoneWindowMap) noexcept;
|
||||
void MoveSizeEnd(HWND window, POINT const& ptScreen, const std::unordered_map<HMONITOR, winrt::com_ptr<IZoneWindow>>& zoneWindowMap) noexcept;
|
||||
|
||||
void MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<int>& indexSet, winrt::com_ptr<IZoneWindow> zoneWindow) noexcept;
|
||||
void MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<size_t>& indexSet, winrt::com_ptr<IZoneWindow> zoneWindow) noexcept;
|
||||
bool MoveWindowIntoZoneByDirectionAndIndex(HWND window, DWORD vkCode, bool cycle, winrt::com_ptr<IZoneWindow> zoneWindow);
|
||||
bool MoveWindowIntoZoneByDirectionAndPosition(HWND window, DWORD vkCode, bool cycle, winrt::com_ptr<IZoneWindow> zoneWindow);
|
||||
|
||||
|
||||
@@ -127,16 +127,16 @@ public:
|
||||
IFACEMETHODIMP_(FancyZonesDataTypes::ZoneSetLayoutType)
|
||||
LayoutType() noexcept { return m_config.LayoutType; }
|
||||
IFACEMETHODIMP AddZone(winrt::com_ptr<IZone> zone) noexcept;
|
||||
IFACEMETHODIMP_(std::vector<int>)
|
||||
IFACEMETHODIMP_(std::vector<size_t>)
|
||||
ZonesFromPoint(POINT pt) noexcept;
|
||||
IFACEMETHODIMP_(std::vector<int>)
|
||||
IFACEMETHODIMP_(std::vector<size_t>)
|
||||
GetZoneIndexSetFromWindow(HWND window) noexcept;
|
||||
IFACEMETHODIMP_(std::vector<winrt::com_ptr<IZone>>)
|
||||
GetZones() noexcept { return m_zones; }
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByIndex(HWND window, HWND zoneWindow, int index) noexcept;
|
||||
MoveWindowIntoZoneByIndex(HWND window, HWND zoneWindow, size_t index) noexcept;
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByIndexSet(HWND window, HWND windowZone, const std::vector<int>& indexSet) noexcept;
|
||||
MoveWindowIntoZoneByIndexSet(HWND window, HWND windowZone, const std::vector<size_t>& indexSet) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
MoveWindowIntoZoneByDirectionAndIndex(HWND window, HWND zoneWindow, DWORD vkCode, bool cycle) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
@@ -158,7 +158,7 @@ private:
|
||||
void StampWindow(HWND window, size_t bitmask) noexcept;
|
||||
|
||||
std::vector<winrt::com_ptr<IZone>> m_zones;
|
||||
std::map<HWND, std::vector<int>> m_windowIndexSet;
|
||||
std::map<HWND, std::vector<size_t>> m_windowIndexSet;
|
||||
ZoneSetConfig m_config;
|
||||
};
|
||||
|
||||
@@ -172,12 +172,12 @@ IFACEMETHODIMP ZoneSet::AddZone(winrt::com_ptr<IZone> zone) noexcept
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(std::vector<int>)
|
||||
IFACEMETHODIMP_(std::vector<size_t>)
|
||||
ZoneSet::ZonesFromPoint(POINT pt) noexcept
|
||||
{
|
||||
const int SENSITIVITY_RADIUS = 20;
|
||||
std::vector<int> capturedZones;
|
||||
std::vector<int> strictlyCapturedZones;
|
||||
std::vector<size_t> capturedZones;
|
||||
std::vector<size_t> strictlyCapturedZones;
|
||||
for (size_t i = 0; i < m_zones.size(); i++)
|
||||
{
|
||||
auto zone = m_zones[i];
|
||||
@@ -187,13 +187,13 @@ ZoneSet::ZonesFromPoint(POINT pt) noexcept
|
||||
if (newZoneRect.left - SENSITIVITY_RADIUS <= pt.x && pt.x <= newZoneRect.right + SENSITIVITY_RADIUS &&
|
||||
newZoneRect.top - SENSITIVITY_RADIUS <= pt.y && pt.y <= newZoneRect.bottom + SENSITIVITY_RADIUS)
|
||||
{
|
||||
capturedZones.emplace_back(static_cast<int>(i));
|
||||
capturedZones.emplace_back(i);
|
||||
}
|
||||
|
||||
if (newZoneRect.left <= pt.x && pt.x < newZoneRect.right &&
|
||||
newZoneRect.top <= pt.y && pt.y < newZoneRect.bottom)
|
||||
{
|
||||
strictlyCapturedZones.emplace_back(static_cast<int>(i));
|
||||
strictlyCapturedZones.emplace_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ ZoneSet::ZonesFromPoint(POINT pt) noexcept
|
||||
return capturedZones;
|
||||
}
|
||||
|
||||
std::vector<int> ZoneSet::GetZoneIndexSetFromWindow(HWND window) noexcept
|
||||
std::vector<size_t> ZoneSet::GetZoneIndexSetFromWindow(HWND window) noexcept
|
||||
{
|
||||
auto it = m_windowIndexSet.find(window);
|
||||
if (it == m_windowIndexSet.end())
|
||||
@@ -261,13 +261,13 @@ std::vector<int> ZoneSet::GetZoneIndexSetFromWindow(HWND window) noexcept
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
ZoneSet::MoveWindowIntoZoneByIndex(HWND window, HWND windowZone, int index) noexcept
|
||||
ZoneSet::MoveWindowIntoZoneByIndex(HWND window, HWND windowZone, size_t index) noexcept
|
||||
{
|
||||
MoveWindowIntoZoneByIndexSet(window, windowZone, { index });
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
ZoneSet::MoveWindowIntoZoneByIndexSet(HWND window, HWND windowZone, const std::vector<int>& indexSet) noexcept
|
||||
ZoneSet::MoveWindowIntoZoneByIndexSet(HWND window, HWND windowZone, const std::vector<size_t>& indexSet) noexcept
|
||||
{
|
||||
if (m_zones.empty())
|
||||
{
|
||||
@@ -281,9 +281,9 @@ ZoneSet::MoveWindowIntoZoneByIndexSet(HWND window, HWND windowZone, const std::v
|
||||
auto& storedIndexSet = m_windowIndexSet[window];
|
||||
storedIndexSet = {};
|
||||
|
||||
for (int index : indexSet)
|
||||
for (size_t index : indexSet)
|
||||
{
|
||||
if (index < static_cast<int>(m_zones.size()))
|
||||
if (index < m_zones.size())
|
||||
{
|
||||
RECT newSize = m_zones.at(index)->ComputeActualZoneRect(window, windowZone);
|
||||
if (!sizeEmpty)
|
||||
@@ -325,7 +325,7 @@ ZoneSet::MoveWindowIntoZoneByDirectionAndIndex(HWND window, HWND windowZone, DWO
|
||||
}
|
||||
|
||||
auto indexSet = GetZoneIndexSetFromWindow(window);
|
||||
int numZones = static_cast<int>(m_zones.size());
|
||||
size_t numZones = m_zones.size();
|
||||
|
||||
// The window was not assigned to any zone here
|
||||
if (indexSet.size() == 0)
|
||||
@@ -334,7 +334,7 @@ ZoneSet::MoveWindowIntoZoneByDirectionAndIndex(HWND window, HWND windowZone, DWO
|
||||
return true;
|
||||
}
|
||||
|
||||
int oldIndex = indexSet[0];
|
||||
size_t oldIndex = indexSet[0];
|
||||
|
||||
// We reached the edge
|
||||
if ((vkCode == VK_LEFT && oldIndex == 0) || (vkCode == VK_RIGHT && oldIndex == numZones - 1))
|
||||
|
||||
@@ -33,14 +33,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<int>, ZonesFromPoint)(POINT pt) = 0;
|
||||
IFACEMETHOD_(std::vector<size_t>, ZonesFromPoint)(POINT pt) = 0;
|
||||
/**
|
||||
* Get index set of the zones to which the window was assigned.
|
||||
*
|
||||
* @param window Handle of the window.
|
||||
* @returns A vector of integers, 0-based, the index set.
|
||||
* @returns A vector of size_t, 0-based, the index set.
|
||||
*/
|
||||
IFACEMETHOD_(std::vector<int>, GetZoneIndexSetFromWindow)(HWND window) = 0;
|
||||
IFACEMETHOD_(std::vector<size_t>, GetZoneIndexSetFromWindow)(HWND window) = 0;
|
||||
/**
|
||||
* @returns Array of zone objects (defining coordinates of the zone) inside this zone layout.
|
||||
*/
|
||||
@@ -53,7 +53,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 zoneWindow, int index) = 0;
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndex)(HWND window, HWND zoneWindow, size_t index) = 0;
|
||||
/**
|
||||
* Assign window to the zones based on the set of zone indices inside zone layout.
|
||||
*
|
||||
@@ -62,7 +62,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 zoneWindow, const std::vector<int>& indexSet) = 0;
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndexSet)(HWND window, HWND zoneWindow, const std::vector<size_t>& 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.
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace ZoneWindowDrawUtils
|
||||
COLORREF highlightColor,
|
||||
int zoneOpacity,
|
||||
const std::vector<winrt::com_ptr<IZone>>& zones,
|
||||
const std::vector<int>& highlightZones,
|
||||
const std::vector<size_t>& highlightZones,
|
||||
bool flashMode,
|
||||
bool drawHints) noexcept
|
||||
{
|
||||
@@ -134,7 +134,7 @@ namespace ZoneWindowDrawUtils
|
||||
ColorSetting const colorFlash{ OpacitySettingToAlpha(zoneOpacity), RGB(81, 92, 107), 200, RGB(104, 118, 138), -2 };
|
||||
|
||||
std::vector<bool> isHighlighted(zones.size(), false);
|
||||
for (int x : highlightZones)
|
||||
for (size_t x : highlightZones)
|
||||
{
|
||||
isHighlighted[x] = true;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ namespace ZoneWindowDrawUtils
|
||||
// First draw the inactive zones
|
||||
for (auto iter = zones.begin(); iter != zones.end(); iter++)
|
||||
{
|
||||
int zoneId = static_cast<int>(iter - zones.begin());
|
||||
size_t zoneId = iter - zones.begin();
|
||||
winrt::com_ptr<IZone> zone = iter->try_as<IZone>();
|
||||
if (!zone)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ namespace ZoneWindowDrawUtils
|
||||
// Draw the active zones on top of the inactive zones
|
||||
for (auto iter = zones.begin(); iter != zones.end(); iter++)
|
||||
{
|
||||
int zoneId = static_cast<int>(iter - zones.begin());
|
||||
size_t zoneId = iter - zones.begin();
|
||||
winrt::com_ptr<IZone> zone = iter->try_as<IZone>();
|
||||
if (!zone)
|
||||
{
|
||||
@@ -199,9 +199,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, int index) noexcept;
|
||||
MoveWindowIntoZoneByIndex(HWND window, size_t index) noexcept;
|
||||
IFACEMETHODIMP_(void)
|
||||
MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<int>& indexSet) noexcept;
|
||||
MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<size_t>& indexSet) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
MoveWindowIntoZoneByDirectionAndIndex(HWND window, DWORD vkCode, bool cycle) noexcept;
|
||||
IFACEMETHODIMP_(bool)
|
||||
@@ -233,7 +233,7 @@ private:
|
||||
LRESULT WndProc(UINT message, WPARAM wparam, LPARAM lparam) noexcept;
|
||||
void OnPaint(wil::unique_hdc& hdc) noexcept;
|
||||
void OnKeyUp(WPARAM wparam) noexcept;
|
||||
std::vector<int> ZonesFromPoint(POINT pt) noexcept;
|
||||
std::vector<size_t> ZonesFromPoint(POINT pt) noexcept;
|
||||
void CycleActiveZoneSetInternal(DWORD wparam, Trace::ZoneWindow::InputMode mode) noexcept;
|
||||
void FlashZones() noexcept;
|
||||
|
||||
@@ -246,8 +246,8 @@ private:
|
||||
bool m_flashMode{};
|
||||
winrt::com_ptr<IZoneSet> m_activeZoneSet;
|
||||
std::vector<winrt::com_ptr<IZoneSet>> m_zoneSets;
|
||||
std::vector<int> m_initialHighlightZone;
|
||||
std::vector<int> m_highlightZone;
|
||||
std::vector<size_t> m_initialHighlightZone;
|
||||
std::vector<size_t> m_highlightZone;
|
||||
WPARAM m_keyLast{};
|
||||
size_t m_keyCycle{};
|
||||
static const UINT m_showAnimationDuration = 200; // ms
|
||||
@@ -360,14 +360,14 @@ IFACEMETHODIMP ZoneWindow::MoveSizeUpdate(POINT const& ptScreen, bool dragEnable
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<int> newHighlightZone;
|
||||
std::vector<size_t> newHighlightZone;
|
||||
std::set_union(begin(highlightZone), end(highlightZone), begin(m_initialHighlightZone), end(m_initialHighlightZone), std::back_inserter(newHighlightZone));
|
||||
|
||||
RECT boundingRect;
|
||||
bool boundingRectEmpty = true;
|
||||
auto zones = m_activeZoneSet->GetZones();
|
||||
|
||||
for (int zoneId : newHighlightZone)
|
||||
for (size_t zoneId : newHighlightZone)
|
||||
{
|
||||
RECT rect = zones[zoneId]->GetZoneRect();
|
||||
if (boundingRectEmpty)
|
||||
@@ -394,7 +394,7 @@ IFACEMETHODIMP ZoneWindow::MoveSizeUpdate(POINT const& ptScreen, bool dragEnable
|
||||
if (boundingRect.left <= rect.left && rect.right <= boundingRect.right &&
|
||||
boundingRect.top <= rect.top && rect.bottom <= boundingRect.bottom)
|
||||
{
|
||||
highlightZone.push_back(static_cast<int>(zoneId));
|
||||
highlightZone.push_back(zoneId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -444,13 +444,13 @@ IFACEMETHODIMP ZoneWindow::MoveSizeEnd(HWND window, POINT const& ptScreen) noexc
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
ZoneWindow::MoveWindowIntoZoneByIndex(HWND window, int index) noexcept
|
||||
ZoneWindow::MoveWindowIntoZoneByIndex(HWND window, size_t index) noexcept
|
||||
{
|
||||
MoveWindowIntoZoneByIndexSet(window, { index });
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(void)
|
||||
ZoneWindow::MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<int>& indexSet) noexcept
|
||||
ZoneWindow::MoveWindowIntoZoneByIndexSet(HWND window, const std::vector<size_t>& indexSet) noexcept
|
||||
{
|
||||
if (m_activeZoneSet)
|
||||
{
|
||||
@@ -747,7 +747,7 @@ void ZoneWindow::OnKeyUp(WPARAM wparam) noexcept
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<int> ZoneWindow::ZonesFromPoint(POINT pt) noexcept
|
||||
std::vector<size_t> ZoneWindow::ZonesFromPoint(POINT pt) noexcept
|
||||
{
|
||||
if (m_activeZoneSet)
|
||||
{
|
||||
|
||||
@@ -49,14 +49,14 @@ interface __declspec(uuid("{7F017528-8110-4FB3-BE41-F472969C2560}")) IZoneWindow
|
||||
* @param window Handle of window which should be assigned to zone.
|
||||
* @param index Zone index within zone layout.
|
||||
*/
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndex)(HWND window, int index) = 0;
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndex)(HWND window, size_t 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<int>& indexSet) = 0;
|
||||
IFACEMETHOD_(void, MoveWindowIntoZoneByIndexSet)(HWND window, const std::vector<size_t>& 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.
|
||||
|
||||
Reference in New Issue
Block a user