Skip to content

Commit

Permalink
[FancyZones] Remove "keep windows pinned to virtual desktop location"…
Browse files Browse the repository at this point in the history
… settings (#3093)

* Remove keep windows pinned to virtual desktop location FancyZones settings

* Remove virtual desktop switch handling for this scenario.
  • Loading branch information
vldmr11080 committed May 20, 2020
1 parent eb3ec26 commit 8f59247
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public FZConfigProperties()
this.FancyzonesMoveWindowsAcrossMonitors = new BoolProperty();
this.FancyzonesDisplayChangeMoveWindows = new BoolProperty();
this.FancyzonesZoneSetChangeMoveWindows = new BoolProperty();
this.FancyzonesVirtualDesktopChangeMoveWindows = new BoolProperty();
this.FancyzonesAppLastZoneMoveWindows = new BoolProperty();
this.UseCursorposEditorStartupscreen = new BoolProperty(ConfigDefaults.DefaultUseCursorposEditorStartupscreen);
this.FancyzonesShowOnAllMonitors = new BoolProperty();
Expand Down Expand Up @@ -56,9 +55,6 @@ public FZConfigProperties()
[JsonPropertyName("fancyzones_zoneSetChange_moveWindows")]
public BoolProperty FancyzonesZoneSetChangeMoveWindows { get; set; }

[JsonPropertyName("fancyzones_virtualDesktopChange_moveWindows")]
public BoolProperty FancyzonesVirtualDesktopChangeMoveWindows { get; set; }

[JsonPropertyName("fancyzones_appLastZone_moveWindows")]
public BoolProperty FancyzonesAppLastZoneMoveWindows { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,6 @@
<data name="FancyZones_HokeyEditorControl_Header.Header" xml:space="preserve">
<value>Edit hot key / shortcut</value>
</data>
<data name="FancyZones_KeepWindowsPinned.Content" xml:space="preserve">
<value>Keep windows pinned to multiple desktops in the same zone when the active desktop changes</value>
</data>
<data name="FancyZones_LaunchEditorButtonControl_Header.Content" xml:space="preserve">
<value>Launch Zones Editor</value>
</data>
Expand Down Expand Up @@ -311,9 +308,6 @@
<data name="FancyZones_UseCursorPosEditorStartupScreen.Content" xml:space="preserve">
<value>Follow mouse cursor instead of focus when launching editor in a multi screen environment</value>
</data>
<data name="FancyZones_VirtualDesktopChangeMoveWindows.Content" xml:space="preserve">
<value>Move newly created windows to their last known zone</value>
</data>
<data name="FancyZones_ZoneBehavior_GroupSettings.Text" xml:space="preserve">
<value>Zone behavior</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public FancyZonesViewModel()
this._moveWindowsAcrossMonitors = Settings.Properties.FancyzonesMoveWindowsAcrossMonitors.Value;
this._displayChangemoveWindows = Settings.Properties.FancyzonesDisplayChangeMoveWindows.Value;
this._zoneSetChangeMoveWindows = Settings.Properties.FancyzonesZoneSetChangeMoveWindows.Value;
this._virtualDesktopChangeMoveWindows = Settings.Properties.FancyzonesVirtualDesktopChangeMoveWindows.Value;
this._appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value;
this._useCursorPosEditorStartupScreen = Settings.Properties.UseCursorposEditorStartupscreen.Value;
this._showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value;
Expand Down Expand Up @@ -82,7 +81,6 @@ public FancyZonesViewModel()
private bool _moveWindowsAcrossMonitors;
private bool _displayChangemoveWindows;
private bool _zoneSetChangeMoveWindows;
private bool _virtualDesktopChangeMoveWindows;
private bool _appLastZoneMoveWindows;
private bool _useCursorPosEditorStartupScreen;
private bool _showOnAllMonitors;
Expand Down Expand Up @@ -225,24 +223,6 @@ public bool ZoneSetChangeMoveWindows
}
}

public bool VirtualDesktopChangeMoveWindows
{
get
{
return _virtualDesktopChangeMoveWindows;
}

set
{
if (value != _virtualDesktopChangeMoveWindows)
{
_virtualDesktopChangeMoveWindows = value;
Settings.Properties.FancyzonesVirtualDesktopChangeMoveWindows.Value = value;
RaisePropertyChanged();
}
}
}

