Skip to content

Commit

Permalink
Infrastructure Preparation 313
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Nov 30, 2024
1 parent 3cddef1 commit f98ac7a
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Skylark" Version="3.1.4.9" />
<PackageReference Include="Skylark.Wing" Version="3.1.8.1" />
<PackageReference Include="Skylark.Wing" Version="3.1.8.3" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Skylark.Clipboard/Skylark.Clipboard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub">
<Version>9.0.0-beta.24575.1</Version>
<Version>9.0.0-beta.24577.2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Skylark.DNS/Skylark.DNS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub">
<Version>9.0.0-beta.24575.1</Version>
<Version>9.0.0-beta.24577.2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Skylark.Standard/Skylark.Standard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub">
<Version>9.0.0-beta.24575.1</Version>
<Version>9.0.0-beta.24577.2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Skylark.Uptime/Skylark.Uptime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// Creator: Taiizor
// Website: www.vegalya.com
// Created: 27.Feb.2023
// Changed: 25.Nov.2024
// Changed: 01.Dec.2024
// Version: 3.1.5.5
//
// |---------DO-NOT-REMOVE---------|
Expand Down
2 changes: 1 addition & 1 deletion src/Skylark.Uptime/Skylark.Uptime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub">
<Version>9.0.0-beta.24575.1</Version>
<Version>9.0.0-beta.24577.2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions src/Skylark.Wing/Extension/DesktopWallpaper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Runtime.InteropServices;

