[Settings][FancyZones] Rounded corners settings only on Windows 11 (#18151)

* rounded corners settings only on windows 11

* disable setting on win10
This commit is contained in:
Davide Giacometti
2022-05-19 18:07:18 +02:00
committed by GitHub
parent 1552e75df2
commit dda0aa237c
4 changed files with 23 additions and 11 deletions

View File

@@ -7,7 +7,6 @@ using System.Diagnostics;
using System.IO;
using System.IO.Abstractions;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.PowerToys.Settings.UI.Library.CustomAction;
namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
@@ -135,5 +134,10 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
}
public const uint VirtualKeyWindows = interop.Constants.VK_WIN_BOTH;
public static bool Windows11()
{
return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= 22000;
}
}
}

View File

@@ -6,6 +6,7 @@ using System;
using System.Runtime.CompilerServices;
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
@@ -26,6 +27,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private string settingsConfigFileFolder = string.Empty;
private bool _windows11;
private enum MoveWindowBehaviour
{
MoveWindowBasedOnZoneIndex = 0,
@@ -112,6 +115,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
_zoneNumberColor = !string.IsNullOrEmpty(numberColor) ? numberColor : ConfigDefaults.DefaultFancyzonesNumberColor;
_isEnabled = GeneralSettingsConfig.Enabled.FancyZones;
_windows11 = Helper.Windows11();
// Disable setting on windows 10
if (!_windows11 && DisableRoundCornersOnWindowSnap)
{
DisableRoundCornersOnWindowSnap = false;
}
}
private bool _isEnabled;
@@ -846,6 +856,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public bool Windows11 => _windows11;
private void LaunchEditor()
{
// send message to launch the zones editor;

View File

@@ -1356,7 +1356,7 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<value>Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity.
Take a moment to preview the various utilities listed or view our comprehensive documentation.</value>
</data>
</data>
<data name="Oobe_Overview_DescriptionLinkText.Text" xml:space="preserve">
<value>Documentation on Microsoft Docs</value>
</data>
@@ -1474,7 +1474,7 @@ From there, simply click on one of the supported files in the File Explorer and
<data name="Oobe_WhatsNew_LoadingError.Title" xml:space="preserve">
<value>Couldn't load the release notes.</value>
</data>
<data name="Oobe_WhatsNew_LoadingError.Message" xml:space="preserve">
<data name="Oobe_WhatsNew_LoadingError.Message" xml:space="preserve">
<value>Please check your internet connection.</value>
</data>
<data name="Oobe_WhatsNew_DetailedReleaseNotesLink.Text" xml:space="preserve">
@@ -2105,10 +2105,7 @@ From there, simply click on one of the supported files in the File Explorer and
<data name="Shell_WhatsNew.Content" xml:space="preserve">
<value>What's new</value>
</data>
<data name="FancyZones_DisableRoundCornersOnWindowSnap.Description" xml:space="preserve">
<value>Works on Windows 11 </value>
</data>
<data name="FancyZones_DisableRoundCornersOnWindowSnap.Header" xml:space="preserve">
<data name="FancyZones_DisableRoundCornersOnWindowSnap.Content" xml:space="preserve">
<value>Disable round corners when window is snapped</value>
</data>
</root>

View File

@@ -14,6 +14,7 @@
<converters:BoolToObjectConverter x:Key="BoolToComboBoxIndexConverter" TrueValue="1" FalseValue="0"/>
<converters:StringFormatConverter x:Key="StringFormatConverter"/>
<converters:BoolToVisibilityConverter x:Key="FalseToVisibleConverter" TrueValue="Collapsed" FalseValue="Visible"/>
<converters:BoolToVisibilityConverter x:Key="TrueToVisibleConverter" TrueValue="Visible" FalseValue="Collapsed"/>
</Page.Resources>
<controls:SettingsPageControl x:Uid="FancyZones"
@@ -189,10 +190,8 @@
x:Uid="FancyZones_AllowPopupWindowSnap"/>
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
<CheckBox x:Uid="FancyZones_AllowChildWindowSnap" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.AllowChildWindowSnap}" Margin="{StaticResource ExpanderSettingMargin}"/>
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
<controls:CheckBoxWithDescriptionControl IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.DisableRoundCornersOnWindowSnap}"
Margin="56, -2, 40, 14"
x:Uid="FancyZones_DisableRoundCornersOnWindowSnap"/>
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" Visibility="{x:Bind Mode=OneWay, Path=ViewModel.Windows11, Converter={StaticResource TrueToVisibleConverter}}"/>
<CheckBox x:Uid="FancyZones_DisableRoundCornersOnWindowSnap" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.DisableRoundCornersOnWindowSnap}" Margin="{StaticResource ExpanderSettingMargin}" Visibility="{x:Bind Mode=OneWay, Path=ViewModel.Windows11, Converter={StaticResource TrueToVisibleConverter}}"/>
</StackPanel>
</controls:SettingExpander.Content>