public bool AppLastZoneMoveWindows
{
get
Expand Down
10 changes: 0 additions & 10 deletions src/core/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,6 @@
Margin="{StaticResource SmallTopMargin}"
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/>

<CheckBox x:Uid="FancyZones_KeepWindowsPinned"
IsChecked="{ Binding Mode=TwoWay, Path=VirtualDesktopChangeMoveWindows}"
Margin="{StaticResource SmallTopMargin}"
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/>

<CheckBox x:Uid="FancyZones_VirtualDesktopChangeMoveWindows"
IsChecked="{ Binding Mode=TwoWay, Path=AppLastZoneMoveWindows}"
Margin="{StaticResource SmallTopMargin}"
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/>

<CheckBox x:Uid="FancyZones_UseCursorPosEditorStartupScreen"
IsChecked="{ Binding Mode=TwoWay, Path=UseCursorPosEditorStartupScreen}"
Margin="{StaticResource SmallTopMargin}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,24 +176,6 @@ public void ZoneSetChangeMoveWindows_ShouldSetValue2True_WhenSuccessful()
viewModel.ZoneSetChangeMoveWindows = true;
}

[TestMethod]
public void VirtualDesktopChangeMoveWindows_ShouldSetValue2True_WhenSuccessful()
{
// arrange
FancyZonesViewModel viewModel = new FancyZonesViewModel();
Assert.IsFalse(viewModel.VirtualDesktopChangeMoveWindows); // check if value was initialized to false.

// Assert
ShellPage.DefaultSndMSGCallback = msg =>
{
FancyZonesSettingsIPCMessage snd = JsonSerializer.Deserialize<FancyZonesSettingsIPCMessage>(msg);
Assert.IsTrue(snd.Powertoys.FancyZones.Properties.FancyzonesVirtualDesktopChangeMoveWindows.Value);
};

// act
viewModel.VirtualDesktopChangeMoveWindows = true;
}

[TestMethod]
public void AppLastZoneMoveWindows_ShouldSetValue2True_WhenSuccessful()
{
Expand Down
8 changes: 0 additions & 8 deletions src/modules/fancyzones/lib/FancyZones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ FancyZones::VirtualDesktopChanged() noexcept
{
// VirtualDesktopChanged is called from a reentrant WinHookProc function, therefore we must postpone the actual logic
// until we're in FancyZones::WndProc, which is not reentrant.
std::shared_lock readLock(m_lock);
PostMessage(m_window, WM_PRIV_VD_SWITCH, 0, 0);
}

Expand Down Expand Up @@ -694,13 +693,6 @@ void FancyZones::OnDisplayChange(DisplayChangeType changeType) noexcept
UpdateWindowsPositions();
}
}
else if (changeType == DisplayChangeType::VirtualDesktop)
{
if (m_settings->GetSettings()->virtualDesktopChange_moveWindows)
{
UpdateWindowsPositions();
}
}
}

