Merge branch 'master' into merge/build-features-to-master

This commit is contained in:
ryanbodrug-microsoft 2020-05-06 18:39:25 -07:00
commit 5f14b2e738
13 changed files with 111 additions and 59 deletions

View File

@ -22,7 +22,6 @@ enum class DisplayChangeType
WorkArea,
DisplayChange,
VirtualDesktop,
Editor,
Initialization
};
@ -219,7 +218,7 @@ private:
};
void UpdateZoneWindows() noexcept;
void MoveWindowsOnDisplayChange() noexcept;
void UpdateWindowsPositions() noexcept;
void CycleActiveZoneSet(DWORD vkCode) noexcept;
bool OnSnapHotkey(DWORD vkCode) noexcept;
@ -559,7 +558,7 @@ FancyZones::MoveWindowsOnActiveZoneSetChange() noexcept
{
if (m_settings->GetSettings()->zoneSetChange_moveWindows)
{
MoveWindowsOnDisplayChange();
UpdateWindowsPositions();
}
}
@ -621,7 +620,6 @@ LRESULT FancyZones::WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lpa
if (lparam == static_cast<LPARAM>(EditorExitKind::Exit))
{
OnEditorExitEvent();
OnDisplayChange(DisplayChangeType::Editor);
}
{
@ -693,21 +691,14 @@ void FancyZones::OnDisplayChange(DisplayChangeType changeType) noexcept
{
if (m_settings->GetSettings()->displayChange_moveWindows)
{
MoveWindowsOnDisplayChange();
UpdateWindowsPositions();
}
}
else if (changeType == DisplayChangeType::VirtualDesktop)
{
if (m_settings->GetSettings()->virtualDesktopChange_moveWindows)
{
MoveWindowsOnDisplayChange();
}
}
else if (changeType == DisplayChangeType::Editor)
{
if (m_settings->GetSettings()->zoneSetChange_moveWindows)
{
MoveWindowsOnDisplayChange();
UpdateWindowsPositions();
}
}
}
@ -796,7 +787,7 @@ void FancyZones::UpdateZoneWindows() noexcept
EnumDisplayMonitors(nullptr, nullptr, callback, reinterpret_cast<LPARAM>(this));
}
void FancyZones::MoveWindowsOnDisplayChange() noexcept
void FancyZones::UpdateWindowsPositions() noexcept
{
auto callback = [](HWND window, LPARAM data) -> BOOL {
int i = static_cast<int>(reinterpret_cast<UINT_PTR>(::GetProp(window, ZONE_STAMP)));
@ -947,6 +938,15 @@ void FancyZones::OnEditorExitEvent() noexcept
JSONHelpers::FancyZonesDataInstance().ParseDeletedCustomZoneSetsFromTmpFile(ZoneWindowUtils::GetCustomZoneSetsTmpPath());
JSONHelpers::FancyZonesDataInstance().ParseCustomZoneSetFromTmpFile(ZoneWindowUtils::GetAppliedZoneSetTmpPath());
JSONHelpers::FancyZonesDataInstance().SaveFancyZonesData();
// Update zone sets for currently active work areas.
for (auto& [monitor, zoneWindow] : m_zoneWindowMap)
{
zoneWindow->UpdateActiveZoneSet();
}
if (m_settings->GetSettings()->zoneSetChange_moveWindows)
{
UpdateWindowsPositions();
}
}
std::vector<HMONITOR> FancyZones::GetMonitorsSorted() noexcept

View File

@ -36,8 +36,9 @@ private:
PCWSTR name;
bool* value;
int resourceId;
} m_configBools[10 /* 11 */] = { // "Turning FLASHING_ZONE option off"
} m_configBools[11 /* 12 */] = { // "Turning FLASHING_ZONE option off"
{ L"fancyzones_shiftDrag", &m_settings.shiftDrag, IDS_SETTING_DESCRIPTION_SHIFTDRAG },
{ L"fancyzones_mouseSwitch", &m_settings.mouseSwitch, IDS_SETTING_DESCRIPTION_MOUSESWITCH },
{ L"fancyzones_overrideSnapHotkeys", &m_settings.overrideSnapHotkeys, IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS },
{ L"fancyzones_moveWindowAcrossMonitors", &m_settings.moveWindowAcrossMonitors, IDS_SETTING_DESCRIPTION_MOVE_WINDOW_ACROSS_MONITORS },
// "Turning FLASHING_ZONE option off"

View File

@ -7,6 +7,7 @@ struct Settings
{
// The values specified here are the defaults.
bool shiftDrag = true;
bool mouseSwitch = false;
bool displayChange_moveWindows = false;
bool virtualDesktopChange_moveWindows = false;
bool zoneSetChange_flashZones = false;

View File

@ -8,6 +8,7 @@
#include "lib/Settings.h"
#include "lib/ZoneWindow.h"
#include "lib/util.h"
#include "VirtualDesktopUtils.h"
extern "C" IMAGE_DOS_HEADER __ImageBase;
@ -298,6 +299,15 @@ void WindowMoveHandlerPrivate::MoveWindowIntoZoneByIndexSet(HWND window, HMONITO
if (zoneWindow != zoneWindowMap.end())
{
const auto& zoneWindowPtr = zoneWindow->second;
// Only process windows located on currently active work area.
GUID windowDesktopId{};
GUID zoneWindowDesktopId{};
if (VirtualDesktopUtils::GetWindowDesktopId(window, &windowDesktopId) &&
VirtualDesktopUtils::GetZoneWindowDesktopId(zoneWindowPtr.get(), &zoneWindowDesktopId) &&
(windowDesktopId != zoneWindowDesktopId))
{
return;
}
zoneWindowPtr->MoveWindowIntoZoneByIndexSet(window, indexSet);
}
}
@ -336,6 +346,8 @@ void WindowMoveHandlerPrivate::UpdateDragState(HWND window) noexcept
mouse |= mouseR;
}
mouse &= m_settings->GetSettings()->mouseSwitch;
if (m_settings->GetSettings()->shiftDrag)
{
m_dragEnabled = (shift | mouse);

View File

@ -233,6 +233,8 @@ public:
ShowZoneWindow() noexcept;
IFACEMETHODIMP_(void)
HideZoneWindow() noexcept;
IFACEMETHODIMP_(void)
UpdateActiveZoneSet() noexcept;
protected:
static LRESULT CALLBACK s_WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) noexcept;
@ -536,6 +538,12 @@ ZoneWindow::HideZoneWindow() noexcept
}
}
IFACEMETHODIMP_(void)
ZoneWindow::UpdateActiveZoneSet() noexcept
{
CalculateZoneSet();
}
#pragma region private
void ZoneWindow::LoadSettings() noexcept

