Revert "[FancyZones] Remove "keep windows pinned to virtual desktop location" settings (#3093)" (#3292)

This reverts commit 8f59247acb.
This commit is contained in:
Andrey Nekrasov
2020-05-20 11:57:17 +03:00
committed by GitHub
parent 8f59247acb
commit 2eecaf4570
15 changed files with 115 additions and 21 deletions

View File

@@ -16,6 +16,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
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();
@@ -55,6 +56,9 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
[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; }

View File

@@ -281,6 +281,9 @@
<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>
@@ -308,6 +311,9 @@
<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>

View File

@@ -43,6 +43,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
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;
@@ -81,6 +82,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private bool _moveWindowsAcrossMonitors;
private bool _displayChangemoveWindows;
private bool _zoneSetChangeMoveWindows;
private bool _virtualDesktopChangeMoveWindows;
private bool _appLastZoneMoveWindows;
private bool _useCursorPosEditorStartupScreen;
private bool _showOnAllMonitors;
@@ -223,6 +225,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool VirtualDesktopChangeMoveWindows
{
get
{
return _virtualDesktopChangeMoveWindows;
}
set
{
if (value != _virtualDesktopChangeMoveWindows)
{
_virtualDesktopChangeMoveWindows = value;
Settings.Properties.FancyzonesVirtualDesktopChangeMoveWindows.Value = value;
RaisePropertyChanged();
}
}
}
public bool AppLastZoneMoveWindows
{
get

View File

@@ -108,6 +108,16 @@
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}"

View File

@@ -176,6 +176,24 @@ namespace ViewModelTests
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()
{