namespace Skylark.Wing.Extension
{
/// <summary>
/// CoClass DesktopWallpaper
/// </summary>
[ComImport, Guid("C2CF3110-460E-4fc1-B9D0-8A1C0C9CC4BD")]
public class DesktopWallpaper { }
}
1 change: 0 additions & 1 deletion src/Skylark.Wing/Helper/BackgroundImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public static bool SetPathSystemParameters(string Path = "", bool Refresh = true
{
try
{

if (SWNM.SystemParametersInfo((int)SWNM.SPI.SPI_SETDESKWALLPAPER, 0, Path, SWNM.SPIF_UPDATEINIFILE | SWNM.SPIF_SENDWININICHANGE))
{
if (Refresh)
Expand Down
63 changes: 6 additions & 57 deletions src/Skylark.Wing/Interface/IDesktopWallpaper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,72 +46,21 @@ public interface IDesktopWallpaper
[return: MarshalAs(UnmanagedType.U4)]
uint GetBackgroundColor();

void SetPosition([MarshalAs(UnmanagedType.I4)] DesktopWallpaperPosition position);
void SetPosition([MarshalAs(UnmanagedType.I4)] SWNM.DesktopWallpaperPosition position);
[return: MarshalAs(UnmanagedType.I4)]
DesktopWallpaperPosition GetPosition();
SWNM.DesktopWallpaperPosition GetPosition();

void SetSlideshow(IntPtr items);
IntPtr GetSlideshow();

void SetSlideshowOptions(DesktopSlideshowDirection options, uint slideshowTick);
void SetSlideshowOptions(SWNM.DesktopSlideshowDirection options, uint slideshowTick);
[PreserveSig]
uint GetSlideshowOptions(out DesktopSlideshowDirection options, out uint slideshowTick);
uint GetSlideshowOptions(out SWNM.DesktopSlideshowDirection options, out uint slideshowTick);

void AdvanceSlideshow([MarshalAs(UnmanagedType.LPWStr)] string monitorID, [MarshalAs(UnmanagedType.I4)] DesktopSlideshowDirection direction);
void AdvanceSlideshow([MarshalAs(UnmanagedType.LPWStr)] string monitorID, [MarshalAs(UnmanagedType.I4)] SWNM.DesktopSlideshowDirection direction);

DesktopSlideshowDirection GetStatus();
SWNM.DesktopSlideshowDirection GetStatus();

bool Enable();
}

/// <summary>
/// This enumeration is used to set and get slideshow options.
/// </summary>
public enum DesktopSlideshowOptions
{
ShuffleImages = 0x01, // When set, indicates that the order in which images in the slideshow are displayed can be randomized.
}


/// <summary>
/// This enumeration is used by GetStatus to indicate the current status of the slideshow.
/// </summary>
public enum DesktopSlideshowState
{
Enabled = 0x01,
Slideshow = 0x02,
DisabledByRemoteSession = 0x04,
}


/// <summary>
/// This enumeration is used by the AdvanceSlideshow method to indicate whether to advance the slideshow forward or backward.
/// </summary>
public enum DesktopSlideshowDirection
{
Forward = 0,
Backward = 1,
}

/// <summary>
/// This enumeration indicates the wallpaper position for all monitors. (This includes when slideshows are running.)
/// The wallpaper position specifies how the image that is assigned to a monitor should be displayed.
/// </summary>
public enum DesktopWallpaperPosition
{
Center = 0,
Tile = 1,
Stretch = 2,
Fit = 3,
Fill = 4,
Span = 5,
}

/// <summary>
/// CoClass DesktopWallpaper
/// </summary>
[ComImport, Guid("C2CF3110-460E-4fc1-B9D0-8A1C0C9CC4BD")]
public class DesktopWallpaperClass
{
}
}
61 changes: 60 additions & 1 deletion src/Skylark.Wing/Native/Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,23 @@ public enum DWM_WINDOW_CORNER_PREFERENCE
DWMWCP_ROUNDSMALL = 3
}

public enum ES_FLAGS : uint
{
ES_CONTINUOUS = 0x80000000,
ES_USER_PRESENT = 0x00000004,
ES_SYSTEM_REQUIRED = 0x00000001,
ES_DISPLAY_REQUIRED = 0x00000002,
ES_AWAYMODE_REQUIRED = 0x00000040
}

[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern uint SetThreadExecutionState(ES_FLAGS esFlags);

[DllImport("dwmapi.dll")]
public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);

public const int DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19;
public const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
public const int DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19;

[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern IntPtr LoadImage(IntPtr hinst, string lpszName, uint uType, int cxDesired, int cyDesired, uint fuLoad);
Expand Down Expand Up @@ -335,6 +347,53 @@ public enum RestartFlags
[DllImport("user32.dll")]
public static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);

#region Desktop Wallpaper

/// <summary>
/// This enumeration is used to set and get slideshow options.
/// </summary>
public enum DesktopSlideshowOptions
{
ShuffleImages = 0x01, // When set, indicates that the order in which images in the slideshow are displayed can be randomized.
}


/// <summary>
/// This enumeration is used by GetStatus to indicate the current status of the slideshow.
/// </summary>
public enum DesktopSlideshowState
{
Enabled = 0x01,
Slideshow = 0x02,
DisabledByRemoteSession = 0x04,
}


/// <summary>
/// This enumeration is used by the AdvanceSlideshow method to indicate whether to advance the slideshow forward or backward.
/// </summary>
public enum DesktopSlideshowDirection
{
Forward = 0,
Backward = 1,
}

/// <summary>
/// This enumeration indicates the wallpaper position for all monitors. (This includes when slideshows are running.)
/// The wallpaper position specifies how the image that is assigned to a monitor should be displayed.
/// </summary>
public enum DesktopWallpaperPosition
{
Center = 0,
Tile = 1,
Stretch = 2,
Fit = 3,
Fill = 4,
Span = 5,
}

#endregion

/// <summary>
/// windows styles
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Skylark.Wing/Skylark.Wing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
// Creator: Taiizor
// Website: www.vegalya.com
// Created: 17.Jun.2023
// Changed: 25.Nov.2024
// Version: 3.1.8.2
// Changed: 01.Dec.2024
// Version: 3.1.8.4
//
// |---------DO-NOT-REMOVE---------|

Expand Down
4 changes: 2 additions & 2 deletions src/Skylark.Wing/Skylark.Wing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<PropertyGroup>
<ApplicationIcon>Resources\Skylark.Wing.ico</ApplicationIcon>
<Version>3.1.8.2</Version>
<Version>3.1.8.4</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>Skylark.Wing</Title>
Expand Down Expand Up @@ -51,7 +51,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub">
<Version>9.0.0-beta.24575.1</Version>
<Version>9.0.0-beta.24577.2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Skylark/Skylark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// Creator: Taiizor
// Website: www.vegalya.com
// Created: 03.Jan.2023
// Changed: 25.Nov.2024
// Changed: 01.Dec.2024
// Version: 3.1.5.1
//
// |---------DO-NOT-REMOVE---------|
Expand Down
2 changes: 1 addition & 1 deletion src/Skylark/Skylark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub">
<Version>9.0.0-beta.24575.1</Version>
<Version>9.0.0-beta.24577.2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down

0 comments on commit f98ac7a

Please sign in to comment.