Skip to content

Commit

Permalink
v1.4.2
Browse files Browse the repository at this point in the history
性能提升
  • Loading branch information
Oliviaophia committed Apr 13, 2022
1 parent 6cb42ae commit e07f5ea
Show file tree
Hide file tree
Showing 22 changed files with 476 additions and 397 deletions.
3 changes: 3 additions & 0 deletions Sources/SmartTaskbar.Win10/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>
<userSettings>
<SmartTaskbar.Properties.Settings>
<setting name="AutoModeType" serializeAs="String">
Expand Down
15 changes: 9 additions & 6 deletions Sources/SmartTaskbar.Win10/Helpers/AnimationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ namespace SmartTaskbar
{
public static partial class Fun
{
private const uint SpiGetMenuAnimation = 0x1002;
private const uint TraySpiGetMenuAnimation = 0x1002;

private const uint SpiSetMenuAnimation = 0x1003;
private const uint TraySpiSetMenuAnimation = 0x1003;

private const uint UpdateAndSend = 3;
private const uint TrayUpdateAndSend = 3;

/// <summary>
/// Get taskbar animation status
/// </summary>
/// <returns></returns>
public static bool IsEnableTaskbarAnimation()
{
_ = GetSystemParameters(SpiGetMenuAnimation, 0, out var animation, 0);
_ = GetSystemParameters(TraySpiGetMenuAnimation, 0, out var animation, 0);
return animation;
}

Expand All @@ -26,8 +26,11 @@ public static bool IsEnableTaskbarAnimation()
/// <returns></returns>
public static bool ChangeTaskbarAnimation()
{
_ = GetSystemParameters(SpiGetMenuAnimation, 0, out var animation, 0);
_ = SetSystemParameters(SpiSetMenuAnimation, 0, animation ? IntPtr.Zero : (IntPtr) 1, UpdateAndSend);
_ = GetSystemParameters(TraySpiGetMenuAnimation, 0, out var animation, 0);
_ = SetSystemParameters(TraySpiSetMenuAnimation,
0,
animation ? IntPtr.Zero : (IntPtr) 1,
TrayUpdateAndSend);
return !animation;
}
}
Expand Down
22 changes: 11 additions & 11 deletions Sources/SmartTaskbar.Win10/Helpers/AutoHideHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ namespace SmartTaskbar
{
public static partial class Fun
{
private const int AbsAutoHide = 1;
private const int TrayAbsAutoHide = 1;

private const int AbsAlwaysOnTop = 2;
private const int TrayAbsAlwaysOnTop = 2;

private const uint AbmSetState = 10;
private const uint TrayAbmSetState = 10;

private const uint AbmGetState = 4;
private const uint TrayAbmGetState = 4;
private static AppbarData _msg;

/// <summary>
Expand All @@ -21,21 +21,21 @@ public static void SetAutoHide()
if (!IsNotAutoHide())
return;

_msg.lParam = AbsAutoHide;
_msg.lParam = TrayAbsAutoHide;

_ = SHAppBarMessage(AbmSetState, ref _msg);
_ = SHAppBarMessage(TrayAbmSetState, ref _msg);
}

public static bool IsNotAutoHide()
=> SHAppBarMessage(AbmGetState, ref _msg) == IntPtr.Zero;
=> SHAppBarMessage(TrayAbmGetState, ref _msg) == IntPtr.Zero;

/// <summary>
/// Change Auto-Hide status
/// </summary>
public static void ChangeAutoHide()
{
_msg.lParam = IsNotAutoHide() ? AbsAutoHide : AbsAlwaysOnTop;
_ = SHAppBarMessage(AbmSetState, ref _msg);
_msg.lParam = IsNotAutoHide() ? TrayAbsAutoHide : TrayAbsAlwaysOnTop;
_ = SHAppBarMessage(TrayAbmSetState, ref _msg);
}

/// <summary>
Expand All @@ -46,9 +46,9 @@ public static void CancelAutoHide()
if (IsNotAutoHide())
return;

_msg.lParam = AbsAlwaysOnTop;
_msg.lParam = TrayAbsAlwaysOnTop;

_ = SHAppBarMessage(AbmSetState, ref _msg);
_ = SHAppBarMessage(TrayAbmSetState, ref _msg);
}
}
}
14 changes: 0 additions & 14 deletions Sources/SmartTaskbar.Win10/Helpers/ClassName.cs

This file was deleted.

Loading

0 comments on commit e07f5ea

Please sign in to comment.