mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
Remove m_drawHints, fix duplicate zone drawing (#7300)
This commit is contained in:
@@ -30,7 +30,7 @@ struct Settings
|
|||||||
bool showZonesOnAllMonitors = false;
|
bool showZonesOnAllMonitors = false;
|
||||||
bool spanZonesAcrossMonitors = false;
|
bool spanZonesAcrossMonitors = false;
|
||||||
bool makeDraggedWindowTransparent = true;
|
bool makeDraggedWindowTransparent = true;
|
||||||
std::wstring zoneColor = L"#F5FCFF";
|
std::wstring zoneColor = L"#AACDFF";
|
||||||
std::wstring zoneBorderColor = L"#FFFFFF";
|
std::wstring zoneBorderColor = L"#FFFFFF";
|
||||||
std::wstring zoneHighlightColor = L"#008CFF";
|
std::wstring zoneHighlightColor = L"#008CFF";
|
||||||
int zoneHighlightOpacity = 50;
|
int zoneHighlightOpacity = 50;
|
||||||
|
|||||||
@@ -71,8 +71,7 @@ namespace ZoneWindowUtils
|
|||||||
int hostZoneHighlightOpacity,
|
int hostZoneHighlightOpacity,
|
||||||
std::vector<winrt::com_ptr<IZone>> zones,
|
std::vector<winrt::com_ptr<IZone>> zones,
|
||||||
std::vector<size_t> highlightZone,
|
std::vector<size_t> highlightZone,
|
||||||
bool flashMode,
|
bool flashMode)
|
||||||
bool drawHints)
|
|
||||||
{
|
{
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
HDC oldHdc = hdc;
|
HDC oldHdc = hdc;
|
||||||
@@ -99,8 +98,7 @@ namespace ZoneWindowUtils
|
|||||||
hostZoneHighlightOpacity,
|
hostZoneHighlightOpacity,
|
||||||
zones,
|
zones,
|
||||||
highlightZone,
|
highlightZone,
|
||||||
flashMode,
|
flashMode);
|
||||||
drawHints);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EndBufferedPaint(bufferedPaint, TRUE);
|
EndBufferedPaint(bufferedPaint, TRUE);
|
||||||
@@ -170,7 +168,6 @@ private:
|
|||||||
std::wstring m_uniqueId; // Parsed deviceId + resolution + virtualDesktopId
|
std::wstring m_uniqueId; // Parsed deviceId + resolution + virtualDesktopId
|
||||||
wil::unique_hwnd m_window{}; // Hidden tool window used to represent current monitor desktop work area.
|
wil::unique_hwnd m_window{}; // Hidden tool window used to represent current monitor desktop work area.
|
||||||
HWND m_windowMoveSize{};
|
HWND m_windowMoveSize{};
|
||||||
bool m_drawHints{};
|
|
||||||
bool m_flashMode{};
|
bool m_flashMode{};
|
||||||
winrt::com_ptr<IZoneSet> m_activeZoneSet;
|
winrt::com_ptr<IZoneSet> m_activeZoneSet;
|
||||||
std::vector<winrt::com_ptr<IZoneSet>> m_zoneSets;
|
std::vector<winrt::com_ptr<IZoneSet>> m_zoneSets;
|
||||||
@@ -266,7 +263,6 @@ bool ZoneWindow::Init(IZoneWindowHost* host, HINSTANCE hinstance, HMONITOR monit
|
|||||||
IFACEMETHODIMP ZoneWindow::MoveSizeEnter(HWND window) noexcept
|
IFACEMETHODIMP ZoneWindow::MoveSizeEnter(HWND window) noexcept
|
||||||
{
|
{
|
||||||
m_windowMoveSize = window;
|
m_windowMoveSize = window;
|
||||||
m_drawHints = true;
|
|
||||||
m_highlightZone = {};
|
m_highlightZone = {};
|
||||||
m_initialHighlightZone = {};
|
m_initialHighlightZone = {};
|
||||||
ShowZoneWindow();
|
ShowZoneWindow();
|
||||||
@@ -477,7 +473,6 @@ ZoneWindow::HideZoneWindow() noexcept
|
|||||||
ShowWindow(m_window.get(), SW_HIDE);
|
ShowWindow(m_window.get(), SW_HIDE);
|
||||||
m_keyLast = 0;
|
m_keyLast = 0;
|
||||||
m_windowMoveSize = nullptr;
|
m_windowMoveSize = nullptr;
|
||||||
m_drawHints = false;
|
|
||||||
m_highlightZone = {};
|
m_highlightZone = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -629,7 +624,6 @@ void ZoneWindow::OnPaint(HDC hdc) noexcept
|
|||||||
std::vector<winrt::com_ptr<IZone>> zones{};
|
std::vector<winrt::com_ptr<IZone>> zones{};
|
||||||
std::vector<size_t> highlightZone = m_highlightZone;
|
std::vector<size_t> highlightZone = m_highlightZone;
|
||||||
bool flashMode = m_flashMode;
|
bool flashMode = m_flashMode;
|
||||||
bool drawHints = m_drawHints;
|
|
||||||
|
|
||||||
if (hasActiveZoneSet)
|
if (hasActiveZoneSet)
|
||||||
{
|
{
|
||||||
@@ -651,8 +645,7 @@ void ZoneWindow::OnPaint(HDC hdc) noexcept
|
|||||||
hostZoneHighlightOpacity,
|
hostZoneHighlightOpacity,
|
||||||
zones,
|
zones,
|
||||||
highlightZone,
|
highlightZone,
|
||||||
flashMode,
|
flashMode);
|
||||||
drawHints);
|
|
||||||
} };
|
} };
|
||||||
|
|
||||||
if (m_animating)
|
if (m_animating)
|
||||||
|
|||||||
@@ -114,11 +114,9 @@ namespace ZoneWindowDrawing
|
|||||||
int zoneOpacity,
|
int zoneOpacity,
|
||||||
const std::vector<winrt::com_ptr<IZone>>& zones,
|
const std::vector<winrt::com_ptr<IZone>>& zones,
|
||||||
const std::vector<size_t>& highlightZones,
|
const std::vector<size_t>& highlightZones,
|
||||||
bool flashMode,
|
bool flashMode) noexcept
|
||||||
bool drawHints) noexcept
|
|
||||||
{
|
{
|
||||||
// { fillAlpha, fill, borderAlpha, border, thickness }
|
// { fillAlpha, fill, borderAlpha, border, thickness }
|
||||||
ColorSetting const colorHints{ OpacitySettingToAlpha(zoneOpacity), RGB(81, 92, 107), 255, RGB(104, 118, 138), -2 };
|
|
||||||
ColorSetting colorViewer{ OpacitySettingToAlpha(zoneOpacity), 0, 255, RGB(40, 50, 60), -2 };
|
ColorSetting colorViewer{ OpacitySettingToAlpha(zoneOpacity), 0, 255, RGB(40, 50, 60), -2 };
|
||||||
ColorSetting colorHighlight{ OpacitySettingToAlpha(zoneOpacity), 0, 255, 0, -2 };
|
ColorSetting colorHighlight{ OpacitySettingToAlpha(zoneOpacity), 0, 255, 0, -2 };
|
||||||
ColorSetting const colorFlash{ OpacitySettingToAlpha(zoneOpacity), RGB(81, 92, 107), 200, RGB(104, 118, 138), -2 };
|
ColorSetting const colorFlash{ OpacitySettingToAlpha(zoneOpacity), RGB(81, 92, 107), 200, RGB(104, 118, 138), -2 };
|
||||||
@@ -145,10 +143,7 @@ namespace ZoneWindowDrawing
|
|||||||
{
|
{
|
||||||
DrawZone(hdc, colorFlash, zone, zones, flashMode);
|
DrawZone(hdc, colorFlash, zone, zones, flashMode);
|
||||||
}
|
}
|
||||||
else if (drawHints)
|
else
|
||||||
{
|
|
||||||
DrawZone(hdc, colorHints, zone, zones, flashMode);
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
colorViewer.fill = zoneColor;
|
colorViewer.fill = zoneColor;
|
||||||
colorViewer.border = zoneBorderColor;
|
colorViewer.border = zoneBorderColor;
|
||||||
|
|||||||
@@ -26,6 +26,5 @@ namespace ZoneWindowDrawing
|
|||||||
int zoneOpacity,
|
int zoneOpacity,
|
||||||
const std::vector<winrt::com_ptr<IZone>>& zones,
|
const std::vector<winrt::com_ptr<IZone>>& zones,
|
||||||
const std::vector<size_t>& highlightZones,
|
const std::vector<size_t>& highlightZones,
|
||||||
bool flashMode,
|
bool flashMode) noexcept;
|
||||||
bool drawHints) noexcept;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user