mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[Accessibility]Turn animations off based on Windows settings (#28128)
* FindMyMouse: switch animations on/off based on global windows settings * Fancy Zones: enable/disable animations based on global Windows settings * Shortcut Guide: enabling/disabling animations based on global Windows settings * spell checker * Making MouseUtils settings dependent on global windows settings, AnimationEffects. If the global settings is disabled the MouseUtils animation settings is disabled too, description shows the reason. * Adding error detection, log on SystemParametersInfo call. * Adding infobar instead of changing description of the settingsbar. * spell checker * moving native constant into NativeMethods class
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
|
||||
xmlns:localConverters="using:Microsoft.PowerToys.Settings.UI.Converters"
|
||||
@@ -12,6 +13,8 @@
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<localConverters:FindMyMouseActivationIntToVisibilityConverter x:Key="FindMyMouseActivationIntToVisibilityConverter" />
|
||||
<converters:NegativeBoolToVisibilityConverter
|
||||
x:Key="BoolToInvertedVisibilityConverter" />
|
||||
</Page.Resources>
|
||||
<controls:SettingsPageControl
|
||||
x:Uid="MouseUtils"
|
||||
@@ -74,7 +77,6 @@
|
||||
</labs:SettingsCard>
|
||||
</labs:SettingsExpander.Items>
|
||||
</labs:SettingsExpander>
|
||||
|
||||
<labs:SettingsExpander
|
||||
x:Uid="Appearance_Behavior"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}"
|
||||
@@ -117,11 +119,17 @@
|
||||
Minimum="0"
|
||||
SmallChange="10"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsAnimationEnabledBySystem}"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.FindMyMouseAnimationDurationMs}" />
|
||||
</labs:SettingsCard>
|
||||
</labs:SettingsExpander.Items>
|
||||
</labs:SettingsExpander>
|
||||
|
||||
<InfoBar
|
||||
x:Uid="MouseUtils_FindMyMouse_AnimationDurationMs_Disabled"
|
||||
IsClosable="False"
|
||||
IsOpen="True"
|
||||
Severity="Informational"
|
||||
Visibility="{x:Bind Mode=OneWay, Path=ViewModel.IsAnimationEnabledBySystem, Converter={StaticResource BoolToInvertedVisibilityConverter}}" />
|
||||
<labs:SettingsExpander
|
||||
x:Uid="MouseUtils_FindMyMouse_ExcludedApps"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}"
|
||||
|
||||
@@ -2570,6 +2570,9 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<value>Time before the spotlight appears (ms)</value>
|
||||
<comment>ms = milliseconds</comment>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_AnimationDurationMs_Disabled.Message" xml:space="preserve">
|
||||
<value>Animations are disabled by OS. See Settings > Accessibility > Visual effects</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_ShakingMinimumDistance.Header" xml:space="preserve">
|
||||
<value>Shake minimum distance</value>
|
||||
</data>
|
||||
|
||||
@@ -22,5 +22,11 @@ namespace Microsoft.PowerToys.Settings.Utilities
|
||||
|
||||
[System.Runtime.InteropServices.DllImport("User32.dll")]
|
||||
public static extern bool IsIconic(IntPtr handle);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
|
||||
internal static extern bool SystemParametersInfo(int uiAction, int uiParam, ref int pvParam, int fWinIni);
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop object")]
|
||||
public const int SPI_GETCLIENTAREAANIMATION = 0x1042;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.Utilities;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
@@ -114,6 +115,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
_mousePointerCrosshairsFixedLength = MousePointerCrosshairsSettingsConfig.Properties.CrosshairsFixedLength.Value;
|
||||
_mousePointerCrosshairsAutoActivate = MousePointerCrosshairsSettingsConfig.Properties.AutoActivate.Value;
|
||||
|
||||
int isEnabled = 0;
|
||||
NativeMethods.SystemParametersInfo(NativeMethods.SPI_GETCLIENTAREAANIMATION, 0, ref isEnabled, 0);
|
||||
_isAnimationEnabledBySystem = isEnabled != 0;
|
||||
|
||||
// set the callback functions value to handle outgoing IPC message.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
}
|
||||
@@ -327,6 +332,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAnimationEnabledBySystem
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isAnimationEnabledBySystem;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_isAnimationEnabledBySystem = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int FindMyMouseAnimationDurationMs
|
||||
{
|
||||
get
|
||||
@@ -970,5 +988,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
private bool _mousePointerCrosshairsIsFixedLengthEnabled;
|
||||
private int _mousePointerCrosshairsFixedLength;
|
||||
private bool _mousePointerCrosshairsAutoActivate;
|
||||
private bool _isAnimationEnabledBySystem;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user