void FancyZones::AddZoneWindow(HMONITOR monitor, PCWSTR deviceId) noexcept
Expand Down
3 changes: 1 addition & 2 deletions src/modules/fancyzones/lib/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct FancyZonesSettings : winrt::implements<FancyZonesSettings, IFancyZonesSet
PCWSTR name;
bool* value;
int resourceId;
} m_configBools[11 /* 12 */] = { // "Turning FLASHING_ZONE option off"
} m_configBools[10 /* 11 */] = { // "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 },
Expand All @@ -45,7 +45,6 @@ struct FancyZonesSettings : winrt::implements<FancyZonesSettings, IFancyZonesSet
//{ L"fancyzones_zoneSetChange_flashZones", &m_settings.zoneSetChange_flashZones, IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES },
{ L"fancyzones_displayChange_moveWindows", &m_settings.displayChange_moveWindows, IDS_SETTING_DESCRIPTION_DISPLAYCHANGE_MOVEWINDOWS },
{ L"fancyzones_zoneSetChange_moveWindows", &m_settings.zoneSetChange_moveWindows, IDS_SETTING_DESCRIPTION_ZONESETCHANGE_MOVEWINDOWS },
{ 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},
Expand Down
1 change: 0 additions & 1 deletion src/modules/fancyzones/lib/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ struct Settings
bool shiftDrag = true;
bool mouseSwitch = false;
bool displayChange_moveWindows = false;
bool virtualDesktopChange_moveWindows = false;
bool zoneSetChange_flashZones = false;
bool zoneSetChange_moveWindows = false;
bool overrideSnapHotkeys = false;
Expand Down
3 changes: 1 addition & 2 deletions src/modules/fancyzones/lib/fancyzones.rc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ BEGIN
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"
IDS_SETTING_DESCRIPTION_ZONESETCHANGE_MOVEWINDOWS "During zone layout changes, windows assigned to a zone will match new size/positions"
IDS_SETTING_DESCRIPTION_VIRTUALDESKTOPCHANGE_MOVEWINDOWS "Keep windows pinned to multiple desktops in the same zone when the active desktop changes"
IDS_SETTING_DESCRIPTION_ZONESETCHANGE_MOVEWINDOWS "During zone layout changes, windows assigned to a zone will match new size/positions"
IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES "Flash zones when the active FancyZones layout changes"
IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS "Show zones on all monitors while dragging a window"
IDS_SETTING_DESCRIPTION_MAKE_DRAGGED_WINDOW_TRANSPARENT "Make dragged window transparent"
Expand Down
37 changes: 18 additions & 19 deletions src/modules/fancyzones/lib/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@
#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
#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
1 change: 0 additions & 1 deletion src/modules/fancyzones/lib/trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ void Trace::SettingsChanged(const Settings& settings) noexcept
TraceLoggingBoolean(settings.shiftDrag, "ShiftDrag"),
TraceLoggingBoolean(settings.mouseSwitch, "MouseSwitch"),
TraceLoggingBoolean(settings.displayChange_moveWindows, "MoveWindowsOnDisplayChange"),
TraceLoggingBoolean(settings.virtualDesktopChange_moveWindows, "MoveWindowsOnVirtualDesktopChange"),
TraceLoggingBoolean(settings.zoneSetChange_flashZones, "FlashZonesOnZoneSetChange"),
TraceLoggingBoolean(settings.zoneSetChange_moveWindows, "MoveWindowsOnZoneSetChange"),
TraceLoggingBoolean(settings.overrideSnapHotkeys, "OverrideSnapHotKeys"),
Expand Down
7 changes: 0 additions & 7 deletions src/modules/fancyzones/tests/UnitTests/FancyZones.Spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ namespace FancyZonesUnitTests
ptSettings.add_bool_toogle(L"fancyzones_zoneSetChange_flashZones", IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES, settings.zoneSetChange_flashZones);
ptSettings.add_bool_toogle(L"fancyzones_displayChange_moveWindows", IDS_SETTING_DESCRIPTION_DISPLAYCHANGE_MOVEWINDOWS, settings.displayChange_moveWindows);
ptSettings.add_bool_toogle(L"fancyzones_zoneSetChange_moveWindows", IDS_SETTING_DESCRIPTION_ZONESETCHANGE_MOVEWINDOWS, settings.zoneSetChange_moveWindows);
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);
Expand Down Expand Up @@ -109,7 +108,6 @@ namespace FancyZonesUnitTests
.shiftDrag = true,
.mouseSwitch = true,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = false,
.zoneSetChange_moveWindows = true,
.overrideSnapHotkeys = false,
Expand Down Expand Up @@ -139,7 +137,6 @@ namespace FancyZonesUnitTests
.shiftDrag = true,
.mouseSwitch = true,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = false,
.zoneSetChange_moveWindows = true,
.overrideSnapHotkeys = false,
Expand Down Expand Up @@ -169,7 +166,6 @@ namespace FancyZonesUnitTests
.shiftDrag = true,
.mouseSwitch = true,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = false,
.zoneSetChange_moveWindows = true,
.overrideSnapHotkeys = false,
Expand Down Expand Up @@ -201,7 +197,6 @@ namespace FancyZonesUnitTests
.shiftDrag = true,
.mouseSwitch = true,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = false,
.zoneSetChange_moveWindows = true,
.overrideSnapHotkeys = false,
Expand Down Expand Up @@ -233,7 +228,6 @@ namespace FancyZonesUnitTests
.shiftDrag = true,
.mouseSwitch = true,
.displayChange_moveWindows = true,
.virtualDesktopChange_moveWindows = true,
.zoneSetChange_flashZones = false,
.zoneSetChange_moveWindows = true,
.overrideSnapHotkeys = false,
Expand Down Expand Up @@ -291,7 +285,6 @@ namespace FancyZonesUnitTests
ptSettings.add_bool_toogle(L"fancyzones_zoneSetChange_flashZones", IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES, settings.zoneSetChange_flashZones);
ptSettings.add_bool_toogle(L"fancyzones_displayChange_moveWindows", IDS_SETTING_DESCRIPTION_DISPLAYCHANGE_MOVEWINDOWS, settings.displayChange_moveWindows);
ptSettings.add_bool_toogle(L"fancyzones_zoneSetChange_moveWindows", IDS_SETTING_DESCRIPTION_ZONESETCHANGE_MOVEWINDOWS, settings.zoneSetChange_moveWindows);
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);
Expand Down

0 comments on commit 8f59247

Please sign in to comment.