[FancyZones] fix warnings (#6095)

unified data type to size_t in all methods that process the zone index set
This commit is contained in:
Enrico Giordani
2020-08-24 14:39:34 +02:00
committed by GitHub
parent 845bb466c6
commit 2817bf4d62
15 changed files with 145 additions and 144 deletions

View File

@@ -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))