View File

@ -103,6 +103,10 @@ interface __declspec(uuid("{7F017528-8110-4FB3-BE41-F472969C2560}")) IZoneWindow
IFACEMETHOD_(IZoneSet*, ActiveZoneSet)() = 0;
IFACEMETHOD_(void, ShowZoneWindow)() = 0;
IFACEMETHOD_(void, HideZoneWindow)() = 0;
/**
* Update currently active zone layout for this work area.
*/
IFACEMETHOD_(void, UpdateActiveZoneSet)() = 0;
};
winrt::com_ptr<IZoneWindow> MakeZoneWindow(IZoneWindowHost* host, HINSTANCE hinstance, HMONITOR monitor,

View File

@ -6,7 +6,8 @@
STRINGTABLE
BEGIN
IDS_SETTING_DESCRIPTION "Create window layouts to help make multi-tasking easy"
IDS_SETTING_DESCRIPTION_SHIFTDRAG "On: Hold Shift key or any non-primary mouse button to enable zones while dragging"
IDS_SETTING_DESCRIPTION_SHIFTDRAG "Hold Shift key to activate zones while dragging"
IDS_SETTING_DESCRIPTION_MOUSESWITCH "Hold a non-primary mouse button to activate zones while dragging"
IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS "Override Windows Snap hotkeys (win+arrow) to move windows between zones"
IDS_SETTING_DESCRIPTION_MOVE_WINDOW_ACROSS_MONITORS "Move windows between zones across all monitors when snapping with win+arrow"
IDS_SETTING_DESCRIPTION_DISPLAYCHANGE_MOVEWINDOWS "Keep windows in their zones when the screen resolution changes"

View File

@ -1,25 +1,26 @@
#define IDS_SETTING_DESCRIPTION_SHIFTDRAG 101
#define IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS 102
#define IDS_SETTING_DESCRIPTION_MOVE_WINDOW_ACROSS_MONITORS 103
#define IDS_SETTING_DESCRIPTION_DISPLAYCHANGE_MOVEWINDOWS 104
#define IDS_SETTING_DESCRIPTION_ZONESETCHANGE_MOVEWINDOWS 105
#define IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES 106
#define IDS_SETTING_DESCRIPTION_VIRTUALDESKTOPCHANGE_MOVEWINDOWS 107
#define IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS 108
#define IDS_SETTING_DESCRIPTION_MAKE_DRAGGED_WINDOW_TRANSPARENT 109
#define IDS_SETTING_DESCRIPTION_ZONECOLOR 110
#define IDS_SETTING_DESCRIPTION_ZONE_BORDER_COLOR 111
#define IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR 112
#define IDS_SETTING_DESCRIPTION_APPLASTZONE_MOVEWINDOWS 113
#define IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN 114
#define IDS_SETTING_DESCRIPTION 115
#define IDS_SETTING_LAUNCH_EDITOR_LABEL 116
#define IDS_SETTING_LAUNCH_EDITOR_BUTTON 117
#define IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION 118
#define IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL 119
#define IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION 120
#define IDS_SETTINGS_HIGHLIGHT_OPACITY 121
#define IDS_FANCYZONES 122
#define IDS_CANT_DRAG_ELEVATED 123
#define IDS_CANT_DRAG_ELEVATED_LEARN_MORE 124
#define IDS_CANT_DRAG_ELEVATED_DIALOG_DONT_SHOW_AGAIN 125
#define IDS_SETTING_DESCRIPTION_MOUSESWITCH 102
#define IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS 103
#define IDS_SETTING_DESCRIPTION_MOVE_WINDOW_ACROSS_MONITORS 104
#define IDS_SETTING_DESCRIPTION_DISPLAYCHANGE_MOVEWINDOWS 105
#define IDS_SETTING_DESCRIPTION_ZONESETCHANGE_MOVEWINDOWS 106
#define IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES 107
#define IDS_SETTING_DESCRIPTION_VIRTUALDESKTOPCHANGE_MOVEWINDOWS 108
#define IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS 109
#define IDS_SETTING_DESCRIPTION_MAKE_DRAGGED_WINDOW_TRANSPARENT 110
#define IDS_SETTING_DESCRIPTION_ZONECOLOR 111
#define IDS_SETTING_DESCRIPTION_ZONE_BORDER_COLOR 112
#define IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR 113
#define IDS_SETTING_DESCRIPTION_APPLASTZONE_MOVEWINDOWS 114
#define IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN 115
#define IDS_SETTING_DESCRIPTION 116
#define IDS_SETTING_LAUNCH_EDITOR_LABEL 117
#define IDS_SETTING_LAUNCH_EDITOR_BUTTON 118
#define IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION 119
#define IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL 120
#define IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION 121
#define IDS_SETTINGS_HIGHLIGHT_OPACITY 122
#define IDS_FANCYZONES 123
#define IDS_CANT_DRAG_ELEVATED 124
#define IDS_CANT_DRAG_ELEVATED_LEARN_MORE 125
#define IDS_CANT_DRAG_ELEVATED_DIALOG_DONT_SHOW_AGAIN 126

View File

@ -173,6 +173,7 @@ void Trace::SettingsChanged(const Settings& settings) noexcept
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
TraceLoggingBoolean(settings.shiftDrag, "ShiftDrag"),
TraceLoggingBoolean(settings.mouseSwitch, "MouseSwitch"),
TraceLoggingBoolean(settings.displayChange_moveWindows, "MoveWindowsOnDisplayChange"),
TraceLoggingBoolean(settings.virtualDesktopChange_moveWindows, "MoveWindowsOnVirtualDesktopChange"),
TraceLoggingBoolean(settings.zoneSetChange_flashZones, "FlashZonesOnZoneSetChange"),

View File

@ -61,6 +61,7 @@ namespace FancyZonesUnitTests
ptSettings.add_hotkey(L"fancyzones_editor_hotkey", IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL, settings.editorHotkey);
ptSettings.add_bool_toogle(L"fancyzones_shiftDrag", IDS_SETTING_DESCRIPTION_SHIFTDRAG, settings.shiftDrag);
ptSettings.add_bool_toogle(L"fancyzones_mouseSwitch", IDS_SETTING_DESCRIPTION_MOUSESWITCH, settings.mouseSwitch);
ptSettings.add_bool_toogle(L"fancyzones_overrideSnapHotkeys", IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS, settings.overrideSnapHotkeys);
ptSettings.add_bool_toogle(L"fancyzones_moveWindowAcrossMonitors", IDS_SETTING_DESCRIPTION_MOVE_WINDOW_ACROSS_MONITORS, settings.moveWindowAcrossMonitors);
ptSettings.add_bool_toogle(L"fancyzones_zoneSetChange_flashZones", IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES, settings.zoneSetChange_flashZones);
@ -106,6 +107,7 @@ namespace FancyZonesUnitTests
const auto expected = RGB(171, 175, 238);
const Settings settings{
.shiftDrag = true,
.mouseSwitch = true,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = false,
@ -135,6 +137,7 @@ namespace FancyZonesUnitTests
const auto expected = RGB(171, 175, 238);
const Settings settings{
.shiftDrag = true,
.mouseSwitch = true,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = false,
@ -164,6 +167,7 @@ namespace FancyZonesUnitTests
const auto expected = RGB(171, 175, 238);
const Settings settings{
.shiftDrag = true,
.mouseSwitch = true,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = false,
@ -195,6 +199,7 @@ namespace FancyZonesUnitTests
const auto expected = 88;
const Settings settings{
.shiftDrag = true,
.mouseSwitch = true,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = false,
@ -226,6 +231,7 @@ namespace FancyZonesUnitTests
const auto expected = true;
const Settings settings{
.shiftDrag = true,
.mouseSwitch = true,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = false,
@ -279,6 +285,7 @@ namespace FancyZonesUnitTests
ptSettings.add_hotkey(L"fancyzones_editor_hotkey", IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL, settings.editorHotkey);
ptSettings.add_bool_toogle(L"fancyzones_shiftDrag", IDS_SETTING_DESCRIPTION_SHIFTDRAG, settings.shiftDrag);
ptSettings.add_bool_toogle(L"fancyzones_mouseSwitch", IDS_SETTING_DESCRIPTION_MOUSESWITCH, settings.mouseSwitch);
ptSettings.add_bool_toogle(L"fancyzones_overrideSnapHotkeys", IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS, settings.overrideSnapHotkeys);
ptSettings.add_bool_toogle(L"fancyzones_moveWindowAcrossMonitors", IDS_SETTING_DESCRIPTION_MOVE_WINDOW_ACROSS_MONITORS, settings.moveWindowAcrossMonitors);
ptSettings.add_bool_toogle(L"fancyzones_zoneSetChange_flashZones", IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES, settings.zoneSetChange_flashZones);

View File

@ -27,6 +27,7 @@ namespace FancyZonesUnitTests
void compareSettings(const Settings& expected, const Settings& actual)
{
Assert::AreEqual(expected.shiftDrag, actual.shiftDrag);
Assert::AreEqual(expected.mouseSwitch, actual.mouseSwitch);
Assert::AreEqual(expected.displayChange_moveWindows, actual.displayChange_moveWindows);
Assert::AreEqual(expected.virtualDesktopChange_moveWindows, actual.virtualDesktopChange_moveWindows);
Assert::AreEqual(expected.zoneSetChange_flashZones, actual.zoneSetChange_flashZones);
@ -105,6 +106,7 @@ namespace FancyZonesUnitTests
PowerToysSettings::PowerToyValues values(m_moduleName);
values.add_property(L"fancyzones_shiftDrag", expected.shiftDrag);
values.add_property(L"fancyzones_mouseSwitch", expected.mouseSwitch);
values.add_property(L"fancyzones_displayChange_moveWindows", expected.displayChange_moveWindows);
values.add_property(L"fancyzones_virtualDesktopChange_moveWindows", expected.virtualDesktopChange_moveWindows);
values.add_property(L"fancyzones_zoneSetChange_flashZones", expected.zoneSetChange_flashZones);
@ -141,6 +143,7 @@ namespace FancyZonesUnitTests
PowerToysSettings::PowerToyValues values(m_moduleName);
values.add_property(L"fancyzones_shiftDrag", expected.shiftDrag);
values.add_property(L"fancyzones_mouseSwitch", expected.mouseSwitch);
values.add_property(L"fancyzones_displayChange_moveWindows", expected.displayChange_moveWindows);
values.add_property(L"fancyzones_virtualDesktopChange_moveWindows", expected.virtualDesktopChange_moveWindows);
values.add_property(L"fancyzones_zoneSetChange_flashZones", expected.zoneSetChange_flashZones);
@ -171,6 +174,7 @@ namespace FancyZonesUnitTests
{
const Settings expected{
.shiftDrag = m_defaultSettings.shiftDrag,
.mouseSwitch = m_defaultSettings.mouseSwitch,
.displayChange_moveWindows = m_defaultSettings.displayChange_moveWindows,
.virtualDesktopChange_moveWindows = m_defaultSettings.virtualDesktopChange_moveWindows,
.zoneSetChange_flashZones = m_defaultSettings.zoneSetChange_flashZones,
@ -214,6 +218,7 @@ namespace FancyZonesUnitTests
PowerToysSettings::PowerToyValues values(m_moduleName);
values.add_property(L"fancyzones_shiftDrag", expected.shiftDrag);
values.add_property(L"fancyzones_mouseSwitch", expected.mouseSwitch);
values.add_property(L"fancyzones_displayChange_moveWindows", expected.displayChange_moveWindows);
values.add_property(L"fancyzones_virtualDesktopChange_moveWindows", expected.virtualDesktopChange_moveWindows);
values.add_property(L"fancyzones_zoneSetChange_flashZones", expected.zoneSetChange_flashZones);
@ -244,6 +249,7 @@ namespace FancyZonesUnitTests
PowerToysSettings::PowerToyValues values(m_moduleName);
values.add_property(L"fancyzones_shiftDrag", expected.shiftDrag);
values.add_property(L"fancyzones_mouseSwitch", expected.mouseSwitch);
values.add_property(L"fancyzones_displayChange_moveWindows", expected.displayChange_moveWindows);
values.add_property(L"fancyzones_virtualDesktopChange_moveWindows", expected.virtualDesktopChange_moveWindows);
values.add_property(L"fancyzones_zoneSetChange_flashZones", expected.zoneSetChange_flashZones);
@ -275,6 +281,7 @@ namespace FancyZonesUnitTests
PowerToysSettings::PowerToyValues values(m_moduleName);
values.add_property(L"fancyzones_shiftDrag", expected.shiftDrag);
values.add_property(L"fancyzones_mouseSwitch", expected.mouseSwitch);
values.add_property(L"fancyzones_displayChange_moveWindows", expected.displayChange_moveWindows);
values.add_property(L"fancyzones_virtualDesktopChange_moveWindows", expected.virtualDesktopChange_moveWindows);
values.add_property(L"fancyzones_zoneSetChange_flashZones", expected.zoneSetChange_flashZones);
@ -307,6 +314,7 @@ namespace FancyZonesUnitTests
PowerToysSettings::PowerToyValues values(m_moduleName);
values.add_property(L"fancyzones_shiftDrag", expected.shiftDrag);
values.add_property(L"fancyzones_mouseSwitch", expected.mouseSwitch);
values.add_property(L"fancyzones_displayChange_moveWindows", expected.displayChange_moveWindows);
values.add_property(L"fancyzones_virtualDesktopChange_moveWindows", expected.virtualDesktopChange_moveWindows);
values.add_property(L"fancyzones_zoneSetChange_flashZones", expected.zoneSetChange_flashZones);
@ -420,6 +428,7 @@ namespace FancyZonesUnitTests
HINSTANCE hInst = (HINSTANCE)GetModuleHandleW(nullptr);
const Settings expected{
.shiftDrag = false,
.mouseSwitch = false,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = true,
@ -441,6 +450,7 @@ namespace FancyZonesUnitTests
PowerToysSettings::PowerToyValues values(m_moduleName);
values.add_property(L"fancyzones_shiftDrag", expected.shiftDrag);
values.add_property(L"fancyzones_mouseSwitch", expected.mouseSwitch);
values.add_property(L"fancyzones_displayChange_moveWindows", expected.displayChange_moveWindows);
values.add_property(L"fancyzones_virtualDesktopChange_moveWindows", expected.virtualDesktopChange_moveWindows);
values.add_property(L"fancyzones_zoneSetChange_flashZones", expected.zoneSetChange_flashZones);
@ -558,6 +568,7 @@ namespace FancyZonesUnitTests
IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION);
ptSettings.add_hotkey(L"fancyzones_editor_hotkey", IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL, settings.editorHotkey);
ptSettings.add_bool_toogle(L"fancyzones_shiftDrag", IDS_SETTING_DESCRIPTION_SHIFTDRAG, settings.shiftDrag);
ptSettings.add_bool_toogle(L"fancyzones_mouseSwitch", IDS_SETTING_DESCRIPTION_MOUSESWITCH, settings.mouseSwitch);
ptSettings.add_bool_toogle(L"fancyzones_overrideSnapHotkeys", IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS, settings.overrideSnapHotkeys);
ptSettings.add_bool_toogle(L"fancyzones_moveWindowAcrossMonitors", IDS_SETTING_DESCRIPTION_MOVE_WINDOW_ACROSS_MONITORS, settings.moveWindowAcrossMonitors);
ptSettings.add_bool_toogle(L"fancyzones_zoneSetChange_flashZones", IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES, settings.zoneSetChange_flashZones);
@ -586,6 +597,7 @@ namespace FancyZonesUnitTests
PowerToysSettings::PowerToyValues values(m_moduleName);
values.add_property(L"fancyzones_shiftDrag", expected.shiftDrag);
values.add_property(L"fancyzones_mouseSwitch", expected.mouseSwitch);
values.add_property(L"fancyzones_displayChange_moveWindows", expected.displayChange_moveWindows);
values.add_property(L"fancyzones_virtualDesktopChange_moveWindows", expected.virtualDesktopChange_moveWindows);
//values.add_property(L"fancyzones_zoneSetChange_flashZones", expected.zoneSetChange_flashZones);
@ -621,6 +633,7 @@ namespace FancyZonesUnitTests
IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION);
m_ptSettings->add_hotkey(L"fancyzones_editor_hotkey", IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL, expected.editorHotkey);
m_ptSettings->add_bool_toogle(L"fancyzones_shiftDrag", IDS_SETTING_DESCRIPTION_SHIFTDRAG, expected.shiftDrag);
m_ptSettings->add_bool_toogle(L"fancyzones_mouseSwitch", IDS_SETTING_DESCRIPTION_MOUSESWITCH, expected.mouseSwitch);
m_ptSettings->add_bool_toogle(L"fancyzones_overrideSnapHotkeys", IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS, expected.overrideSnapHotkeys);
m_ptSettings->add_bool_toogle(L"fancyzones_moveWindowAcrossMonitors", IDS_SETTING_DESCRIPTION_MOVE_WINDOW_ACROSS_MONITORS, expected.moveWindowAcrossMonitors);
//m_ptSettings->add_bool_toogle(L"fancyzones_zoneSetChange_flashZones", IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES, expected.zoneSetChange_flashZones);
@ -690,6 +703,7 @@ namespace FancyZonesUnitTests
const Settings expected{
.shiftDrag = true,
.mouseSwitch = true,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = false,

View File

@ -304,15 +304,16 @@ namespace PowerToysTests
//check saved settings
JObject savedProps = GetProperties();
Assert.AreNotEqual(toggleValues[0], GetPropertyValue<bool>(savedProps, "fancyzones_shiftDrag"));
Assert.AreNotEqual(toggleValues[1], GetPropertyValue<bool>(savedProps, "fancyzones_overrideSnapHotkeys"));
Assert.AreNotEqual(toggleValues[2], GetPropertyValue<bool>(savedProps, "fancyzones_moveWindowAcrossMonitors"));
Assert.AreNotEqual(toggleValues[3], GetPropertyValue<bool>(savedProps, "fancyzones_displayChange_moveWindows"));
Assert.AreNotEqual(toggleValues[4], GetPropertyValue<bool>(savedProps, "fancyzones_zoneSetChange_moveWindows"));
Assert.AreNotEqual(toggleValues[5], GetPropertyValue<bool>(savedProps, "fancyzones_virtualDesktopChange_moveWindows"));
Assert.AreNotEqual(toggleValues[6], GetPropertyValue<bool>(savedProps, "fancyzones_appLastZone_moveWindows"));
Assert.AreNotEqual(toggleValues[7], GetPropertyValue<bool>(savedProps, "use_cursorpos_editor_startupscreen"));
Assert.AreNotEqual(toggleValues[8], GetPropertyValue<bool>(savedProps, "fancyzones_show_on_all_monitors"));
Assert.AreNotEqual(toggleValues[9], GetPropertyValue<bool>(savedProps, "fancyzones_makeDraggedWindowTransparent"));
Assert.AreNotEqual(toggleValues[1], GetPropertyValue<bool>(savedProps, "fancyzones_mouseSwitch"));
Assert.AreNotEqual(toggleValues[2], GetPropertyValue<bool>(savedProps, "fancyzones_overrideSnapHotkeys"));
Assert.AreNotEqual(toggleValues[3], GetPropertyValue<bool>(savedProps, "fancyzones_moveWindowAcrossMonitors"));
Assert.AreNotEqual(toggleValues[4], GetPropertyValue<bool>(savedProps, "fancyzones_displayChange_moveWindows"));
Assert.AreNotEqual(toggleValues[5], GetPropertyValue<bool>(savedProps, "fancyzones_zoneSetChange_moveWindows"));
Assert.AreNotEqual(toggleValues[6], GetPropertyValue<bool>(savedProps, "fancyzones_virtualDesktopChange_moveWindows"));
Assert.AreNotEqual(toggleValues[7], GetPropertyValue<bool>(savedProps, "fancyzones_appLastZone_moveWindows"));
Assert.AreNotEqual(toggleValues[8], GetPropertyValue<bool>(savedProps, "use_cursorpos_editor_startupscreen"));
Assert.AreNotEqual(toggleValues[9], GetPropertyValue<bool>(savedProps, "fancyzones_show_on_all_monitors"));
Assert.AreNotEqual(toggleValues[10], GetPropertyValue<bool>(savedProps, "fancyzones_makeDraggedWindowTransparent"));
}
/*
@ -343,15 +344,16 @@ namespace PowerToysTests
JObject savedProps = GetProperties();
Assert.AreEqual(toggleValues[0], GetPropertyValue<bool>(savedProps, "fancyzones_shiftDrag"));
Assert.AreEqual(toggleValues[1], GetPropertyValue<bool>(savedProps, "fancyzones_overrideSnapHotkeys"));
Assert.AreEqual(toggleValues[2], GetPropertyValue<bool>(savedProps, "fancyzones_moveWindowAcrossMonitors"));
Assert.AreEqual(toggleValues[3], GetPropertyValue<bool>(savedProps, "fancyzones_displayChange_moveWindows"));
Assert.AreEqual(toggleValues[4], GetPropertyValue<bool>(savedProps, "fancyzones_zoneSetChange_moveWindows"));
Assert.AreEqual(toggleValues[5], GetPropertyValue<bool>(savedProps, "fancyzones_virtualDesktopChange_moveWindows"));
Assert.AreEqual(toggleValues[6], GetPropertyValue<bool>(savedProps, "fancyzones_appLastZone_moveWindows"));
Assert.AreEqual(toggleValues[7], GetPropertyValue<bool>(savedProps, "use_cursorpos_editor_startupscreen"));
Assert.AreEqual(toggleValues[8], GetPropertyValue<bool>(savedProps, "fancyzones_show_on_all_monitors"));
Assert.AreEqual(toggleValues[9], GetPropertyValue<bool>(savedProps, "fancyzones_makeDraggedWindowTransparent"));
Assert.AreEqual(toggleValues[1], GetPropertyValue<bool>(savedProps, "fancyzones_mouseSwitch"));
Assert.AreEqual(toggleValues[2], GetPropertyValue<bool>(savedProps, "fancyzones_overrideSnapHotkeys"));
Assert.AreEqual(toggleValues[3], GetPropertyValue<bool>(savedProps, "fancyzones_moveWindowAcrossMonitors"));
Assert.AreEqual(toggleValues[4], GetPropertyValue<bool>(savedProps, "fancyzones_displayChange_moveWindows"));
Assert.AreEqual(toggleValues[5], GetPropertyValue<bool>(savedProps, "fancyzones_zoneSetChange_moveWindows"));
Assert.AreEqual(toggleValues[6], GetPropertyValue<bool>(savedProps, "fancyzones_virtualDesktopChange_moveWindows"));
Assert.AreEqual(toggleValues[7], GetPropertyValue<bool>(savedProps, "fancyzones_appLastZone_moveWindows"));
Assert.AreEqual(toggleValues[8], GetPropertyValue<bool>(savedProps, "use_cursorpos_editor_startupscreen"));
Assert.AreEqual(toggleValues[9], GetPropertyValue<bool>(savedProps, "fancyzones_show_on_all_monitors"));
Assert.AreEqual(toggleValues[10], GetPropertyValue<bool>(savedProps, "fancyzones_makeDraggedWindowTransparent"));
}
[TestMethod]

View File

@ -26,7 +26,7 @@ namespace PowerToysTests
protected static string _initialSettings = "";
protected static string _initialZoneSettings = "";
protected const string _defaultSettings = "{\"version\":\"1.0\",\"name\":\"FancyZones\",\"properties\":{\"fancyzones_shiftDrag\":{\"value\":true},\"fancyzones_overrideSnapHotkeys\":{\"value\":false},\"fancyzones_moveWindowAcrossMonitors\":{\"value\":false},\"fancyzones_zoneSetChange_flashZones\":{\"value\":false},\"fancyzones_displayChange_moveWindows\":{\"value\":false},\"fancyzones_zoneSetChange_moveWindows\":{\"value\":false},\"fancyzones_virtualDesktopChange_moveWindows\":{\"value\":false},\"fancyzones_appLastZone_moveWindows\":{\"value\":false},\"use_cursorpos_editor_startupscreen\":{\"value\":true},\"fancyzones_zoneHighlightColor\":{\"value\":\"#0078D7\"},\"fancyzones_highlight_opacity\":{\"value\":90},\"fancyzones_editor_hotkey\":{\"value\":{\"win\":true,\"ctrl\":false,\"alt\":false,\"shift\":false,\"code\":192,\"key\":\"`\"}},\"fancyzones_excluded_apps\":{\"value\":\"\"}}}";
protected const string _defaultSettings = "{\"version\":\"1.0\",\"name\":\"FancyZones\",\"properties\":{\"fancyzones_shiftDrag\":{\"value\":true},\"fancyzones_mouseSwitch\":{\"value\":false},\"fancyzones_overrideSnapHotkeys\":{\"value\":false},\"fancyzones_moveWindowAcrossMonitors\":{\"value\":false},\"fancyzones_zoneSetChange_flashZones\":{\"value\":false},\"fancyzones_displayChange_moveWindows\":{\"value\":false},\"fancyzones_zoneSetChange_moveWindows\":{\"value\":false},\"fancyzones_virtualDesktopChange_moveWindows\":{\"value\":false},\"fancyzones_appLastZone_moveWindows\":{\"value\":false},\"use_cursorpos_editor_startupscreen\":{\"value\":true},\"fancyzones_zoneHighlightColor\":{\"value\":\"#0078D7\"},\"fancyzones_highlight_opacity\":{\"value\":90},\"fancyzones_editor_hotkey\":{\"value\":{\"win\":true,\"ctrl\":false,\"alt\":false,\"shift\":false,\"code\":192,\"key\":\"`\"}},\"fancyzones_excluded_apps\":{\"value\":\"\"}}}";
protected const string _defaultZoneSettings = "{\"app-zone-history\":[],\"devices\":[],\"custom-zone-sets\":[]}";