From 0af6348913ebcb38dc775d298800e4a8e6dfaf3c Mon Sep 17 00:00:00 2001 From: PrzemyslawTusinski <61138537+PrzemyslawTusinski@users.noreply.github.com> Date: Fri, 13 Mar 2020 15:56:23 +0100 Subject: [PATCH] Fancy zones: show active layouts on all monitors (#1553) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added option to show fancy zones on all monitors with layouts simultaneously Co-authored-by: Ivan Stošić --- src/modules/fancyzones/lib/FancyZones.cpp | 48 +++++++++++++++++-- src/modules/fancyzones/lib/Settings.cpp | 3 +- src/modules/fancyzones/lib/Settings.h | 1 + src/modules/fancyzones/lib/ZoneWindow.cpp | 23 +++++---- src/modules/fancyzones/lib/ZoneWindow.h | 6 +-- src/modules/fancyzones/lib/fancyzones.rc | 1 + src/modules/fancyzones/lib/resource.h | 17 +++---- src/modules/fancyzones/lib/trace.cpp | 1 + .../tests/UnitTests/FancyZones.Spec.cpp | 4 ++ .../UnitTests/FancyZonesSettings.Spec.cpp | 21 ++++++++ .../tests/UnitTests/ZoneWindow.Spec.cpp | 10 ---- 11 files changed, 95 insertions(+), 40 deletions(-) diff --git a/src/modules/fancyzones/lib/FancyZones.cpp b/src/modules/fancyzones/lib/FancyZones.cpp index 69f9cdaa30..3bbf9926a0 100644 --- a/src/modules/fancyzones/lib/FancyZones.cpp +++ b/src/modules/fancyzones/lib/FancyZones.cpp @@ -883,11 +883,30 @@ void FancyZones::MoveSizeStartInternal(HWND window, HMONITOR monitor, POINT cons { m_zoneWindowMoveSize = iter->second; m_zoneWindowMoveSize->MoveSizeEnter(window, m_dragEnabled); + if (m_settings->GetSettings().showZonesOnAllMonitors) + { + for (auto [keyMonitor, zoneWindow] : m_zoneWindowMap) + { + // Skip calling ShowZoneWindow for iter->second (m_zoneWindowMoveSize) since it + // was already called in MoveSizeEnter + const bool moveSizeEnterCalled = zoneWindow == m_zoneWindowMoveSize; + if (zoneWindow && !moveSizeEnterCalled) + { + zoneWindow->ShowZoneWindow(); + } + } + } } else if (m_zoneWindowMoveSize) { - m_zoneWindowMoveSize->MoveSizeCancel(); m_zoneWindowMoveSize = nullptr; + for (auto [keyMonitor, zoneWindow] : m_zoneWindowMap) + { + if (zoneWindow) + { + zoneWindow->HideZoneWindow(); + } + } } } @@ -924,6 +943,15 @@ void FancyZones::MoveSizeEndInternal(HWND window, POINT const& ptScreen, require } } } + + // Also, hide all windows (regardless of settings) + for (auto [keyMonitor, zoneWindow] : m_zoneWindowMap) + { + if (zoneWindow) + { + zoneWindow->HideZoneWindow(); + } + } } void FancyZones::MoveSizeUpdateInternal(HMONITOR monitor, POINT const& ptScreen, require_write_lock writeLock) noexcept @@ -938,9 +966,15 @@ void FancyZones::MoveSizeUpdateInternal(HMONITOR monitor, POINT const& ptScreen, // Update the ZoneWindow already handling move/size if (!m_dragEnabled) { - // Drag got disabled, tell it to cancel and clear out m_zoneWindowMoveSize - auto zoneWindow = std::move(m_zoneWindowMoveSize); - zoneWindow->MoveSizeCancel(); + // Drag got disabled, tell it to cancel and hide all windows + m_zoneWindowMoveSize = nullptr; + for (auto [keyMonitor, zoneWindow] : m_zoneWindowMap) + { + if (zoneWindow) + { + zoneWindow->HideZoneWindow(); + } + } } else { @@ -951,7 +985,11 @@ void FancyZones::MoveSizeUpdateInternal(HMONITOR monitor, POINT const& ptScreen, { // The drag has moved to a different monitor. auto const isDragEnabled = m_zoneWindowMoveSize->IsDragEnabled(); - m_zoneWindowMoveSize->MoveSizeCancel(); + // only hide if the option to show all zones is off + if (!m_settings->GetSettings().showZonesOnAllMonitors) + { + m_zoneWindowMoveSize->HideZoneWindow(); + } m_zoneWindowMoveSize = iter->second; m_zoneWindowMoveSize->MoveSizeEnter(m_windowMoveSize, isDragEnabled); } diff --git a/src/modules/fancyzones/lib/Settings.cpp b/src/modules/fancyzones/lib/Settings.cpp index 67dd9e2608..fbd234e28e 100644 --- a/src/modules/fancyzones/lib/Settings.cpp +++ b/src/modules/fancyzones/lib/Settings.cpp @@ -36,7 +36,7 @@ private: PCWSTR name; bool* value; int resourceId; - } m_configBools[8] = { + } m_configBools[9] = { { L"fancyzones_shiftDrag", &m_settings.shiftDrag, IDS_SETTING_DESCRIPTION_SHIFTDRAG }, { L"fancyzones_overrideSnapHotkeys", &m_settings.overrideSnapHotkeys, IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS }, { L"fancyzones_zoneSetChange_flashZones", &m_settings.zoneSetChange_flashZones, IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES }, @@ -45,6 +45,7 @@ private: { L"fancyzones_virtualDesktopChange_moveWindows", &m_settings.virtualDesktopChange_moveWindows, IDS_SETTING_DESCRIPTION_VIRTUALDESKTOPCHANGE_MOVEWINDOWS }, { L"fancyzones_appLastZone_moveWindows", &m_settings.appLastZone_moveWindows, IDS_SETTING_DESCRIPTION_APPLASTZONE_MOVEWINDOWS }, { L"use_cursorpos_editor_startupscreen", &m_settings.use_cursorpos_editor_startupscreen, IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN }, + { L"fancyzones_show_on_all_monitors", &m_settings.showZonesOnAllMonitors, IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS}, }; const std::wstring m_zoneHiglightName = L"fancyzones_zoneHighlightColor"; diff --git a/src/modules/fancyzones/lib/Settings.h b/src/modules/fancyzones/lib/Settings.h index f2532eb966..c42db220bc 100644 --- a/src/modules/fancyzones/lib/Settings.h +++ b/src/modules/fancyzones/lib/Settings.h @@ -14,6 +14,7 @@ struct Settings bool overrideSnapHotkeys = false; bool appLastZone_moveWindows = false; bool use_cursorpos_editor_startupscreen = true; + bool showZonesOnAllMonitors = false; std::wstring zoneHightlightColor = L"#0078D7"; int zoneHighlightOpacity = 90; PowerToysSettings::HotkeyObject editorHotkey = PowerToysSettings::HotkeyObject::from_settings(true, false, false, false, VK_OEM_3); diff --git a/src/modules/fancyzones/lib/ZoneWindow.cpp b/src/modules/fancyzones/lib/ZoneWindow.cpp index 470c4d9064..9170d0562c 100644 --- a/src/modules/fancyzones/lib/ZoneWindow.cpp +++ b/src/modules/fancyzones/lib/ZoneWindow.cpp @@ -279,7 +279,6 @@ public: IFACEMETHODIMP MoveSizeEnter(HWND window, bool dragEnabled) noexcept; IFACEMETHODIMP MoveSizeUpdate(POINT const& ptScreen, bool dragEnabled) noexcept; IFACEMETHODIMP MoveSizeEnd(HWND window, POINT const& ptScreen) noexcept; - IFACEMETHODIMP MoveSizeCancel() noexcept; IFACEMETHODIMP_(bool) IsDragEnabled() noexcept { return m_dragEnabled; } IFACEMETHODIMP_(void) @@ -296,13 +295,16 @@ public: SaveWindowProcessToZoneIndex(HWND window) noexcept; IFACEMETHODIMP_(IZoneSet*) ActiveZoneSet() noexcept { return m_activeZoneSet.get(); } + IFACEMETHODIMP_(void) + ShowZoneWindow() noexcept; + IFACEMETHODIMP_(void) + HideZoneWindow() noexcept; protected: static LRESULT CALLBACK s_WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) noexcept; private: - void ShowZoneWindow() noexcept; - void HideZoneWindow() noexcept; + void LoadSettings() noexcept; void InitializeZoneSets(MONITORINFO const& mi) noexcept; void CalculateZoneSet() noexcept; @@ -455,12 +457,6 @@ IFACEMETHODIMP ZoneWindow::MoveSizeEnd(HWND window, POINT const& ptScreen) noexc return S_OK; } -IFACEMETHODIMP ZoneWindow::MoveSizeCancel() noexcept -{ - HideZoneWindow(); - return S_OK; -} - IFACEMETHODIMP_(void) ZoneWindow::MoveWindowIntoZoneByIndex(HWND window, int index) noexcept { @@ -514,8 +510,8 @@ ZoneWindow::SaveWindowProcessToZoneIndex(HWND window) noexcept } } -#pragma region private -void ZoneWindow::ShowZoneWindow() noexcept +IFACEMETHODIMP_(void) +ZoneWindow::ShowZoneWindow() noexcept { if (m_window) { @@ -536,7 +532,8 @@ void ZoneWindow::ShowZoneWindow() noexcept } } -void ZoneWindow::HideZoneWindow() noexcept +IFACEMETHODIMP_(void) +ZoneWindow::HideZoneWindow() noexcept { if (m_window) { @@ -548,6 +545,8 @@ void ZoneWindow::HideZoneWindow() noexcept } } +#pragma region private + void ZoneWindow::LoadSettings() noexcept { JSONHelpers::FancyZonesDataInstance().AddDevice(m_uniqueId); diff --git a/src/modules/fancyzones/lib/ZoneWindow.h b/src/modules/fancyzones/lib/ZoneWindow.h index 05a1e3862c..d2420e3eec 100644 --- a/src/modules/fancyzones/lib/ZoneWindow.h +++ b/src/modules/fancyzones/lib/ZoneWindow.h @@ -41,10 +41,6 @@ interface __declspec(uuid("{7F017528-8110-4FB3-BE41-F472969C2560}")) IZoneWindow * @param ptScreen Cursor coordinates where window is droped. */ IFACEMETHOD(MoveSizeEnd)(HWND window, POINT const& ptScreen) = 0; - /** - * Abort tracking down of window position and giving zone layout hints (if dragging functionality is enabled). - */ - IFACEMETHOD(MoveSizeCancel)() = 0; /** * @returns Boolean indicating is giving hints about active zone layout enabled. Hints are * given while dragging window while holding SHIFT key. @@ -89,6 +85,8 @@ interface __declspec(uuid("{7F017528-8110-4FB3-BE41-F472969C2560}")) IZoneWindow * @returns Active zone layout for this work area. */ IFACEMETHOD_(IZoneSet*, ActiveZoneSet)() = 0; + IFACEMETHOD_(void, ShowZoneWindow)() = 0; + IFACEMETHOD_(void, HideZoneWindow)() = 0; }; winrt::com_ptr MakeZoneWindow(IZoneWindowHost* host, HINSTANCE hinstance, HMONITOR monitor, diff --git a/src/modules/fancyzones/lib/fancyzones.rc b/src/modules/fancyzones/lib/fancyzones.rc index b17ec1f808..59bd794d7e 100644 --- a/src/modules/fancyzones/lib/fancyzones.rc +++ b/src/modules/fancyzones/lib/fancyzones.rc @@ -14,6 +14,7 @@ IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES "Flash zones when the active FancyZones layout changes" IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR "Zone Highlight Color (Default #0078D7)" IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN "Follow mouse cursor instead of focus when launching editor in a multi screen environment" + IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS "Show zones on all monitors while dragging a window" IDS_SETTING_DESCRIPTION_APPLASTZONE_MOVEWINDOWS "Move newly created windows to their last known zone" IDS_SETTING_LAUNCH_EDITOR_LABEL "Zone configuration" IDS_SETTING_LAUNCH_EDITOR_BUTTON "Edit zones" diff --git a/src/modules/fancyzones/lib/resource.h b/src/modules/fancyzones/lib/resource.h index 8f29794f50..1e0a2a18db 100644 --- a/src/modules/fancyzones/lib/resource.h +++ b/src/modules/fancyzones/lib/resource.h @@ -7,11 +7,12 @@ #define IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR 107 #define IDS_SETTING_DESCRIPTION_APPLASTZONE_MOVEWINDOWS 108 #define IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN 109 -#define IDS_SETTING_DESCRIPTION 110 -#define IDS_SETTING_LAUNCH_EDITOR_LABEL 111 -#define IDS_SETTING_LAUNCH_EDITOR_BUTTON 112 -#define IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION 113 -#define IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL 114 -#define IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION 115 -#define IDS_SETTINGS_HIGHLIGHT_OPACITY 116 -#define IDS_FANCYZONES 117 +#define IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS 110 +#define IDS_SETTING_DESCRIPTION 111 +#define IDS_SETTING_LAUNCH_EDITOR_LABEL 112 +#define IDS_SETTING_LAUNCH_EDITOR_BUTTON 113 +#define IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION 114 +#define IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL 115 +#define IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION 116 +#define IDS_SETTINGS_HIGHLIGHT_OPACITY 117 +#define IDS_FANCYZONES 118 diff --git a/src/modules/fancyzones/lib/trace.cpp b/src/modules/fancyzones/lib/trace.cpp index 078d8ff69c..ac2219bd0a 100644 --- a/src/modules/fancyzones/lib/trace.cpp +++ b/src/modules/fancyzones/lib/trace.cpp @@ -170,6 +170,7 @@ void Trace::SettingsChanged(const Settings& settings) noexcept TraceLoggingBoolean(settings.overrideSnapHotkeys, "OverrideSnapHotKeys"), TraceLoggingBoolean(settings.appLastZone_moveWindows, "MoveWindowsToLastZoneOnAppOpening"), TraceLoggingBoolean(settings.use_cursorpos_editor_startupscreen, "UseCursorPosOnEditorStartup"), + TraceLoggingBoolean(settings.showZonesOnAllMonitors, "ShowZonesOnAllMonitors"), TraceLoggingWideString(settings.zoneHightlightColor.c_str(), "ZoneHighlightColor"), TraceLoggingInt32(settings.zoneHighlightOpacity, "ZoneHighlightOpacity"), TraceLoggingWideString(hotkeyStr.c_str(), "Hotkey"), diff --git a/src/modules/fancyzones/tests/UnitTests/FancyZones.Spec.cpp b/src/modules/fancyzones/tests/UnitTests/FancyZones.Spec.cpp index 1f2c3fb411..2812d186e1 100644 --- a/src/modules/fancyzones/tests/UnitTests/FancyZones.Spec.cpp +++ b/src/modules/fancyzones/tests/UnitTests/FancyZones.Spec.cpp @@ -148,6 +148,7 @@ namespace FancyZonesUnitTests ptSettings.add_bool_toogle(L"fancyzones_virtualDesktopChange_moveWindows", IDS_SETTING_DESCRIPTION_VIRTUALDESKTOPCHANGE_MOVEWINDOWS, settings.virtualDesktopChange_moveWindows); ptSettings.add_bool_toogle(L"fancyzones_appLastZone_moveWindows", IDS_SETTING_DESCRIPTION_APPLASTZONE_MOVEWINDOWS, settings.appLastZone_moveWindows); ptSettings.add_bool_toogle(L"use_cursorpos_editor_startupscreen", IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN, settings.use_cursorpos_editor_startupscreen); + ptSettings.add_bool_toogle(L"fancyzones_show_on_all_monitors", IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS, settings.showZonesOnAllMonitors); ptSettings.add_int_spinner(L"fancyzones_highlight_opacity", IDS_SETTINGS_HIGHLIGHT_OPACITY, settings.zoneHighlightOpacity, 0, 100, 1); ptSettings.add_color_picker(L"fancyzones_zoneHighlightColor", IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR, settings.zoneHightlightColor); ptSettings.add_multiline_string(L"fancyzones_excluded_apps", IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION, settings.excludedApps); @@ -188,6 +189,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = false, .appLastZone_moveWindows = true, .use_cursorpos_editor_startupscreen = true, + .showZonesOnAllMonitors = false, .zoneHightlightColor = L"#abafee", .zoneHighlightOpacity = 45, .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, false, false, false, VK_OEM_3), @@ -214,6 +216,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = false, .appLastZone_moveWindows = true, .use_cursorpos_editor_startupscreen = true, + .showZonesOnAllMonitors = false, .zoneHightlightColor = L"#abafee", .zoneHighlightOpacity = expected, .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, false, false, false, VK_OEM_3), @@ -263,6 +266,7 @@ namespace FancyZonesUnitTests ptSettings.add_bool_toogle(L"fancyzones_virtualDesktopChange_moveWindows", IDS_SETTING_DESCRIPTION_VIRTUALDESKTOPCHANGE_MOVEWINDOWS, settings.virtualDesktopChange_moveWindows); ptSettings.add_bool_toogle(L"fancyzones_appLastZone_moveWindows", IDS_SETTING_DESCRIPTION_APPLASTZONE_MOVEWINDOWS, settings.appLastZone_moveWindows); ptSettings.add_bool_toogle(L"use_cursorpos_editor_startupscreen", IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN, settings.use_cursorpos_editor_startupscreen); + ptSettings.add_bool_toogle(L"fancyzones_show_on_all_monitors", IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS, settings.showZonesOnAllMonitors); ptSettings.add_int_spinner(L"fancyzones_highlight_opacity", IDS_SETTINGS_HIGHLIGHT_OPACITY, settings.zoneHighlightOpacity, 0, 100, 1); ptSettings.add_color_picker(L"fancyzones_zoneHighlightColor", IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR, settings.zoneHightlightColor); ptSettings.add_multiline_string(L"fancyzones_excluded_apps", IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION, settings.excludedApps); diff --git a/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp b/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp index c36007472d..1479ef15bb 100644 --- a/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp +++ b/src/modules/fancyzones/tests/UnitTests/FancyZonesSettings.Spec.cpp @@ -33,6 +33,7 @@ namespace FancyZonesUnitTests Assert::AreEqual(expected.overrideSnapHotkeys, actual.overrideSnapHotkeys); Assert::AreEqual(expected.appLastZone_moveWindows, actual.appLastZone_moveWindows); Assert::AreEqual(expected.use_cursorpos_editor_startupscreen, actual.use_cursorpos_editor_startupscreen); + Assert::AreEqual(expected.showZonesOnAllMonitors, actual.showZonesOnAllMonitors); Assert::AreEqual(expected.zoneHightlightColor.c_str(), actual.zoneHightlightColor.c_str()); Assert::AreEqual(expected.zoneHighlightOpacity, actual.zoneHighlightOpacity); Assert::AreEqual(expected.excludedApps.c_str(), actual.excludedApps.c_str()); @@ -104,6 +105,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = false, .appLastZone_moveWindows = false, .use_cursorpos_editor_startupscreen = true, + .showZonesOnAllMonitors = false, .zoneHightlightColor = L"#00FFD7", .zoneHighlightOpacity = 45, .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, true, true, false, VK_OEM_3), @@ -120,6 +122,7 @@ namespace FancyZonesUnitTests values.add_property(L"fancyzones_overrideSnapHotkeys", expected.overrideSnapHotkeys); values.add_property(L"fancyzones_appLastZone_moveWindows", expected.appLastZone_moveWindows); values.add_property(L"use_cursorpos_editor_startupscreen", expected.use_cursorpos_editor_startupscreen); + values.add_property(L"fancyzones_show_on_all_monitors", expected.showZonesOnAllMonitors); values.add_property(L"fancyzones_zoneHighlightColor", expected.zoneHightlightColor); values.add_property(L"fancyzones_highlight_opacity", expected.zoneHighlightOpacity); values.add_property(L"fancyzones_editor_hotkey", expected.editorHotkey.get_json()); @@ -146,6 +149,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = false, .appLastZone_moveWindows = false, .use_cursorpos_editor_startupscreen = true, + .showZonesOnAllMonitors = false, .zoneHightlightColor = L"#00FFD7", .zoneHighlightOpacity = 45, .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, true, true, false, VK_OEM_3), @@ -162,6 +166,7 @@ namespace FancyZonesUnitTests values.add_property(L"fancyzones_overrideSnapHotkeys", expected.overrideSnapHotkeys); values.add_property(L"fancyzones_appLastZone_moveWindows", expected.appLastZone_moveWindows); values.add_property(L"use_cursorpos_editor_startupscreen", expected.use_cursorpos_editor_startupscreen); + values.add_property(L"fancyzones_show_on_all_monitors", expected.showZonesOnAllMonitors); values.add_property(L"fancyzones_zoneHighlightColor", expected.zoneHightlightColor); values.add_property(L"fancyzones_highlight_opacity", expected.zoneHighlightOpacity); values.add_property(L"fancyzones_editor_hotkey", expected.editorHotkey.get_json()); @@ -187,6 +192,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = m_defaultSettings.overrideSnapHotkeys, .appLastZone_moveWindows = m_defaultSettings.appLastZone_moveWindows, .use_cursorpos_editor_startupscreen = m_defaultSettings.use_cursorpos_editor_startupscreen, + .showZonesOnAllMonitors = m_defaultSettings.showZonesOnAllMonitors, .zoneHightlightColor = L"#00FFD7", .zoneHighlightOpacity = 45, .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, true, true, false, VK_OEM_3), @@ -221,6 +227,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = false, .appLastZone_moveWindows = false, .use_cursorpos_editor_startupscreen = true, + .showZonesOnAllMonitors = false, .zoneHightlightColor = m_defaultSettings.zoneHightlightColor, .zoneHighlightOpacity = 45, .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, true, true, false, VK_OEM_3), @@ -237,6 +244,7 @@ namespace FancyZonesUnitTests values.add_property(L"fancyzones_overrideSnapHotkeys", expected.overrideSnapHotkeys); values.add_property(L"fancyzones_appLastZone_moveWindows", expected.appLastZone_moveWindows); values.add_property(L"use_cursorpos_editor_startupscreen", expected.use_cursorpos_editor_startupscreen); + values.add_property(L"fancyzones_show_on_all_monitors", expected.showZonesOnAllMonitors); values.add_property(L"fancyzones_highlight_opacity", expected.zoneHighlightOpacity); values.add_property(L"fancyzones_editor_hotkey", expected.editorHotkey.get_json()); values.add_property(L"fancyzones_excluded_apps", expected.excludedApps); @@ -262,6 +270,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = false, .appLastZone_moveWindows = false, .use_cursorpos_editor_startupscreen = true, + .showZonesOnAllMonitors = false, .zoneHightlightColor = L"#00FFD7", .zoneHighlightOpacity = m_defaultSettings.zoneHighlightOpacity, .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, true, true, false, VK_OEM_3), @@ -278,6 +287,7 @@ namespace FancyZonesUnitTests values.add_property(L"fancyzones_overrideSnapHotkeys", expected.overrideSnapHotkeys); values.add_property(L"fancyzones_appLastZone_moveWindows", expected.appLastZone_moveWindows); values.add_property(L"use_cursorpos_editor_startupscreen", expected.use_cursorpos_editor_startupscreen); + values.add_property(L"fancyzones_show_on_all_monitors", expected.showZonesOnAllMonitors); values.add_property(L"fancyzones_zoneHighlightColor", expected.zoneHightlightColor); values.add_property(L"fancyzones_editor_hotkey", expected.editorHotkey.get_json()); values.add_property(L"fancyzones_excluded_apps", expected.excludedApps); @@ -303,6 +313,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = false, .appLastZone_moveWindows = false, .use_cursorpos_editor_startupscreen = true, + .showZonesOnAllMonitors = false, .zoneHightlightColor = L"#00FFD7", .zoneHighlightOpacity = 45, .editorHotkey = m_defaultSettings.editorHotkey, @@ -319,6 +330,7 @@ namespace FancyZonesUnitTests values.add_property(L"fancyzones_overrideSnapHotkeys", expected.overrideSnapHotkeys); values.add_property(L"fancyzones_appLastZone_moveWindows", expected.appLastZone_moveWindows); values.add_property(L"use_cursorpos_editor_startupscreen", expected.use_cursorpos_editor_startupscreen); + values.add_property(L"fancyzones_show_on_all_monitors", expected.showZonesOnAllMonitors); values.add_property(L"fancyzones_zoneHighlightColor", expected.zoneHightlightColor); values.add_property(L"fancyzones_highlight_opacity", expected.zoneHighlightOpacity); values.add_property(L"fancyzones_excluded_apps", expected.excludedApps); @@ -344,6 +356,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = false, .appLastZone_moveWindows = false, .use_cursorpos_editor_startupscreen = true, + .showZonesOnAllMonitors = false, .zoneHightlightColor = L"#00FFD7", .zoneHighlightOpacity = 45, .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, true, true, false, VK_OEM_3), @@ -360,6 +373,7 @@ namespace FancyZonesUnitTests values.add_property(L"fancyzones_overrideSnapHotkeys", expected.overrideSnapHotkeys); values.add_property(L"fancyzones_appLastZone_moveWindows", expected.appLastZone_moveWindows); values.add_property(L"use_cursorpos_editor_startupscreen", expected.use_cursorpos_editor_startupscreen); + values.add_property(L"fancyzones_show_on_all_monitors", expected.showZonesOnAllMonitors); values.add_property(L"fancyzones_zoneHighlightColor", expected.zoneHightlightColor); values.add_property(L"fancyzones_highlight_opacity", expected.zoneHighlightOpacity); values.add_property(L"fancyzones_editor_hotkey", expected.editorHotkey.get_json()); @@ -435,6 +449,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = false, .appLastZone_moveWindows = false, .use_cursorpos_editor_startupscreen = true, + .showZonesOnAllMonitors = false, .zoneHightlightColor = L"#00FFD7", .zoneHighlightOpacity = 45, .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, true, true, false, VK_OEM_3), @@ -451,6 +466,7 @@ namespace FancyZonesUnitTests values.add_property(L"fancyzones_overrideSnapHotkeys", expected.overrideSnapHotkeys); values.add_property(L"fancyzones_appLastZone_moveWindows", expected.appLastZone_moveWindows); values.add_property(L"use_cursorpos_editor_startupscreen", expected.use_cursorpos_editor_startupscreen); + values.add_property(L"fancyzones_show_on_all_monitors", expected.showZonesOnAllMonitors); values.add_property(L"fancyzones_zoneHighlightColor", expected.zoneHightlightColor); values.add_property(L"fancyzones_highlight_opacity", expected.zoneHighlightOpacity); values.add_property(L"fancyzones_editor_hotkey", expected.editorHotkey.get_json()); @@ -563,6 +579,7 @@ namespace FancyZonesUnitTests ptSettings.add_bool_toogle(L"fancyzones_virtualDesktopChange_moveWindows", IDS_SETTING_DESCRIPTION_VIRTUALDESKTOPCHANGE_MOVEWINDOWS, settings.virtualDesktopChange_moveWindows); ptSettings.add_bool_toogle(L"fancyzones_appLastZone_moveWindows", IDS_SETTING_DESCRIPTION_APPLASTZONE_MOVEWINDOWS, settings.appLastZone_moveWindows); ptSettings.add_bool_toogle(L"use_cursorpos_editor_startupscreen", IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN, settings.use_cursorpos_editor_startupscreen); + ptSettings.add_bool_toogle(L"fancyzones_show_on_all_monitors", IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS, settings.showZonesOnAllMonitors); ptSettings.add_int_spinner(L"fancyzones_highlight_opacity", IDS_SETTINGS_HIGHLIGHT_OPACITY, settings.zoneHighlightOpacity, 0, 100, 1); ptSettings.add_color_picker(L"fancyzones_zoneHighlightColor", IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR, settings.zoneHightlightColor); ptSettings.add_multiline_string(L"fancyzones_excluded_apps", IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION, settings.excludedApps); @@ -584,6 +601,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = false, .appLastZone_moveWindows = false, .use_cursorpos_editor_startupscreen = true, + .showZonesOnAllMonitors = false, .zoneHightlightColor = L"#00FFD7", .zoneHighlightOpacity = 45, .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, true, true, false, VK_OEM_3), @@ -600,6 +618,7 @@ namespace FancyZonesUnitTests values.add_property(L"fancyzones_overrideSnapHotkeys", expected.overrideSnapHotkeys); values.add_property(L"fancyzones_appLastZone_moveWindows", expected.appLastZone_moveWindows); values.add_property(L"use_cursorpos_editor_startupscreen", expected.use_cursorpos_editor_startupscreen); + values.add_property(L"fancyzones_show_on_all_monitors", expected.showZonesOnAllMonitors); values.add_property(L"fancyzones_zoneHighlightColor", expected.zoneHightlightColor); values.add_property(L"fancyzones_highlight_opacity", expected.zoneHighlightOpacity); values.add_property(L"fancyzones_editor_hotkey", expected.editorHotkey.get_json()); @@ -631,6 +650,7 @@ namespace FancyZonesUnitTests m_ptSettings->add_bool_toogle(L"fancyzones_virtualDesktopChange_moveWindows", IDS_SETTING_DESCRIPTION_VIRTUALDESKTOPCHANGE_MOVEWINDOWS, expected.virtualDesktopChange_moveWindows); m_ptSettings->add_bool_toogle(L"fancyzones_appLastZone_moveWindows", IDS_SETTING_DESCRIPTION_APPLASTZONE_MOVEWINDOWS, expected.appLastZone_moveWindows); m_ptSettings->add_bool_toogle(L"use_cursorpos_editor_startupscreen", IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN, expected.use_cursorpos_editor_startupscreen); + m_ptSettings->add_bool_toogle(L"fancyzones_show_on_all_monitors", IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS, expected.showZonesOnAllMonitors); m_ptSettings->add_int_spinner(L"fancyzones_highlight_opacity", IDS_SETTINGS_HIGHLIGHT_OPACITY, expected.zoneHighlightOpacity, 0, 100, 1); m_ptSettings->add_color_picker(L"fancyzones_zoneHighlightColor", IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR, expected.zoneHightlightColor); m_ptSettings->add_multiline_string(L"fancyzones_excluded_apps", IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION, expected.excludedApps); @@ -695,6 +715,7 @@ namespace FancyZonesUnitTests .overrideSnapHotkeys = false, .appLastZone_moveWindows = true, .use_cursorpos_editor_startupscreen = true, + .showZonesOnAllMonitors = false, .zoneHightlightColor = L"#00AABB", .zoneHighlightOpacity = 45, .editorHotkey = PowerToysSettings::HotkeyObject::from_settings(false, false, false, false, VK_OEM_3), diff --git a/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp b/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp index 2f230b354f..0842152e29 100644 --- a/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp +++ b/src/modules/fancyzones/tests/UnitTests/ZoneWindow.Spec.cpp @@ -510,16 +510,6 @@ namespace FancyZonesUnitTests Assert::AreNotEqual(-1, actualZoneIndex); //with invalid point zone remains the same } - TEST_METHOD(MoveSizeCancel) - { - m_zoneWindow = MakeZoneWindow(m_hostPtr, m_hInst, m_monitor, m_uniqueId.str(), false); - - const auto expected = S_OK; - const auto actual = m_zoneWindow->MoveSizeCancel(); - - Assert::AreEqual(expected, actual); - } - TEST_METHOD(MoveWindowIntoZoneByIndexNoActiveZoneSet) { m_zoneWindow = MakeZoneWindow(m_hostPtr, m_hInst, m_monitor, m_uniqueId.str(), false);