diff --git a/src/FancyMouse.UnitTests/FancyMouse.UnitTests.csproj b/src/FancyMouse.Common.UnitTests/FancyMouse.Common.UnitTests.csproj similarity index 57% rename from src/FancyMouse.UnitTests/FancyMouse.UnitTests.csproj rename to src/FancyMouse.Common.UnitTests/FancyMouse.Common.UnitTests.csproj index 5837f90..40795e4 100644 --- a/src/FancyMouse.UnitTests/FancyMouse.UnitTests.csproj +++ b/src/FancyMouse.Common.UnitTests/FancyMouse.Common.UnitTests.csproj @@ -7,27 +7,28 @@ - - - - + + + + - - - + + + + - + + + - - - - + + diff --git a/src/FancyMouse.UnitTests/Common/Helpers/DrawingHelperTests.cs b/src/FancyMouse.Common.UnitTests/Helpers/DrawingHelperTests.cs similarity index 92% rename from src/FancyMouse.UnitTests/Common/Helpers/DrawingHelperTests.cs rename to src/FancyMouse.Common.UnitTests/Helpers/DrawingHelperTests.cs index 91af60b..8a2d793 100644 --- a/src/FancyMouse.UnitTests/Common/Helpers/DrawingHelperTests.cs +++ b/src/FancyMouse.Common.UnitTests/Helpers/DrawingHelperTests.cs @@ -5,10 +5,10 @@ using FancyMouse.Common.Imaging; using FancyMouse.Common.Models.Drawing; using FancyMouse.Common.Models.Styles; -using FancyMouse.Internal.Models.Settings; +using FancyMouse.Settings; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace FancyMouse.UnitTests.Common.Helpers; +namespace FancyMouse.Common.UnitTests.Helpers; [TestClass] public static class DrawingHelperTests @@ -53,8 +53,8 @@ public static IEnumerable GetTestCases() new(0, 500, 500, 500), }, activatedLocation: new(x: 50, y: 50), - desktopImageFilename: "Common/Helpers/_test-4grid-desktop.png", - expectedImageFilename: "Common/Helpers/_test-4grid-expected.png"), + desktopImageFilename: "Helpers/_test-4grid-desktop.png", + expectedImageFilename: "Helpers/_test-4grid-expected.png"), }; /* win 11 */ yield return new object[] @@ -67,8 +67,8 @@ public static IEnumerable GetTestCases() new(0, 0, 5120, 1440), }, activatedLocation: new(x: 50, y: 50), - desktopImageFilename: "Common/Helpers/_test-win11-desktop.png", - expectedImageFilename: "Common/Helpers/_test-win11-expected.png"), + desktopImageFilename: "Helpers/_test-win11-desktop.png", + expectedImageFilename: "Helpers/_test-win11-expected.png"), }; } @@ -99,7 +99,6 @@ public void RunTestCases(TestCase data) expected.Save(expectedFilename, ImageFormat.Png); // compare the images - var screens = System.Windows.Forms.Screen.AllScreens; AssertImagesEqual(expected, actual); } diff --git a/src/FancyMouse.UnitTests/Common/Helpers/LayoutHelperTests.cs b/src/FancyMouse.Common.UnitTests/Helpers/LayoutHelperTests.cs similarity index 99% rename from src/FancyMouse.UnitTests/Common/Helpers/LayoutHelperTests.cs rename to src/FancyMouse.Common.UnitTests/Helpers/LayoutHelperTests.cs index 1bb8b5b..b987489 100644 --- a/src/FancyMouse.UnitTests/Common/Helpers/LayoutHelperTests.cs +++ b/src/FancyMouse.Common.UnitTests/Helpers/LayoutHelperTests.cs @@ -6,7 +6,7 @@ using FancyMouse.Common.Models.Styles; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace FancyMouse.UnitTests.Common.Helpers; +namespace FancyMouse.Common.UnitTests.Helpers; [TestClass] public static class LayoutHelperTests diff --git a/src/FancyMouse.UnitTests/Common/Helpers/MouseHelperTests.cs b/src/FancyMouse.Common.UnitTests/Helpers/MouseHelperTests.cs similarity index 98% rename from src/FancyMouse.UnitTests/Common/Helpers/MouseHelperTests.cs rename to src/FancyMouse.Common.UnitTests/Helpers/MouseHelperTests.cs index c797208..36c536e 100644 --- a/src/FancyMouse.UnitTests/Common/Helpers/MouseHelperTests.cs +++ b/src/FancyMouse.Common.UnitTests/Helpers/MouseHelperTests.cs @@ -2,7 +2,7 @@ using FancyMouse.Common.Models.Drawing; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace FancyMouse.UnitTests.Common.Helpers; +namespace FancyMouse.Common.UnitTests.Helpers; [TestClass] public static class MouseHelperTests diff --git a/src/FancyMouse.UnitTests/Common/Helpers/_test-4grid-desktop.png b/src/FancyMouse.Common.UnitTests/Helpers/_test-4grid-desktop.png similarity index 100% rename from src/FancyMouse.UnitTests/Common/Helpers/_test-4grid-desktop.png rename to src/FancyMouse.Common.UnitTests/Helpers/_test-4grid-desktop.png diff --git a/src/FancyMouse.UnitTests/Common/Helpers/_test-4grid-expected.png b/src/FancyMouse.Common.UnitTests/Helpers/_test-4grid-expected.png similarity index 100% rename from src/FancyMouse.UnitTests/Common/Helpers/_test-4grid-expected.png rename to src/FancyMouse.Common.UnitTests/Helpers/_test-4grid-expected.png diff --git a/src/FancyMouse.UnitTests/Common/Helpers/_test-win11-desktop.png b/src/FancyMouse.Common.UnitTests/Helpers/_test-win11-desktop.png similarity index 100% rename from src/FancyMouse.UnitTests/Common/Helpers/_test-win11-desktop.png rename to src/FancyMouse.Common.UnitTests/Helpers/_test-win11-desktop.png diff --git a/src/FancyMouse.UnitTests/Common/Helpers/_test-win11-expected.png b/src/FancyMouse.Common.UnitTests/Helpers/_test-win11-expected.png similarity index 100% rename from src/FancyMouse.UnitTests/Common/Helpers/_test-win11-expected.png rename to src/FancyMouse.Common.UnitTests/Helpers/_test-win11-expected.png diff --git a/src/FancyMouse.UnitTests/Common/Models/Drawing/RectangleInfoTests.cs b/src/FancyMouse.Common.UnitTests/Models/Drawing/RectangleInfoTests.cs similarity index 98% rename from src/FancyMouse.UnitTests/Common/Models/Drawing/RectangleInfoTests.cs rename to src/FancyMouse.Common.UnitTests/Models/Drawing/RectangleInfoTests.cs index 6ebb0a9..18e05d5 100644 --- a/src/FancyMouse.UnitTests/Common/Models/Drawing/RectangleInfoTests.cs +++ b/src/FancyMouse.Common.UnitTests/Models/Drawing/RectangleInfoTests.cs @@ -1,7 +1,7 @@ using FancyMouse.Common.Models.Drawing; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace FancyMouse.UnitTests.Common.Models.Drawing; +namespace FancyMouse.Common.UnitTests.Models.Drawing; [TestClass] public static class RectangleInfoTests diff --git a/src/FancyMouse.UnitTests/Common/Models/Drawing/SizeInfoTests.cs b/src/FancyMouse.Common.UnitTests/Models/Drawing/SizeInfoTests.cs similarity index 98% rename from src/FancyMouse.UnitTests/Common/Models/Drawing/SizeInfoTests.cs rename to src/FancyMouse.Common.UnitTests/Models/Drawing/SizeInfoTests.cs index 15f850d..e268f20 100644 --- a/src/FancyMouse.UnitTests/Common/Models/Drawing/SizeInfoTests.cs +++ b/src/FancyMouse.Common.UnitTests/Models/Drawing/SizeInfoTests.cs @@ -1,7 +1,7 @@ using FancyMouse.Common.Models.Drawing; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace FancyMouse.UnitTests.Common.Models.Drawing; +namespace FancyMouse.Common.UnitTests.Models.Drawing; [TestClass] public static class SizeInfoTests diff --git a/src/FancyMouse.Common/FancyMouse.Common.csproj b/src/FancyMouse.Common/FancyMouse.Common.csproj new file mode 100644 index 0000000..337456f --- /dev/null +++ b/src/FancyMouse.Common/FancyMouse.Common.csproj @@ -0,0 +1,25 @@ + + + + net8.0-windows + enable + enable + true + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/FancyMouse/Common/Helpers/DrawingHelper.cs b/src/FancyMouse.Common/Helpers/DrawingHelper.cs similarity index 98% rename from src/FancyMouse/Common/Helpers/DrawingHelper.cs rename to src/FancyMouse.Common/Helpers/DrawingHelper.cs index 18138b0..80b3f9e 100644 --- a/src/FancyMouse/Common/Helpers/DrawingHelper.cs +++ b/src/FancyMouse.Common/Helpers/DrawingHelper.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using FancyMouse.Common.Imaging; @@ -8,7 +9,7 @@ namespace FancyMouse.Common.Helpers; -internal static class DrawingHelper +public static class DrawingHelper { public static Bitmap RenderPreview( PreviewLayout previewLayout, @@ -97,8 +98,13 @@ private static void DrawRaisedBorder( return; } + if (borderStyle.Color is null) + { + return; + } + // draw the main box border - using var borderBrush = new SolidBrush(borderStyle.Color); + using var borderBrush = new SolidBrush(borderStyle.Color.Value); var borderRegion = new Region(boxBounds.BorderBounds.ToRectangle()); borderRegion.Exclude(boxBounds.PaddingBounds.ToRectangle()); graphics.FillRegion(borderBrush, borderRegion); diff --git a/src/FancyMouse/Common/Helpers/LayoutHelper.cs b/src/FancyMouse.Common/Helpers/LayoutHelper.cs similarity index 98% rename from src/FancyMouse/Common/Helpers/LayoutHelper.cs rename to src/FancyMouse.Common/Helpers/LayoutHelper.cs index 3643046..00869bc 100644 --- a/src/FancyMouse/Common/Helpers/LayoutHelper.cs +++ b/src/FancyMouse.Common/Helpers/LayoutHelper.cs @@ -4,7 +4,7 @@ namespace FancyMouse.Common.Helpers; -internal static class LayoutHelper +public static class LayoutHelper { public static PreviewLayout GetPreviewLayout( PreviewStyle previewStyle, List screens, PointInfo activatedLocation) @@ -87,7 +87,7 @@ public static PreviewLayout GetPreviewLayout( return builder.Build(); } - internal static RectangleInfo GetCombinedScreenBounds(List screens) + private static RectangleInfo GetCombinedScreenBounds(List screens) { return screens.Skip(1).Aggregate( seed: screens.First(), diff --git a/src/FancyMouse/Common/Helpers/MouseHelper.cs b/src/FancyMouse.Common/Helpers/MouseHelper.cs similarity index 93% rename from src/FancyMouse/Common/Helpers/MouseHelper.cs rename to src/FancyMouse.Common/Helpers/MouseHelper.cs index 82e6243..8538ff0 100644 --- a/src/FancyMouse/Common/Helpers/MouseHelper.cs +++ b/src/FancyMouse.Common/Helpers/MouseHelper.cs @@ -7,7 +7,7 @@ namespace FancyMouse.Common.Helpers; -internal static class MouseHelper +public static class MouseHelper { /// /// Calculates where to move the cursor to by projecting a point from @@ -18,7 +18,7 @@ internal static class MouseHelper /// or even negative if the primary monitor is not the at the top-left of the /// entire desktop rectangle, so results may contain negative coordinates. /// - internal static PointInfo GetJumpLocation(PointInfo previewLocation, SizeInfo previewSize, RectangleInfo desktopBounds) + public static PointInfo GetJumpLocation(PointInfo previewLocation, SizeInfo previewSize, RectangleInfo desktopBounds) { return previewLocation .Scale(previewSize.ScaleToFitRatio(desktopBounds.Size)) @@ -28,7 +28,7 @@ internal static PointInfo GetJumpLocation(PointInfo previewLocation, SizeInfo pr /// /// Get the current position of the cursor. /// - internal static PointInfo GetCursorPosition() + public static PointInfo GetCursorPosition() { var lpPoint = new LPPOINT(new POINT(0, 0)); var result = User32.GetCursorPos(lpPoint); @@ -51,7 +51,7 @@ internal static PointInfo GetCursorPosition() /// /// See https://github.com/mikeclayton/FancyMouse/pull/3 /// - internal static void SetCursorPosition(PointInfo location) + public static void SetCursorPosition(PointInfo location) { // set the new cursor position *twice* - the cursor sometimes end up in // the wrong place if we try to cross the dead space between non-aligned @@ -97,7 +97,7 @@ internal static void SetCursorPosition(PointInfo location) /// See https://github.com/microsoft/PowerToys/issues/24523 /// https://github.com/microsoft/PowerToys/pull/24527 /// - internal static void SimulateMouseMovementEvent(PointInfo location) + private static void SimulateMouseMovementEvent(PointInfo location) { var inputs = new User32.INPUT[] { diff --git a/src/FancyMouse/Common/Helpers/ScreenHelper.cs b/src/FancyMouse.Common/Helpers/ScreenHelper.cs similarity index 94% rename from src/FancyMouse/Common/Helpers/ScreenHelper.cs rename to src/FancyMouse.Common/Helpers/ScreenHelper.cs index 61ca95b..3a9a6a1 100644 --- a/src/FancyMouse/Common/Helpers/ScreenHelper.cs +++ b/src/FancyMouse.Common/Helpers/ScreenHelper.cs @@ -6,13 +6,13 @@ namespace FancyMouse.Common.Helpers; -internal static class ScreenHelper +public static class ScreenHelper { /// /// Duplicates functionality available in System.Windows.Forms.SystemInformation /// to reduce the dependency on WinForms /// - public static RectangleInfo GetVirtualScreen() + private static RectangleInfo GetVirtualScreen() { return new( User32.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_XVIRTUALSCREEN), @@ -21,7 +21,7 @@ public static RectangleInfo GetVirtualScreen() User32.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_CYVIRTUALSCREEN)); } - internal static IEnumerable GetAllScreens() + public static IEnumerable GetAllScreens() { // enumerate the monitors attached to the system var hMonitors = new List(); @@ -71,7 +71,7 @@ internal static IEnumerable GetAllScreens() } } - internal static ScreenInfo GetScreenFromPoint( + public static ScreenInfo GetScreenFromPoint( List screens, PointInfo pt) { diff --git a/src/FancyMouse/Common/Imaging/DesktopImageRegionCopyService.cs b/src/FancyMouse.Common/Imaging/DesktopImageRegionCopyService.cs similarity index 97% rename from src/FancyMouse/Common/Imaging/DesktopImageRegionCopyService.cs rename to src/FancyMouse.Common/Imaging/DesktopImageRegionCopyService.cs index 509074a..da7cbf5 100644 --- a/src/FancyMouse/Common/Imaging/DesktopImageRegionCopyService.cs +++ b/src/FancyMouse.Common/Imaging/DesktopImageRegionCopyService.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Drawing; using FancyMouse.Common.Models.Drawing; using FancyMouse.Common.NativeMethods; using static FancyMouse.Common.NativeMethods.Core; @@ -9,7 +10,7 @@ namespace FancyMouse.Common.Imaging; /// Implements an IImageRegionCopyService that uses the current desktop window as the copy source. /// This is used during the main application runtime to generate preview images of the desktop. /// -internal sealed class DesktopImageRegionCopyService : IImageRegionCopyService +public sealed class DesktopImageRegionCopyService : IImageRegionCopyService { /// /// Copies the source region from the current desktop window diff --git a/src/FancyMouse/Common/Imaging/IImageRegionCopyService.cs b/src/FancyMouse.Common/Imaging/IImageRegionCopyService.cs similarity index 85% rename from src/FancyMouse/Common/Imaging/IImageRegionCopyService.cs rename to src/FancyMouse.Common/Imaging/IImageRegionCopyService.cs index c9c2d30..e185d23 100644 --- a/src/FancyMouse/Common/Imaging/IImageRegionCopyService.cs +++ b/src/FancyMouse.Common/Imaging/IImageRegionCopyService.cs @@ -1,8 +1,9 @@ -using FancyMouse.Common.Models.Drawing; +using System.Drawing; +using FancyMouse.Common.Models.Drawing; namespace FancyMouse.Common.Imaging; -internal interface IImageRegionCopyService +public interface IImageRegionCopyService { /// /// Copies the source region from the provider's source image (e.g. the interactive desktop, diff --git a/src/FancyMouse/Common/Imaging/StaticImageRegionCopyService.cs b/src/FancyMouse.Common/Imaging/StaticImageRegionCopyService.cs similarity index 87% rename from src/FancyMouse/Common/Imaging/StaticImageRegionCopyService.cs rename to src/FancyMouse.Common/Imaging/StaticImageRegionCopyService.cs index f2f858a..31579b4 100644 --- a/src/FancyMouse/Common/Imaging/StaticImageRegionCopyService.cs +++ b/src/FancyMouse.Common/Imaging/StaticImageRegionCopyService.cs @@ -1,4 +1,5 @@ -using FancyMouse.Common.Models.Drawing; +using System.Drawing; +using FancyMouse.Common.Models.Drawing; namespace FancyMouse.Common.Imaging; @@ -6,7 +7,7 @@ namespace FancyMouse.Common.Imaging; /// Implements an IImageRegionCopyService that uses the specified image as the copy source. /// This is used for testing the DrawingHelper rather than as part of the main application. /// -internal sealed class StaticImageRegionCopyService : IImageRegionCopyService +public sealed class StaticImageRegionCopyService : IImageRegionCopyService { public StaticImageRegionCopyService(Image sourceImage) { diff --git a/src/FancyMouse/Common/Models/Drawing/BoxBounds.cs b/src/FancyMouse.Common/Models/Drawing/BoxBounds.cs similarity index 100% rename from src/FancyMouse/Common/Models/Drawing/BoxBounds.cs rename to src/FancyMouse.Common/Models/Drawing/BoxBounds.cs diff --git a/src/FancyMouse/Common/Models/Drawing/PointInfo.cs b/src/FancyMouse.Common/Models/Drawing/PointInfo.cs similarity index 96% rename from src/FancyMouse/Common/Models/Drawing/PointInfo.cs rename to src/FancyMouse.Common/Models/Drawing/PointInfo.cs index 850b408..b8de4ec 100644 --- a/src/FancyMouse/Common/Models/Drawing/PointInfo.cs +++ b/src/FancyMouse.Common/Models/Drawing/PointInfo.cs @@ -1,4 +1,6 @@ -namespace FancyMouse.Common.Models.Drawing; +using System.Drawing; + +namespace FancyMouse.Common.Models.Drawing; /// /// Immutable version of a System.Drawing.Point object with some extra utility methods. diff --git a/src/FancyMouse/Common/Models/Drawing/RectangleInfo.cs b/src/FancyMouse.Common/Models/Drawing/RectangleInfo.cs similarity index 99% rename from src/FancyMouse/Common/Models/Drawing/RectangleInfo.cs rename to src/FancyMouse.Common/Models/Drawing/RectangleInfo.cs index 7cd5815..1ec75a6 100644 --- a/src/FancyMouse/Common/Models/Drawing/RectangleInfo.cs +++ b/src/FancyMouse.Common/Models/Drawing/RectangleInfo.cs @@ -1,4 +1,5 @@ -using System.Text.Json.Serialization; +using System.Drawing; +using System.Text.Json.Serialization; using FancyMouse.Common.Models.Styles; using BorderStyle = FancyMouse.Common.Models.Styles.BorderStyle; diff --git a/src/FancyMouse/Common/Models/Drawing/ScreenInfo.cs b/src/FancyMouse.Common/Models/Drawing/ScreenInfo.cs similarity index 72% rename from src/FancyMouse/Common/Models/Drawing/ScreenInfo.cs rename to src/FancyMouse.Common/Models/Drawing/ScreenInfo.cs index 658432e..9398af3 100644 --- a/src/FancyMouse/Common/Models/Drawing/ScreenInfo.cs +++ b/src/FancyMouse.Common/Models/Drawing/ScreenInfo.cs @@ -6,10 +6,12 @@ namespace FancyMouse.Common.Models.Drawing; /// Immutable version of a System.Windows.Forms.Screen object so we don't need to /// take a dependency on WinForms just for screen info. /// -internal sealed class ScreenInfo +public sealed class ScreenInfo { - internal ScreenInfo(HMONITOR handle, bool primary, RectangleInfo displayArea, RectangleInfo workingArea) + public ScreenInfo(int handle, bool primary, RectangleInfo displayArea, RectangleInfo workingArea) { + // this.Handle is a HMONITOR that has been cast to an int because we don't want + // to expose the HMONITOR type outside the current assembly. this.Handle = handle; this.Primary = primary; this.DisplayArea = displayArea ?? throw new ArgumentNullException(nameof(displayArea)); diff --git a/src/FancyMouse/Common/Models/Drawing/SizeInfo.cs b/src/FancyMouse.Common/Models/Drawing/SizeInfo.cs similarity index 98% rename from src/FancyMouse/Common/Models/Drawing/SizeInfo.cs rename to src/FancyMouse.Common/Models/Drawing/SizeInfo.cs index 89da740..d878409 100644 --- a/src/FancyMouse/Common/Models/Drawing/SizeInfo.cs +++ b/src/FancyMouse.Common/Models/Drawing/SizeInfo.cs @@ -1,4 +1,5 @@ -using FancyMouse.Common.Models.Styles; +using System.Drawing; +using FancyMouse.Common.Models.Styles; using BorderStyle = FancyMouse.Common.Models.Styles.BorderStyle; namespace FancyMouse.Common.Models.Drawing; diff --git a/src/FancyMouse/Common/Models/Layout/PreviewLayout.cs b/src/FancyMouse.Common/Models/Layout/PreviewLayout.cs similarity index 100% rename from src/FancyMouse/Common/Models/Layout/PreviewLayout.cs rename to src/FancyMouse.Common/Models/Layout/PreviewLayout.cs diff --git a/src/FancyMouse/Common/Models/Styles/BackgroundStyle.cs b/src/FancyMouse.Common/Models/Styles/BackgroundStyle.cs similarity index 90% rename from src/FancyMouse/Common/Models/Styles/BackgroundStyle.cs rename to src/FancyMouse.Common/Models/Styles/BackgroundStyle.cs index 3583bc2..61dfb7a 100644 --- a/src/FancyMouse/Common/Models/Styles/BackgroundStyle.cs +++ b/src/FancyMouse.Common/Models/Styles/BackgroundStyle.cs @@ -1,4 +1,6 @@ -namespace FancyMouse.Common.Models.Styles; +using System.Drawing; + +namespace FancyMouse.Common.Models.Styles; /// /// Represents the background fill style for a drawing object. diff --git a/src/FancyMouse/Common/Models/Styles/BorderStyle.cs b/src/FancyMouse.Common/Models/Styles/BorderStyle.cs similarity index 79% rename from src/FancyMouse/Common/Models/Styles/BorderStyle.cs rename to src/FancyMouse.Common/Models/Styles/BorderStyle.cs index ad589f6..a5631ff 100644 --- a/src/FancyMouse/Common/Models/Styles/BorderStyle.cs +++ b/src/FancyMouse.Common/Models/Styles/BorderStyle.cs @@ -1,18 +1,20 @@ -namespace FancyMouse.Common.Models.Styles; +using System.Drawing; + +namespace FancyMouse.Common.Models.Styles; /// /// Represents the border style for a drawing object. /// public sealed class BorderStyle { - public static readonly BorderStyle Empty = new(Color.Transparent, 0, 0); + public static readonly BorderStyle Empty = new(null, 0, 0); - public BorderStyle(Color color, decimal all, decimal depth) + public BorderStyle(Color? color, decimal all, decimal depth) : this(color, all, all, all, all, depth) { } - public BorderStyle(Color color, decimal left, decimal top, decimal right, decimal bottom, decimal depth) + public BorderStyle(Color? color, decimal left, decimal top, decimal right, decimal bottom, decimal depth) { this.Color = color; this.Left = left; @@ -22,7 +24,7 @@ public BorderStyle(Color color, decimal left, decimal top, decimal right, decima this.Depth = depth; } - public Color Color + public Color? Color { get; } diff --git a/src/FancyMouse/Common/Models/Styles/BoxStyle.cs b/src/FancyMouse.Common/Models/Styles/BoxStyle.cs similarity index 100% rename from src/FancyMouse/Common/Models/Styles/BoxStyle.cs rename to src/FancyMouse.Common/Models/Styles/BoxStyle.cs diff --git a/src/FancyMouse/Common/Models/Styles/MarginStyle.cs b/src/FancyMouse.Common/Models/Styles/MarginStyle.cs similarity index 100% rename from src/FancyMouse/Common/Models/Styles/MarginStyle.cs rename to src/FancyMouse.Common/Models/Styles/MarginStyle.cs diff --git a/src/FancyMouse/Common/Models/Styles/PaddingStyle.cs b/src/FancyMouse.Common/Models/Styles/PaddingStyle.cs similarity index 100% rename from src/FancyMouse/Common/Models/Styles/PaddingStyle.cs rename to src/FancyMouse.Common/Models/Styles/PaddingStyle.cs diff --git a/src/FancyMouse/Common/Models/Styles/PreviewStyle.cs b/src/FancyMouse.Common/Models/Styles/PreviewStyle.cs similarity index 100% rename from src/FancyMouse/Common/Models/Styles/PreviewStyle.cs rename to src/FancyMouse.Common/Models/Styles/PreviewStyle.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/ATOM.cs b/src/FancyMouse.Common/NativeMethods/Core/ATOM.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/ATOM.cs rename to src/FancyMouse.Common/NativeMethods/Core/ATOM.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/BOOL.cs b/src/FancyMouse.Common/NativeMethods/Core/BOOL.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/BOOL.cs rename to src/FancyMouse.Common/NativeMethods/Core/BOOL.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/BYTE.cs b/src/FancyMouse.Common/NativeMethods/Core/BYTE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/BYTE.cs rename to src/FancyMouse.Common/NativeMethods/Core/BYTE.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/CRECT.cs b/src/FancyMouse.Common/NativeMethods/Core/CRECT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/CRECT.cs rename to src/FancyMouse.Common/NativeMethods/Core/CRECT.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/DWORD.cs b/src/FancyMouse.Common/NativeMethods/Core/DWORD.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/DWORD.cs rename to src/FancyMouse.Common/NativeMethods/Core/DWORD.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/GUID.cs b/src/FancyMouse.Common/NativeMethods/Core/GUID.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/GUID.cs rename to src/FancyMouse.Common/NativeMethods/Core/GUID.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HANDLE.cs b/src/FancyMouse.Common/NativeMethods/Core/HANDLE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HANDLE.cs rename to src/FancyMouse.Common/NativeMethods/Core/HANDLE.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HBITMAP.cs b/src/FancyMouse.Common/NativeMethods/Core/HBITMAP.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HBITMAP.cs rename to src/FancyMouse.Common/NativeMethods/Core/HBITMAP.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HBRUSH.cs b/src/FancyMouse.Common/NativeMethods/Core/HBRUSH.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HBRUSH.cs rename to src/FancyMouse.Common/NativeMethods/Core/HBRUSH.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HCURSOR.cs b/src/FancyMouse.Common/NativeMethods/Core/HCURSOR.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HCURSOR.cs rename to src/FancyMouse.Common/NativeMethods/Core/HCURSOR.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HDC.cs b/src/FancyMouse.Common/NativeMethods/Core/HDC.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HDC.cs rename to src/FancyMouse.Common/NativeMethods/Core/HDC.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HDESK.cs b/src/FancyMouse.Common/NativeMethods/Core/HDESK.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HDESK.cs rename to src/FancyMouse.Common/NativeMethods/Core/HDESK.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HGDIOBJ.cs b/src/FancyMouse.Common/NativeMethods/Core/HGDIOBJ.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HGDIOBJ.cs rename to src/FancyMouse.Common/NativeMethods/Core/HGDIOBJ.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HICON.cs b/src/FancyMouse.Common/NativeMethods/Core/HICON.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HICON.cs rename to src/FancyMouse.Common/NativeMethods/Core/HICON.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HINSTANCE.cs b/src/FancyMouse.Common/NativeMethods/Core/HINSTANCE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HINSTANCE.cs rename to src/FancyMouse.Common/NativeMethods/Core/HINSTANCE.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HMENU.cs b/src/FancyMouse.Common/NativeMethods/Core/HMENU.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HMENU.cs rename to src/FancyMouse.Common/NativeMethods/Core/HMENU.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HMODULE.cs b/src/FancyMouse.Common/NativeMethods/Core/HMODULE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HMODULE.cs rename to src/FancyMouse.Common/NativeMethods/Core/HMODULE.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HMONITOR.cs b/src/FancyMouse.Common/NativeMethods/Core/HMONITOR.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HMONITOR.cs rename to src/FancyMouse.Common/NativeMethods/Core/HMONITOR.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HWINSTA.cs b/src/FancyMouse.Common/NativeMethods/Core/HWINSTA.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HWINSTA.cs rename to src/FancyMouse.Common/NativeMethods/Core/HWINSTA.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/HWND.cs b/src/FancyMouse.Common/NativeMethods/Core/HWND.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/HWND.cs rename to src/FancyMouse.Common/NativeMethods/Core/HWND.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/LONG.cs b/src/FancyMouse.Common/NativeMethods/Core/LONG.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/LONG.cs rename to src/FancyMouse.Common/NativeMethods/Core/LONG.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/LPARAM.cs b/src/FancyMouse.Common/NativeMethods/Core/LPARAM.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/LPARAM.cs rename to src/FancyMouse.Common/NativeMethods/Core/LPARAM.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/LPCRECT.cs b/src/FancyMouse.Common/NativeMethods/Core/LPCRECT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/LPCRECT.cs rename to src/FancyMouse.Common/NativeMethods/Core/LPCRECT.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/LPCWSTR.cs b/src/FancyMouse.Common/NativeMethods/Core/LPCWSTR.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/LPCWSTR.cs rename to src/FancyMouse.Common/NativeMethods/Core/LPCWSTR.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/LPDWORD.cs b/src/FancyMouse.Common/NativeMethods/Core/LPDWORD.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/LPDWORD.cs rename to src/FancyMouse.Common/NativeMethods/Core/LPDWORD.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/LPPOINT.cs b/src/FancyMouse.Common/NativeMethods/Core/LPPOINT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/LPPOINT.cs rename to src/FancyMouse.Common/NativeMethods/Core/LPPOINT.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/LPRECT.cs b/src/FancyMouse.Common/NativeMethods/Core/LPRECT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/LPRECT.cs rename to src/FancyMouse.Common/NativeMethods/Core/LPRECT.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/LPTSTR.cs b/src/FancyMouse.Common/NativeMethods/Core/LPTSTR.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/LPTSTR.cs rename to src/FancyMouse.Common/NativeMethods/Core/LPTSTR.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/LPVOID.cs b/src/FancyMouse.Common/NativeMethods/Core/LPVOID.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/LPVOID.cs rename to src/FancyMouse.Common/NativeMethods/Core/LPVOID.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/LRESULT.cs b/src/FancyMouse.Common/NativeMethods/Core/LRESULT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/LRESULT.cs rename to src/FancyMouse.Common/NativeMethods/Core/LRESULT.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/PCWSTR.cs b/src/FancyMouse.Common/NativeMethods/Core/PCWSTR.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/PCWSTR.cs rename to src/FancyMouse.Common/NativeMethods/Core/PCWSTR.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/POINT.cs b/src/FancyMouse.Common/NativeMethods/Core/POINT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/POINT.cs rename to src/FancyMouse.Common/NativeMethods/Core/POINT.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/PVOID.cs b/src/FancyMouse.Common/NativeMethods/Core/PVOID.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/PVOID.cs rename to src/FancyMouse.Common/NativeMethods/Core/PVOID.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/RECT.cs b/src/FancyMouse.Common/NativeMethods/Core/RECT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/RECT.cs rename to src/FancyMouse.Common/NativeMethods/Core/RECT.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/UINT.cs b/src/FancyMouse.Common/NativeMethods/Core/UINT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/UINT.cs rename to src/FancyMouse.Common/NativeMethods/Core/UINT.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/ULONG.cs b/src/FancyMouse.Common/NativeMethods/Core/ULONG.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/ULONG.cs rename to src/FancyMouse.Common/NativeMethods/Core/ULONG.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/ULONG_PTR.cs b/src/FancyMouse.Common/NativeMethods/Core/ULONG_PTR.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/ULONG_PTR.cs rename to src/FancyMouse.Common/NativeMethods/Core/ULONG_PTR.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/WCHAR.cs b/src/FancyMouse.Common/NativeMethods/Core/WCHAR.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/WCHAR.cs rename to src/FancyMouse.Common/NativeMethods/Core/WCHAR.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/WORD.cs b/src/FancyMouse.Common/NativeMethods/Core/WORD.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/WORD.cs rename to src/FancyMouse.Common/NativeMethods/Core/WORD.cs diff --git a/src/FancyMouse/Common/NativeMethods/Core/WPARAM.cs b/src/FancyMouse.Common/NativeMethods/Core/WPARAM.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Core/WPARAM.cs rename to src/FancyMouse.Common/NativeMethods/Core/WPARAM.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Gdi32.COLOR16.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Gdi32.COLOR16.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Gdi32.COLOR16.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Gdi32.COLOR16.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Gdi32.COLORREF.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Gdi32.COLORREF.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Gdi32.COLORREF.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Gdi32.COLORREF.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleBitmap.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleBitmap.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleBitmap.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleBitmap.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleDC.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleDC.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleDC.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleDC.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateSolidBrush.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateSolidBrush.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateSolidBrush.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateSolidBrush.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SetStretchBltMode.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SetStretchBltMode.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SetStretchBltMode.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SetStretchBltMode.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs diff --git a/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs b/src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs rename to src/FancyMouse.Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs diff --git a/src/FancyMouse/Common/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs b/src/FancyMouse.Common/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs rename to src/FancyMouse.Common/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs diff --git a/src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.LPSECURITY_ATTRIBUTES.cs b/src/FancyMouse.Common/NativeMethods/Kernel32/Security/Kernel32.LPSECURITY_ATTRIBUTES.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.LPSECURITY_ATTRIBUTES.cs rename to src/FancyMouse.Common/NativeMethods/Kernel32/Security/Kernel32.LPSECURITY_ATTRIBUTES.cs diff --git a/src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.QUEUE_FLAGS_STATUS.cs b/src/FancyMouse.Common/NativeMethods/Kernel32/Security/Kernel32.QUEUE_FLAGS_STATUS.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.QUEUE_FLAGS_STATUS.cs rename to src/FancyMouse.Common/NativeMethods/Kernel32/Security/Kernel32.QUEUE_FLAGS_STATUS.cs diff --git a/src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.SECURITY_ATTRIBUTES.cs b/src/FancyMouse.Common/NativeMethods/Kernel32/Security/Kernel32.SECURITY_ATTRIBUTES.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.SECURITY_ATTRIBUTES.cs rename to src/FancyMouse.Common/NativeMethods/Kernel32/Security/Kernel32.SECURITY_ATTRIBUTES.cs diff --git a/src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.CreateEventW.cs b/src/FancyMouse.Common/NativeMethods/Kernel32/SystemServices/Kernel32.CreateEventW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.CreateEventW.cs rename to src/FancyMouse.Common/NativeMethods/Kernel32/SystemServices/Kernel32.CreateEventW.cs diff --git a/src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.GetModuleHandleW.cs b/src/FancyMouse.Common/NativeMethods/Kernel32/SystemServices/Kernel32.GetModuleHandleW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.GetModuleHandleW.cs rename to src/FancyMouse.Common/NativeMethods/Kernel32/SystemServices/Kernel32.GetModuleHandleW.cs diff --git a/src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.SetEvent.cs b/src/FancyMouse.Common/NativeMethods/Kernel32/SystemServices/Kernel32.SetEvent.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.SetEvent.cs rename to src/FancyMouse.Common/NativeMethods/Kernel32/SystemServices/Kernel32.SetEvent.cs diff --git a/src/FancyMouse/Common/NativeMethods/Libraries.cs b/src/FancyMouse.Common/NativeMethods/Libraries.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Libraries.cs rename to src/FancyMouse.Common/NativeMethods/Libraries.cs diff --git a/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.NOTIFYICONDATAW.cs b/src/FancyMouse.Common/NativeMethods/Shell32/Shell32.NOTIFYICONDATAW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Shell32/Shell32.NOTIFYICONDATAW.cs rename to src/FancyMouse.Common/NativeMethods/Shell32/Shell32.NOTIFYICONDATAW.cs diff --git a/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs b/src/FancyMouse.Common/NativeMethods/Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs rename to src/FancyMouse.Common/NativeMethods/Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs diff --git a/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.PNOTIFYICONDATAW.cs b/src/FancyMouse.Common/NativeMethods/Shell32/Shell32.PNOTIFYICONDATAW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Shell32/Shell32.PNOTIFYICONDATAW.cs rename to src/FancyMouse.Common/NativeMethods/Shell32/Shell32.PNOTIFYICONDATAW.cs diff --git a/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.Shell_NotifyIconW.cs b/src/FancyMouse.Common/NativeMethods/Shell32/Shell32.Shell_NotifyIconW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/Shell32/Shell32.Shell_NotifyIconW.cs rename to src/FancyMouse.Common/NativeMethods/Shell32/Shell32.Shell_NotifyIconW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.EnumDisplayMonitors.cs b/src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.EnumDisplayMonitors.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.EnumDisplayMonitors.cs rename to src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.EnumDisplayMonitors.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.FillRect.cs b/src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.FillRect.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.FillRect.cs rename to src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.FillRect.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.GetMonitorInfoW.cs b/src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.GetMonitorInfoW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.GetMonitorInfoW.cs rename to src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.GetMonitorInfoW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.GetWindowDC.cs b/src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.GetWindowDC.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.GetWindowDC.cs rename to src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.GetWindowDC.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.LPMONITORINFO.cs b/src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.LPMONITORINFO.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.LPMONITORINFO.cs rename to src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.LPMONITORINFO.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORENUMPROC .cs b/src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORENUMPROC .cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORENUMPROC .cs rename to src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORENUMPROC .cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORINFO.cs b/src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORINFO.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORINFO.cs rename to src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORINFO.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs b/src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs rename to src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs b/src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs rename to src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MonitorFromPoint .cs b/src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.MonitorFromPoint .cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MonitorFromPoint .cs rename to src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.MonitorFromPoint .cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.ReleaseDC.cs b/src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.ReleaseDC.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.ReleaseDC.cs rename to src/FancyMouse.Common/NativeMethods/User32/Graphics/Gdi/User32.ReleaseDC.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HARDWAREINPUT.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HARDWAREINPUT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HARDWAREINPUT.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HARDWAREINPUT.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT_TYPE.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT_TYPE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT_TYPE.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT_TYPE.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.KEYBDINPUT.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.KEYBDINPUT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.KEYBDINPUT.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.KEYBDINPUT.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.LPINPUT.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.LPINPUT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.LPINPUT.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.LPINPUT.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSEINPUT.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSEINPUT.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSEINPUT.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSEINPUT.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSE_EVENT_FLAGS.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSE_EVENT_FLAGS.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSE_EVENT_FLAGS.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSE_EVENT_FLAGS.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.SendInput.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.SendInput.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.SendInput.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.SendInput.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DestroyWindow.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DestroyWindow.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DestroyWindow.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DestroyWindow.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetClassInfoExW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetClassInfoExW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetClassInfoExW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetClassInfoExW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetCursorPos.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetCursorPos.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetCursorPos.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetCursorPos.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetDesktopWindow.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetDesktopWindow.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetDesktopWindow.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetDesktopWindow.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetSystemMetrics.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetSystemMetrics.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetSystemMetrics.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetSystemMetrics.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPWNDCLASSEXW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPWNDCLASSEXW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPWNDCLASSEXW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPWNDCLASSEXW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PEEK_MESSAGE_REMOVE_TYPE.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PEEK_MESSAGE_REMOVE_TYPE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PEEK_MESSAGE_REMOVE_TYPE.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PEEK_MESSAGE_REMOVE_TYPE.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PeekMessageW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PeekMessageW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PeekMessageW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PeekMessageW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostQuitMessage.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostQuitMessage.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostQuitMessage.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostQuitMessage.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SHOW_WINDOW_CMD.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SHOW_WINDOW_CMD.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SHOW_WINDOW_CMD.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SHOW_WINDOW_CMD.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SendMessageW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SendMessageW.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SendMessageW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SendMessageW.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SetCursorPos.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SetCursorPos.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SetCursorPos.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SetCursorPos.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.ShowWindow.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.ShowWindow.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.ShowWindow.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.ShowWindow.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs similarity index 97% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs index 782d181..dfbc256 100644 --- a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs +++ b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using static FancyMouse.Common.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.User32; namespace FancyMouse.Common.NativeMethods; diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WaitMessage.cs b/src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WaitMessage.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WaitMessage.cs rename to src/FancyMouse.Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WaitMessage.cs diff --git a/src/FancyMouse/Common/NativeMethods/User32/User32.cs b/src/FancyMouse.Common/NativeMethods/User32/User32.cs similarity index 100% rename from src/FancyMouse/Common/NativeMethods/User32/User32.cs rename to src/FancyMouse.Common/NativeMethods/User32/User32.cs diff --git a/src/FancyMouse.Common/Properties/AssemblyInfo.cs b/src/FancyMouse.Common/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..242c3fa --- /dev/null +++ b/src/FancyMouse.Common/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("FancyMouse.Common.UnitTests")] diff --git a/src/FancyMouse.HotKeys.UnitTests/FancyMouse.HotKeys.UnitTests.csproj b/src/FancyMouse.HotKeys.UnitTests/FancyMouse.HotKeys.UnitTests.csproj new file mode 100644 index 0000000..e65fa7b --- /dev/null +++ b/src/FancyMouse.HotKeys.UnitTests/FancyMouse.HotKeys.UnitTests.csproj @@ -0,0 +1,30 @@ + + + + net8.0-windows + enable + enable + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/FancyMouse.UnitTests/Hotkeys/KeystrokeTests.cs b/src/FancyMouse.HotKeys.UnitTests/KeystrokeTests.cs similarity index 94% rename from src/FancyMouse.UnitTests/Hotkeys/KeystrokeTests.cs rename to src/FancyMouse.HotKeys.UnitTests/KeystrokeTests.cs index 2642df3..3d94bbb 100644 --- a/src/FancyMouse.UnitTests/Hotkeys/KeystrokeTests.cs +++ b/src/FancyMouse.HotKeys.UnitTests/KeystrokeTests.cs @@ -1,7 +1,6 @@ -using FancyMouse.Internal.HotKeys; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace FancyMouse.UnitTests.HotKeys.Tests; +namespace FancyMouse.HotKeys.UnitTests; [TestClass] public static class KeystrokeTests diff --git a/src/FancyMouse.HotKeys/FancyMouse.HotKeys.csproj b/src/FancyMouse.HotKeys/FancyMouse.HotKeys.csproj new file mode 100644 index 0000000..bcebf22 --- /dev/null +++ b/src/FancyMouse.HotKeys/FancyMouse.HotKeys.csproj @@ -0,0 +1,21 @@ + + + + net8.0-windows + enable + enable + true + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/FancyMouse/Internal/HotKeys/HotKeyEventArgs.cs b/src/FancyMouse.HotKeys/HotKeyEventArgs.cs similarity index 72% rename from src/FancyMouse/Internal/HotKeys/HotKeyEventArgs.cs rename to src/FancyMouse.HotKeys/HotKeyEventArgs.cs index af6c2e7..d13bd84 100644 --- a/src/FancyMouse/Internal/HotKeys/HotKeyEventArgs.cs +++ b/src/FancyMouse.HotKeys/HotKeyEventArgs.cs @@ -1,6 +1,6 @@ -namespace FancyMouse.Internal.HotKeys; +namespace FancyMouse.HotKeys; -internal sealed class HotKeyEventArgs : EventArgs +public sealed class HotKeyEventArgs : EventArgs { public HotKeyEventArgs(Keys key, KeyModifiers modifiers) { diff --git a/src/FancyMouse/Internal/HotKeys/HotKeyHelper.cs b/src/FancyMouse.HotKeys/HotKeyHelper.cs similarity index 96% rename from src/FancyMouse/Internal/HotKeys/HotKeyHelper.cs rename to src/FancyMouse.HotKeys/HotKeyHelper.cs index d8b3a30..05508b2 100644 --- a/src/FancyMouse/Internal/HotKeys/HotKeyHelper.cs +++ b/src/FancyMouse.HotKeys/HotKeyHelper.cs @@ -2,11 +2,11 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using FancyMouse.Common.NativeMethods; -using static FancyMouse.Common.NativeMethods.Core; -using static FancyMouse.Common.NativeMethods.User32; +using FancyMouse.HotKeys.NativeMethods; +using static FancyMouse.HotKeys.NativeMethods.Core; +using static FancyMouse.HotKeys.NativeMethods.User32; -namespace FancyMouse.Internal.HotKeys; +namespace FancyMouse.HotKeys; internal static class HotKeyHelper { diff --git a/src/FancyMouse/Internal/HotKeys/HotKeyManager.cs b/src/FancyMouse.HotKeys/HotKeyManager.cs similarity index 94% rename from src/FancyMouse/Internal/HotKeys/HotKeyManager.cs rename to src/FancyMouse.HotKeys/HotKeyManager.cs index dea5819..aba9c26 100644 --- a/src/FancyMouse/Internal/HotKeys/HotKeyManager.cs +++ b/src/FancyMouse.HotKeys/HotKeyManager.cs @@ -1,15 +1,15 @@ -using FancyMouse.Common.NativeMethods; -using static FancyMouse.Common.NativeMethods.Core; -using static FancyMouse.Common.NativeMethods.User32; +using FancyMouse.HotKeys.NativeMethods; +using static FancyMouse.HotKeys.NativeMethods.Core; +using static FancyMouse.HotKeys.NativeMethods.User32; -namespace FancyMouse.Internal.HotKeys; +namespace FancyMouse.HotKeys; /// /// See https://stackoverflow.com/a/3654821/3156906 /// https://learn.microsoft.com/en-us/archive/msdn-magazine/2007/june/net-matters-handling-messages-in-console-apps /// https://www.codeproject.com/Articles/5274425/Understanding-Windows-Message-Queues-for-the-Cshar /// -internal sealed class HotKeyManager +public sealed class HotKeyManager { public event EventHandler? HotKeyPressed; diff --git a/src/FancyMouse/Internal/HotKeys/KeyModifiers.cs b/src/FancyMouse.HotKeys/KeyModifiers.cs similarity index 80% rename from src/FancyMouse/Internal/HotKeys/KeyModifiers.cs rename to src/FancyMouse.HotKeys/KeyModifiers.cs index 50af30d..deaacd4 100644 --- a/src/FancyMouse/Internal/HotKeys/KeyModifiers.cs +++ b/src/FancyMouse.HotKeys/KeyModifiers.cs @@ -1,6 +1,6 @@ -using FancyMouse.Common.NativeMethods; +using FancyMouse.HotKeys.NativeMethods; -namespace FancyMouse.Internal.HotKeys; +namespace FancyMouse.HotKeys; [Flags] public enum KeyModifiers diff --git a/src/FancyMouse/Internal/HotKeys/Keys.cs b/src/FancyMouse.HotKeys/Keys.cs similarity index 99% rename from src/FancyMouse/Internal/HotKeys/Keys.cs rename to src/FancyMouse.HotKeys/Keys.cs index 990d500..f0e027d 100644 --- a/src/FancyMouse/Internal/HotKeys/Keys.cs +++ b/src/FancyMouse.HotKeys/Keys.cs @@ -14,7 +14,7 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.Internal.HotKeys; +namespace FancyMouse.HotKeys; /// /// Specifies key codes and modifiers. diff --git a/src/FancyMouse/Internal/HotKeys/Keystroke.cs b/src/FancyMouse.HotKeys/Keystroke.cs similarity index 98% rename from src/FancyMouse/Internal/HotKeys/Keystroke.cs rename to src/FancyMouse.HotKeys/Keystroke.cs index fa9ae1f..6f83df5 100644 --- a/src/FancyMouse/Internal/HotKeys/Keystroke.cs +++ b/src/FancyMouse.HotKeys/Keystroke.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.Internal.HotKeys; +namespace FancyMouse.HotKeys; public sealed class Keystroke { diff --git a/src/FancyMouse/Internal/HotKeys/MessageLoop.cs b/src/FancyMouse.HotKeys/MessageLoop.cs similarity index 96% rename from src/FancyMouse/Internal/HotKeys/MessageLoop.cs rename to src/FancyMouse.HotKeys/MessageLoop.cs index 0736267..bb91f82 100644 --- a/src/FancyMouse/Internal/HotKeys/MessageLoop.cs +++ b/src/FancyMouse.HotKeys/MessageLoop.cs @@ -1,10 +1,10 @@ using System.ComponentModel; using System.Runtime.InteropServices; -using FancyMouse.Common.NativeMethods; -using static FancyMouse.Common.NativeMethods.Core; -using static FancyMouse.Common.NativeMethods.User32; +using FancyMouse.HotKeys.NativeMethods; +using static FancyMouse.HotKeys.NativeMethods.Core; +using static FancyMouse.HotKeys.NativeMethods.User32; -namespace FancyMouse.Internal.HotKeys; +namespace FancyMouse.HotKeys; internal sealed class MessageLoop { diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/ATOM.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/ATOM.cs new file mode 100644 index 0000000..58b533f --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/ATOM.cs @@ -0,0 +1,34 @@ +using System.Runtime.InteropServices; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// An atom. For more information, see About Atom Tables. + /// This type is declared in WinDef.h as follows: + /// typedef WORD ATOM; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct ATOM + { + [MarshalAs(UnmanagedType.U2)] + public readonly ushort Value; + + public ATOM(ushort value) + { + this.Value = value; + } + + public static implicit operator ushort(ATOM value) => value.Value; + + public static explicit operator ATOM(ushort value) => new(value); + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/BOOL.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/BOOL.cs new file mode 100644 index 0000000..a2bc4e2 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/BOOL.cs @@ -0,0 +1,40 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A Boolean variable (should be TRUE or FALSE). + /// This type is declared in WinDef.h as follows: + /// typedef int BOOL; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct BOOL + { + public readonly int Value; + + public BOOL(int value) + { + this.Value = value; + } + + public BOOL(bool value) + { + this.Value = value ? 1 : 0; + } + + public static implicit operator bool(BOOL value) => value.Value != 0; + + public static implicit operator BOOL(bool value) => new(value); + + public static implicit operator int(BOOL value) => value.Value; + + public static implicit operator BOOL(int value) => new(value); + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/DWORD.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/DWORD.cs new file mode 100644 index 0000000..0ee5918 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/DWORD.cs @@ -0,0 +1,40 @@ +using System.Runtime.InteropServices; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A 32-bit unsigned integer. The range is 0 through 4294967295 decimal. + /// This type is declared in IntSafe.h as follows: + /// typedef unsigned long DWORD; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct DWORD + { + public readonly uint Value; + + public DWORD(uint value) + { + this.Value = value; + } + + public static int Size => + Marshal.SizeOf(typeof(DWORD)); + + public static implicit operator uint(DWORD value) => value.Value; + + public static implicit operator DWORD(uint value) => new(value); + + public static explicit operator int(DWORD value) => (int)value.Value; + + public static explicit operator DWORD(int value) => new((uint)value); + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/HBRUSH.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/HBRUSH.cs new file mode 100644 index 0000000..de7095c --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/HBRUSH.cs @@ -0,0 +1,35 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A handle to a brush. + /// This type is declared in WinDef.h as follows: + /// typedef HANDLE HBRUSH; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct HBRUSH + { + public static readonly HBRUSH Null = new(IntPtr.Zero); + + public readonly IntPtr Value; + + public HBRUSH(IntPtr value) + { + this.Value = value; + } + + public bool IsNull => this.Value == HBRUSH.Null.Value; + + public static implicit operator IntPtr(HBRUSH value) => value.Value; + + public static explicit operator HBRUSH(IntPtr value) => new(value); + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/HCURSOR.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/HCURSOR.cs new file mode 100644 index 0000000..2337bf3 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/HCURSOR.cs @@ -0,0 +1,31 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A handle to a cursor. + /// This type is declared in WinDef.h as follows: + /// typedef HICON HCURSOR; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct HCURSOR + { + public static readonly HCURSOR Null = new(IntPtr.Zero); + + public readonly IntPtr Value; + + public HCURSOR(IntPtr value) + { + this.Value = value; + } + + public bool IsNull => this.Value == HCURSOR.Null.Value; + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/HICON.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/HICON.cs new file mode 100644 index 0000000..8857cc5 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/HICON.cs @@ -0,0 +1,31 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A handle to an icon. + /// This type is declared in WinDef.h as follows: + /// typedef HANDLE HICON; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct HICON + { + public static readonly HICON Null = new(IntPtr.Zero); + + public readonly IntPtr Value; + + public HICON(IntPtr value) + { + this.Value = value; + } + + public bool IsNull => this.Value == HICON.Null.Value; + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/HINSTANCE.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/HINSTANCE.cs new file mode 100644 index 0000000..6ab0e6d --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/HINSTANCE.cs @@ -0,0 +1,36 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A handle to an instance. This is the base address of the module in memory. + /// HMODULE and HINSTANCE are the same today, but represented different things in 16-bit Windows. + /// This type is declared in WinDef.h as follows: + /// typedef HANDLE HINSTANCE; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct HINSTANCE + { + public static readonly HINSTANCE Null = new(IntPtr.Zero); + + public readonly IntPtr Value; + + public HINSTANCE(IntPtr value) + { + this.Value = value; + } + + public bool IsNull => this.Value == HINSTANCE.Null.Value; + + public static implicit operator IntPtr(HINSTANCE value) => value.Value; + + public static explicit operator HINSTANCE(IntPtr value) => new(value); + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/HMENU.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/HMENU.cs new file mode 100644 index 0000000..ea72b06 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/HMENU.cs @@ -0,0 +1,31 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A handle to a menu. + /// This type is declared in WinDef.h as follows: + /// typedef HANDLE HMENU; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct HMENU + { + public static readonly HMENU Null = new(IntPtr.Zero); + + public readonly IntPtr Value; + + public HMENU(IntPtr value) + { + this.Value = value; + } + + public bool IsNull => this.Value == HMENU.Null.Value; + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/HWND.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/HWND.cs new file mode 100644 index 0000000..1f5dc95 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/HWND.cs @@ -0,0 +1,36 @@ +using System.Diagnostics.CodeAnalysis; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A handle to a window. + /// This type is declared in WinDef.h as follows: + /// typedef HANDLE HWND; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct HWND + { + public static readonly HWND Null = new(IntPtr.Zero); + + [SuppressMessage("SA1310", "SA1310:FieldNamesMustNotContainUnderscore", Justification = "Names match Win32 api")] + public static readonly HWND HWND_MESSAGE = new(-3); + + public readonly IntPtr Value; + + public HWND(IntPtr value) + { + this.Value = value; + } + + public bool IsNull => this.Value == HWND.Null.Value; + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/LONG.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/LONG.cs new file mode 100644 index 0000000..62281dc --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/LONG.cs @@ -0,0 +1,31 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A 32-bit signed integer.The range is -2147483648 through 2147483647 decimal. + /// This type is declared in WinNT.h as follows: + /// typedef long LONG; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct LONG + { + public readonly int Value; + + public LONG(int value) + { + this.Value = value; + } + + public static implicit operator int(LONG value) => value.Value; + + public static implicit operator LONG(int value) => new(value); + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/LPARAM.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/LPARAM.cs new file mode 100644 index 0000000..f6e6fd8 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/LPARAM.cs @@ -0,0 +1,35 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A message parameter. + /// This type is declared in WinDef.h as follows: + /// typedef LONG_PTR LPARAM; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct LPARAM + { + public static readonly LPARAM Null = new(IntPtr.Zero); + + public readonly IntPtr Value; + + public LPARAM(IntPtr value) + { + this.Value = value; + } + + public bool IsNull => this.Value == LPARAM.Null.Value; + + public static implicit operator IntPtr(LPARAM value) => value.Value; + + public static explicit operator LPARAM(IntPtr value) => new(value); + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/LPCWSTR.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/LPCWSTR.cs new file mode 100644 index 0000000..cf1eedc --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/LPCWSTR.cs @@ -0,0 +1,51 @@ +using System.Runtime.InteropServices; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A pointer to a constant null-terminated string of 16-bit Unicode characters.For more information, see Character Sets Used By Fonts. + /// This type is declared in WinNT.h as follows: + /// typedef CONST WCHAR* LPCWSTR; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct LPCWSTR + { + public static readonly LPCWSTR Null = new(IntPtr.Zero); + + public readonly IntPtr Value; + + public LPCWSTR(IntPtr value) + { + this.Value = value; + } + + public LPCWSTR(string value) + { + this.Value = Marshal.StringToHGlobalAuto(value); + } + + public bool IsNull => this.Value == LPCWSTR.Null.Value; + + public static implicit operator IntPtr(LPCWSTR value) => value.Value; + + public static explicit operator LPCWSTR(IntPtr value) => new(value); + + public static implicit operator string?(LPCWSTR value) => Marshal.PtrToStringUni(value.Value); + + public static explicit operator LPCWSTR(string value) => new(value); + + public void Free() + { + Marshal.FreeHGlobal(this.Value); + } + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/LPVOID.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/LPVOID.cs new file mode 100644 index 0000000..ec6461e --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/LPVOID.cs @@ -0,0 +1,51 @@ +using System.Runtime.InteropServices; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A pointer to any type. + /// This type is declared in WinDef.h as follows: + /// typedef void* LPVOID; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct LPVOID + { + public static readonly LPVOID Null = new(IntPtr.Zero); + + public readonly IntPtr Value; + + public LPVOID(IntPtr value) + { + this.Value = value; + } + + public static implicit operator IntPtr(LPVOID value) => value.Value; + + public static explicit operator LPVOID(IntPtr value) => new(value); + + public static LPVOID Allocate(int length) + { + var ptr = Marshal.AllocHGlobal(length); + return new LPVOID(ptr); + } + + public string? PtrToStringUni() + { + return Marshal.PtrToStringUni(this.Value); + } + + public void Free() + { + Marshal.FreeHGlobal(this.Value); + } + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/LRESULT.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/LRESULT.cs new file mode 100644 index 0000000..6ef5eb7 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/LRESULT.cs @@ -0,0 +1,33 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// Signed result of message processing. + /// This type is declared in WinDef.h as follows: + /// typedef LONG_PTR LRESULT; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct LRESULT + { + public static readonly LRESULT Null = new(IntPtr.Zero); + + public readonly IntPtr Value; + + public LRESULT(IntPtr value) + { + this.Value = value; + } + + public static implicit operator IntPtr(LRESULT value) => value.Value; + + public static explicit operator LRESULT(IntPtr value) => new(value); + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/PCWSTR.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/PCWSTR.cs new file mode 100644 index 0000000..9054694 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/PCWSTR.cs @@ -0,0 +1,49 @@ +using System.Runtime.InteropServices; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A pointer to a constant null-terminated string of 16-bit Unicode characters. For more information, see Character Sets Used By Fonts. + /// This type is declared in WinNT.h as follows: + /// typedef CONST WCHAR* PCWSTR; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct PCWSTR + { + public static readonly PCWSTR Null = new(IntPtr.Zero); + + public readonly IntPtr Value; + + public PCWSTR(IntPtr value) + { + this.Value = value; + } + + public PCWSTR(string value) + { + this.Value = Marshal.StringToHGlobalAuto(value); + } + + public static implicit operator IntPtr(PCWSTR value) => value.Value; + + public static explicit operator PCWSTR(IntPtr value) => new(value); + + public static implicit operator string?(PCWSTR value) => Marshal.PtrToStringUni(value.Value); + + public static explicit operator PCWSTR(string value) => new(value); + + public void Free() + { + Marshal.FreeHGlobal(this.Value); + } + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/POINT.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/POINT.cs new file mode 100644 index 0000000..578f61f --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/POINT.cs @@ -0,0 +1,51 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// The POINT structure defines the x- and y-coordinates of a point. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/windef/ns-windef-point + /// + [SuppressMessage("SA1307", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "Names match Win32 api")] + internal readonly struct POINT + { + /// + /// Specifies the x-coordinate of the point. + /// + public readonly LONG x; + + /// + /// Specifies the y-coordinate of the point. + /// + public readonly LONG y; + + public POINT( + int x, + int y) + { + this.x = x; + this.y = y; + } + + public POINT( + LONG x, + LONG y) + { + this.x = x; + this.y = y; + } + + public static int Size => + Marshal.SizeOf(typeof(POINT)); + + public override string ToString() + { + return $"x={this.x},y={this.y}"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/UINT.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/UINT.cs new file mode 100644 index 0000000..314f835 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/UINT.cs @@ -0,0 +1,35 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// An unsigned INT. The range is 0 through 4294967295 decimal. + /// This type is declared in WinDef.h as follows: + /// typedef unsigned int UINT; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct UINT + { + public readonly uint Value; + + public UINT(uint value) + { + this.Value = value; + } + + public static implicit operator uint(UINT value) => value.Value; + + public static implicit operator UINT(uint value) => new(value); + + public static explicit operator int(UINT value) => (int)value.Value; + + public static explicit operator UINT(int value) => new((uint)value); + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Core/WPARAM.cs b/src/FancyMouse.HotKeys/NativeMethods/Core/WPARAM.cs new file mode 100644 index 0000000..3455dad --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Core/WPARAM.cs @@ -0,0 +1,33 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Core +{ + /// + /// A message parameter. + /// This type is declared in WinDef.h as follows: + /// typedef UINT_PTR WPARAM; + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types + /// + internal readonly struct WPARAM + { + public static readonly WPARAM Null = new(UIntPtr.Zero); + + public readonly UIntPtr Value; + + public WPARAM(UIntPtr value) + { + this.Value = value; + } + + public static implicit operator UIntPtr(WPARAM value) => value.Value; + + public static explicit operator WPARAM(UIntPtr value) => new(value); + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs b/src/FancyMouse.HotKeys/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs new file mode 100644 index 0000000..20c80f6 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs @@ -0,0 +1,20 @@ +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class Kernel32 +{ + /// + /// Retrieves the thread identifier of the calling thread. + /// + /// + /// The return value is the thread identifier of the calling thread. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentthreadid + /// https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetCurrentThreadId.cs + /// + [LibraryImport(Libraries.Kernel32)] + internal static partial DWORD GetCurrentThreadId(); +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/Libraries.cs b/src/FancyMouse.HotKeys/NativeMethods/Libraries.cs new file mode 100644 index 0000000..e96d626 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/Libraries.cs @@ -0,0 +1,7 @@ +namespace FancyMouse.HotKeys.NativeMethods; + +internal static class Libraries +{ + public const string Kernel32 = "kernel32"; + public const string User32 = "user32"; +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs new file mode 100644 index 0000000..f3e7d40 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs @@ -0,0 +1,42 @@ +using System.Diagnostics.CodeAnalysis; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerhotkey + /// + [Flags] + [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Names and values taken from Win32Api")] + [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "Names and values taken from Win32Api")] + internal enum HOT_KEY_MODIFIERS : uint + { + /// + /// Either ALT key must be held down. + /// + MOD_ALT = 0x0001, + + /// + /// Either CTRL key must be held down. + /// + MOD_CONTROL = 0x0002, + + /// + /// Changes the hotkey behavior so that the keyboard auto-repeat does not yield multiple hotkey notifications. + /// + MOD_NOREPEAT = 0x4000, + + /// + /// Either SHIFT key must be held down. + /// + MOD_SHIFT = 0x0004, + + /// + /// Either WINDOWS key was held down. + /// These keys are labeled with the Windows logo. + /// Keyboard shortcuts that involve the WINDOWS key are reserved for use by the operating system. + /// + MOD_WIN = 0x0008, + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs new file mode 100644 index 0000000..722b297 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs @@ -0,0 +1,43 @@ +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Defines a system-wide hot key. + /// + /// + /// A handle to the window that will receive WM_HOTKEY messages generated by the hot key + /// If this parameter is NULL, WM_HOTKEY messages are posted to the message queue of the + /// calling thread and must be processed in the message loop. + /// + /// + /// The identifier of the hot key. If the hWnd parameter is NULL, then the hot key is + /// associated with the current thread rather than with a particular window. If a hot + /// key already exists with the same hWnd and id parameters, see Remarks for the action + /// taken. + /// + /// + /// The keys that must be pressed in combination with the key specified by the uVirtKey + /// parameter in order to generate the WM_HOTKEY message + /// + /// + /// The virtual-key code of the hot key. See Virtual Key Codes. + /// + /// + /// If the function succeeds, the return value is nonzero. + /// If the function fails, the return value is zero. + /// To get extended error information, call GetLastError. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerhotkey + /// + [LibraryImport(Libraries.User32, SetLastError = true)] + internal static partial BOOL RegisterHotKey( + HWND hWnd, + int id, + HOT_KEY_MODIFIERS fsModifiers, + UINT vk); +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs new file mode 100644 index 0000000..3d65c27 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs @@ -0,0 +1,30 @@ +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Frees a hot key previously registered by the calling thread. + /// + /// + /// A handle to the window associated with the hot key to be freed. + /// This parameter should be NULL if the hot key is not associated with a window. + /// + /// + /// The identifier of the hot key to be freed. + /// + /// + /// If the function succeeds, the return value is nonzero. + /// If the function fails, the return value is zero. + /// To get extended error information, call GetLastError. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-unregisterhotkey + /// + [LibraryImport(Libraries.User32, SetLastError = true)] + internal static partial BOOL UnregisterHotKey( + HWND hWnd, + int id); +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs new file mode 100644 index 0000000..d2bda3a --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs @@ -0,0 +1,121 @@ +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Creates an overlapped, pop-up, or child window with an extended window style + /// + /// + /// The extended window style of the window being created. + /// + /// + /// A null-terminated string or a class atom created by a previous call to the RegisterClass + /// or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the + /// high-order word must be zero. If lpClassName is a string, it specifies the window class + /// name. The class name can be any name registered with RegisterClass or RegisterClassEx, + /// provided that the module that registers the class is also the module that creates the + /// window. The class name can also be any of the predefined system class names. + /// + /// + /// The window name. If the window style specifies a title bar, the window title pointed to by + /// lpWindowName is displayed in the title bar. When using CreateWindow to create controls, + /// such as buttons, check boxes, and static controls, use lpWindowName to specify the text of + /// the control. When creating a static control with the SS_ICON style, use lpWindowName to + /// specify the icon name or identifier. To specify an identifier, use the syntax "#num". + /// + /// + /// The style of the window being created. This parameter can be a combination of the window + /// style values, plus the control styles indicated in the Remarks section. + /// + /// + /// The initial horizontal position of the window. For an overlapped or pop-up window, the x + /// parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. + /// For a child window, x is the x-coordinate of the upper-left corner of the window relative to + /// the upper-left corner of the parent window's client area. If x is set to CW_USEDEFAULT, the + /// system selects the default position for the window's upper-left corner and ignores the y + /// parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up + /// or child window, the x and y parameters are set to zero. + /// + /// + /// The initial vertical position of the window. For an overlapped or pop-up window, the y + /// parameter is the initial y-coordinate of the window's upper-left corner, in screen coordinates. + /// For a child window, y is the initial y-coordinate of the upper-left corner of the child window + /// relative to the upper-left corner of the parent window's client area. For a list box y is the + /// initial y-coordinate of the upper-left corner of the list box's client area relative to the + /// upper-left corner of the parent window's client area. + /// + /// If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is + /// set to CW_USEDEFAULT, then the y parameter determines how the window is shown.If the y + /// parameter is CW_USEDEFAULT, then the window manager calls ShowWindow with the SW_SHOW flag + /// after the window has been created.If the y parameter is some other value, then the window + /// manager calls ShowWindow with that value as the nCmdShow parameter. + /// + /// + /// The width, in device units, of the window. For overlapped windows, nWidth is the window's + /// width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, the system + /// selects a default width and height for the window; the default width extends from the + /// initial x-coordinates to the right edge of the screen; the default height extends from + /// the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for + /// overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, the + /// nWidth and nHeight parameter are set to zero. + /// + /// + /// The height, in device units, of the window. For overlapped windows, nHeight is the window's + /// height, in screen coordinates. If the nWidth parameter is set to CW_USEDEFAULT, the system + /// ignores nHeight. + /// + /// + /// A handle to the parent or owner window of the window being created. To create a child + /// window or an owned window, supply a valid window handle. This parameter is optional + /// for pop-up windows. + /// + /// To create a message-only window, supply HWND_MESSAGE or a handle to an existing + /// message-only window. + /// + /// + /// A handle to a menu, or specifies a child-window identifier, depending on the window + /// style. For an overlapped or pop-up window, hMenu identifies the menu to be used with + /// the window; it can be NULL if the class menu is to be used. For a child window, hMenu + /// specifies the child-window identifier, an integer value used by a dialog box control + /// to notify its parent about events. The application determines the child-window + /// identifier; it must be unique for all child windows with the same parent window. + /// + /// + /// A handle to the instance of the module to be associated with the window. + /// + /// + /// Pointer to a value to be passed to the window through the CREATESTRUCT structure + /// (lpCreateParams member) pointed to by the lParam param of the WM_CREATE message. + /// This message is sent to the created window by this function before it returns. + /// + /// If an application calls CreateWindow to create a MDI client window, lpParam should + /// point to a CLIENTCREATESTRUCT structure.If an MDI client window calls CreateWindow + /// to create an MDI child window, lpParam should point to a MDICREATESTRUCT structure. + /// lpParam may be NULL if no additional data is needed. + /// + /// + /// If the function succeeds, the return value is a handle to the new window. + /// If the function fails, the return value is NULL.To get extended error information, call GetLastError. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createwindowexw + /// https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Interop/Windows/User32/Interop.CreateWindowEx.cs + /// + [LibraryImport(Libraries.User32, StringMarshalling = StringMarshalling.Utf16, SetLastError = true)] + internal static partial HWND CreateWindowExW( + WINDOW_EX_STYLE dwExStyle, + LPCWSTR lpClassName, + LPCWSTR lpWindowName, + WINDOW_STYLE dwStyle, + int x, + int y, + int nWidth, + int nHeight, + HWND hWndParent, + HMENU hMenu, + HINSTANCE hInstance, + LPVOID lpParam); +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs new file mode 100644 index 0000000..570f1f2 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs @@ -0,0 +1,28 @@ +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Calls the default window procedure to provide default processing for any window messages that an application does not process. + /// + /// A handle to the window procedure that received the message. + /// The message. + /// wParam - Additional message information. The content of this parameter depends on the value of the Msg parameter. + /// lParam - Additional message information. The content of this parameter depends on the value of the Msg parameter. + /// + /// The return value is the result of the message processing and depends on the message. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-defwindowprocw + /// https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Interop/Windows/User32/Interop.DefWindowProc.cs + /// + [LibraryImport(Libraries.User32)] + internal static partial LRESULT DefWindowProcW( + HWND hWnd, + MESSAGE_TYPE uMsg, + WPARAM wParam, + LPARAM lParam); +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs new file mode 100644 index 0000000..66089df --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs @@ -0,0 +1,23 @@ +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Dispatches a message to a window procedure. It is typically used to dispatch a message retrieved by the GetMessage function. + /// + /// A pointer to a structure that contains the message. + /// + /// The return value specifies the value returned by the window procedure. + /// Although its meaning depends on the message being dispatched, the return value generally is ignored. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-dispatchmessage + /// https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Interop/Windows/User32/Interop.DispatchMessage.cs + /// + [LibraryImport(Libraries.User32)] + internal static partial LRESULT DispatchMessageW( + MSG lpmsg); +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs new file mode 100644 index 0000000..d78fca4 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs @@ -0,0 +1,33 @@ +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Retrieves a message from the calling thread's message queue. + /// The function dispatches incoming sent messages until a posted message is available for retrieval. + /// + /// A pointer to an MSG structure that receives message information from the thread's message queue. + /// A handle to the window whose messages are to be retrieved. The window must belong to the current thread. + /// The integer value of the lowest message value to be retrieved. + /// The integer value of the highest message value to be retrieved. + /// + /// If the function retrieves a message other than WM_QUIT, the return value is nonzero. + /// If the function retrieves the WM_QUIT message, the return value is zero. + /// If there is an error, the return value is -1. + /// For example, the function fails if hWnd is an invalid window handle or lpMsg is an invalid pointer. + /// To get extended error information, call GetLastError. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getmessage + /// https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Interop/Windows/User32/Interop.GetMessage.cs + /// + [LibraryImport(Libraries.User32)] + internal static partial BOOL GetMessageW( + LPMSG lpMsg, + HWND hWnd, + UINT wMsgFilterMin, + UINT wMsgFilterMax); +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs new file mode 100644 index 0000000..7669955 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs @@ -0,0 +1,48 @@ +using System.Runtime.InteropServices; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getmessagew + /// + internal readonly struct LPMSG + { + public static readonly LPMSG Null = new(IntPtr.Zero); + + public readonly IntPtr Value; + + public LPMSG(IntPtr value) + { + this.Value = value; + } + + public LPMSG(MSG value) + { + this.Value = LPMSG.ToPtr(value); + } + + public MSG ToStructure() + { + return Marshal.PtrToStructure(this.Value); + } + + private static IntPtr ToPtr(MSG value) + { + var ptr = Marshal.AllocHGlobal(MSG.Size); + Marshal.StructureToPtr(value, ptr, false); + return ptr; + } + + public void Free() + { + Marshal.FreeHGlobal(this.Value); + } + + public override string ToString() + { + return $"{this.GetType().Name}({this.Value})"; + } + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs new file mode 100644 index 0000000..e6ea00a --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs @@ -0,0 +1,829 @@ +using System.Diagnostics.CodeAnalysis; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// See https://github.com/dotnet/pinvoke/blob/main/src/User32/User32+WindowMessage.cs + /// + [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Names and values taken from Win32Api")] + [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "Names and values taken from Win32Api")] + [SuppressMessage("SA1124", "SA1124:DoNotUseRegions", Justification = "Allow rule here")] + [SuppressMessage("SA1512", "SA1512:SingleLineCommentsMustNotBeFollowedByBlankLine", Justification = "Allow rule here")] + [SuppressMessage("SA1515", "SA1515:SingleLineCommentMustBePrecededByBlankLine\r\n", Justification = "Allow rule here")] + internal enum MESSAGE_TYPE : uint + { + WM_USER = 0x0400d, + + #region Learn / Windows / Apps / Win32 / Desktop Technologies / Accessibility / Windows Accessibility features + // see https://learn.microsoft.com/en-us/windows/win32/winauto/about-windows-accessibility-features + + #region Windows Accessibility API Reference / Microsoft Active Accessibility / C/C++ Reference Active Accessibility User Interfaces Services / WM_GETOBJECT Window Message + // see https://learn.microsoft.com/en-us/windows/win32/winauto/wm-getobject + + /// + /// Sent by both Microsoft Active Accessibility and Microsoft UI Automation + /// to obtain information about an accessible object contained in a server application. + /// + WM_GETOBJECT = 0x003d, + + #endregion + + #endregion + + #region Learn / Windows / Apps / Win32 / Desktop Technologies / Desktop App User Interface / Dialog Boxes + // see https://learn.microsoft.com/en-us/windows/win32/dlgbox/dialog-boxes + + #region Dialog Box Reference / Dialog Box Notifications + // see https://learn.microsoft.com/en-us/windows/win32/dlgbox/dialog-box-notifications + + /// + /// Sent to a dialog box before the system draws the dialog box. + /// By responding to this message, the dialog box can set its text + /// and background colors using the specified display device context handle. + /// + WM_CTLCOLORDLG = 0x0136, + + /// + /// Sent to the owner window of a modal dialog box or menu that is entering an idle state. + /// A modal dialog box or menu enters an idle state when no messages are waiting in its + /// queue after it has processed one or more previous messages. + /// + WM_ENTERIDLE = 0x0121, + + /// + /// Sent to the window procedure associated with a control. By default, the system handles + /// all keyboard input to the control; the system interprets certain types of keyboard + /// input as dialog box navigation keys. To override this default behavior, the control + /// can respond to the WM_GETDLGCODE message to indicate the types of input it wants to + /// process itself. + /// + WM_GETDLGCODE = 0x0087, + + /// + /// Sent to the dialog box procedure immediately before a dialog box is displayed. + /// Dialog box procedures typically use this message to initialize controls and carry + /// out any other initialization tasks that affect the appearance of the dialog box. + /// + WM_INITDIALOG = 0x0110, + + /// + /// Sent to a dialog box procedure to set the keyboard focus to a different control + /// in the dialog box. + /// + WM_NEXTDLGCTL = 0x0028, + + #endregion + + #endregion + + #region Learn / Windows / Apps / Win32 / Desktop Technologies / Desktop App User Interface / User Interaction / Legacy / Keyboard and Mouse Input + // see https://learn.microsoft.com/en-us/windows/win32/inputdev/user-input + + #region Keyboard Input / Keyboard Input Reference / Keyboard Input Notifications + // see https://learn.microsoft.com/en-us/windows/win32/inputdev/keyboard-input-notifications + + /// + /// Sent to both the window being activated and the window being deactivated. If the windows + /// use the same input queue, the message is sent synchronously, first to the window procedure + /// of the top-level window being deactivated, then to the window procedure of the top-level + /// window being activated. If the windows use different input queues, the message is sent + /// asynchronously, so the window is activated immediately. + /// + WM_ACTIVATE = 0x0006, + + /// + /// Notifies a window that the user generated an application command event, for example, by + /// clicking an application command button using the mouse or typing an application command + /// key on the keyboard. + /// + WM_APPCOMMAND = 0x0319, + + /// + /// Posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by + /// the TranslateMessage function. The WM_CHAR message contains the character code of the + /// key that was pressed. + /// + WM_CHAR = 0x0102, + + /// + /// Posted to the window with the keyboard focus when a WM_KEYUP message is translated by + /// the TranslateMessage function. WM_DEADCHAR specifies a character code generated by a + /// dead key. A dead key is a key that generates a character, such as the umlaut (double-dot), + /// that is combined with another character to form a composite character. For example, the + /// umlaut-O character ( ) is generated by typing the dead key for the umlaut character, + /// and then typing the O key. + /// + WM_DEADCHAR = 0x0103, + + /// + /// Posted when the user presses a hot key registered by the RegisterHotKey function. + /// The message is placed at the top of the message queue associated with the thread + /// that registered the hot key. + /// + WM_HOTKEY = 0x0312, + + /// + /// Posted to the window with the keyboard focus when a nonsystem key is pressed. + /// A nonsystem key is a key that is pressed when the ALT key is not pressed. + /// + WM_KEYDOWN = 0x0100, + + /// + /// Posted to the window with the keyboard focus when a nonsystem key is released. + /// A nonsystem key is a key that is pressed when the ALT key is not pressed, or a + /// keyboard key that is pressed when a window has the keyboard focus. + /// + WM_KEYUP = 0x0101, + + /// + /// Sent to a window immediately before it loses the keyboard focus. + /// + WM_KILLFOCUS = 0x0008, + + /// + /// Sent to a window after it has gained the keyboard focus. + /// + WM_SETFOCUS = 0x0007, + + /// + /// Sent to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated + /// by the TranslateMessage function. WM_SYSDEADCHAR specifies the character code of a + /// system dead key that is, a dead key that is pressed while holding down the ALT key. + /// + WM_SYSDEADCHAR = 0x0107, + + /// + /// Posted to the window with the keyboard focus when the user presses the F10 key (which + /// activates the menu bar) or holds down the ALT key and then presses another key. It + /// also occurs when no window currently has the keyboard focus; in this case, the + /// WM_SYSKEYDOWN message is sent to the active window. The window that receives the + /// message can distinguish between these two contexts by checking the context code in the + /// lParam parameter. + /// + WM_SYSKEYDOWN = 0x104, + + /// + /// Posted to the window with the keyboard focus when the user releases a key that was + /// pressed while the ALT key was held down. It also occurs when no window currently has + /// the keyboard focus; in this case, the WM_SYSKEYUP message is sent to the active window. + /// The window that receives the message can distinguish between these two contexts by + /// checking the context code in the lParam parameter. + /// + WM_SYSKEYUP = 0x0105, + + /// + /// The WM_UNICHAR message can be used by an application to post input to other windows. + /// This message contains the character code of the key that was pressed. (Test whether + /// a target app can process WM_UNICHAR messages by sending the message with wParam set + /// to UNICODE_NOCHAR.) + /// + WM_UNICHAR = 0x0109, + + #endregion + + #region Mouse Input / Mouse Input Reference / Mouse Input Notifications + // see https://learn.microsoft.com/en-us/windows/win32/inputdev/mouse-input-notifications + + /// + /// Sent to the window that is losing the mouse capture. + /// + WM_CAPTURECHANGED = 0x0215, + + /// + /// Posted when the user double-clicks the left mouse button while the cursor is in the + /// client area of a window. If the mouse is not captured, the message is posted to the + /// window beneath the cursor. Otherwise, the message is posted to the window that has + /// captured the mouse. + /// + WM_LBUTTONDBLCLK = 0x0203, + + /// + /// Posted when the user presses the left mouse button while the cursor is in the client + /// area of a window. If the mouse is not captured, the message is posted to the window + /// beneath the cursor. Otherwise, the message is posted to the window that has captured + /// the mouse. + /// + WM_LBUTTONDOWN = 0x0201, + + /// + /// Posted when the user releases the left mouse button while the cursor is in the client + /// area of a window. If the mouse is not captured, the message is posted to the window + /// beneath the cursor. Otherwise, the message is posted to the window that has captured + /// the mouse. + /// + WM_LBUTTONUP = 0x0202, + + /// + /// Posted when the user double-clicks the middle mouse button while the cursor is in the + /// client area of a window. If the mouse is not captured, the message is posted to the + /// window beneath the cursor. Otherwise, the message is posted to the window that has + /// captured the mouse. + /// + WM_MBUTTONDBLCLK = 0x0209, + + /// + /// Posted when the user presses the middle mouse button while the cursor is in the client + /// area of a window. If the mouse is not captured, the message is posted to the window + /// beneath the cursor. Otherwise, the message is posted to the window that has captured + /// the mouse. + /// + WM_MBUTTONDOWN = 0x0207, + + /// + /// Posted when the user releases the middle mouse button while the cursor is in the client + /// area of a window. If the mouse is not captured, the message is posted to the window + /// beneath the cursor. Otherwise, the message is posted to the window that has captured + /// the mouse. + /// + WM_MBUTTONUP = 0x0208, + + /// + /// Sent when the cursor is in an inactive window and the user presses a mouse button. The + /// parent window receives this message only if the child window passes it to the + /// DefWindowProc function. + /// + WM_MOUSEACTIVATE = 0x0021, + + /// + /// Posted to a window when the cursor hovers over the client area of the window for the + /// period of time specified in a prior call to TrackMouseEvent. + /// + WM_MOUSEHOVER = 0x02A1, + + /// + /// Sent to the active window when the mouse's horizontal scroll wheel is tilted or rotated. + /// The DefWindowProc function propagates the message to the window's parent. There should + /// be no internal forwarding of the message, since DefWindowProc propagates it up the + /// parent chain until it finds a window that processes it. + /// + WM_MOUSEHWHEEL = 0x020E, + + /// + /// Posted to a window when the cursor leaves the client area of the window specified + /// in a prior call to TrackMouseEvent. + /// + WM_MOUSELEAVE = 0x02A3, + + /// + /// Posted to a window when the cursor moves. If the mouse is not captured, the message is + /// posted to the window that contains the cursor. Otherwise, the message is posted to the + /// window that has captured the mouse. + /// + WM_MOUSEMOVE = 0x0200, + + /// + /// Sent to the focus window when the mouse wheel is rotated. The DefWindowProc function + /// propagates the message to the window's parent. There should be no internal forwarding + /// of the message, since DefWindowProc propagates it up the parent chain until it finds + /// a window that processes it. + /// + WM_MOUSEWHEEL = 0x020A, + + /// + /// Sent to a window in order to determine what part of the window corresponds to a particular + /// screen coordinate. This can happen, for example, when the cursor moves, when a mouse + /// button is pressed or released, or in response to a call to a function such as WindowFromPoint. + /// If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, + /// the message is sent to the window that has captured the mouse. + /// + WM_NCHITTEST = 0x0084, + + /// + /// Posted when the user double-clicks the left mouse button while the cursor is within the + /// nonclient area of a window. This message is posted to the window that contains the cursor. + /// If a window has captured the mouse, this message is not posted. + /// + WM_NCLBUTTONDBLCLK = 0x00A3, + + /// + /// Posted when the user presses the left mouse button while the cursor is within the nonclient + /// area of a window. This message is posted to the window that contains the cursor. If a window + /// has captured the mouse, this message is not posted. + /// + WM_NCLBUTTONDOWN = 0x00A1, + + /// + /// Posted when the user releases the left mouse button while the cursor is within the nonclient + /// area of a window. This message is posted to the window that contains the cursor. If a window + /// has captured the mouse, this message is not posted. + /// + WM_NCLBUTTONUP = 0x00A2, + + /// + /// Posted when the user double-clicks the middle mouse button while the cursor is within the + /// nonclient area of a window. This message is posted to the window that contains the cursor. + /// If a window has captured the mouse, this message is not posted. + /// + WM_NCMBUTTONDBLCLK = 0x00A9, + + /// + /// Posted when the user presses the middle mouse button while the cursor is within the nonclient + /// area of a window. This message is posted to the window that contains the cursor. If a window + /// has captured the mouse, this message is not posted. + /// + WM_NCMBUTTONDOWN = 0x00A7, + + /// + /// Posted when the user releases the middle mouse button while the cursor is within the nonclient + /// area of a window. This message is posted to the window that contains the cursor. If a window + /// has captured the mouse, this message is not posted. + /// + WM_NCMBUTTONUP = 0x00A8, + + /// + /// Posted to a window when the cursor hovers over the nonclient area of the window for the period + /// of time specified in a prior call to TrackMouseEvent. + /// + WM_NCMOUSEHOVER = 0x02A0, + + /// + /// Posted to a window when the cursor leaves the nonclient area of the window specified in a prior + /// call to TrackMouseEvent. + /// + WM_NCMOUSELEAVE = 0x2a2, + + /// + /// Posted to a window when the cursor is moved within the nonclient area of the window. This message + /// is posted to the window that contains the cursor. If a window has captured the mouse, this message + /// is not posted. + /// + WM_NCMOUSEMOVE = 0x00a0, + + /// + /// Posted when the user double-clicks the right mouse button while the cursor is within the nonclient + /// area of a window. This message is posted to the window that contains the cursor. If a window has + /// captured the mouse, this message is not posted. + /// + WM_NCRBUTTONDBLCLK = 0x00A6, + + /// + /// Posted when the user presses the right mouse button while the cursor is within the nonclient area + /// of a window. This message is posted to the window that contains the cursor. If a window has + /// captured the mouse, this message is not posted. + /// + WM_NCRBUTTONDOWN = 0x00A4, + + /// + /// Posted when the user releases the right mouse button while the cursor is within the nonclient + /// area of a window. This message is posted to the window that contains the cursor. If a window + /// has captured the mouse, this message is not posted. + /// + WM_NCRBUTTONUP = 0x00A5, + + /// + /// Posted when the user double-clicks the first or second X button while the cursor is in the + /// nonclient area of a window. This message is posted to the window that contains the cursor. + /// If a window has captured the mouse, this message is not posted. + /// + WM_NCXBUTTONDBLCLK = 0x00AD, + + /// + /// Posted when the user presses the first or second X button while the cursor is in the nonclient + /// area of a window. This message is posted to the window that contains the cursor. If a window + /// has captured the mouse, this message is not posted. + /// + WM_NCXBUTTONDOWN = 0x00AB, + + /// + /// Posted when the user releases the first or second X button while the cursor is in the nonclient + /// area of a window. This message is posted to the window that contains the cursor. If a window + /// has captured the mouse, this message is not posted. + /// + WM_NCXBUTTONUP = 0x00AC, + + /// + /// Posted when the user double-clicks the right mouse button while the cursor is in the client + /// area of a window. If the mouse is not captured, the message is posted to the window beneath + /// the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + WM_RBUTTONDBLCLK = 0x0206, + + /// + /// Posted when the user presses the right mouse button while the cursor is in the client area + /// of a window. If the mouse is not captured, the message is posted to the window beneath the + /// cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + WM_RBUTTONDOWN = 0x0204, + + /// + /// Posted when the user releases the right mouse button while the cursor is in the client + /// area of a window. If the mouse is not captured, the message is posted to the window beneath + /// the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + WM_RBUTTONUP = 0x0205, + + /// + /// Posted when the user double-clicks the first or second X button while the cursor is in the + /// client area of a window. If the mouse is not captured, the message is posted to the window + /// beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + WM_XBUTTONDBLCLK = 0x020D, + + /// + /// Posted when the user presses the first or second X button while the cursor is in the client + /// area of a window. If the mouse is not captured, the message is posted to the window beneath + /// the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + WM_XBUTTONDOWN = 0x020B, + + /// + /// Posted when the user releases the first or second X button while the cursor is in the client + /// area of a window. If the mouse is not captured, the message is posted to the window beneath + /// the cursor. Otherwise, the message is posted to the window that has captured the mouse. + /// + WM_XBUTTONUP = 0x020C, + + #endregion + + #endregion + + #region Learn / Windows / Apps / Win32 / Desktop Technologies / Desktop App User Interface / Internationalization + // see https://learn.microsoft.com/en-us/windows/win32/intl/international-support + + #region Input Method Manager / Input Method Manager Reference / Input Method Manager Messages + // see https://learn.microsoft.com/en-us/windows/win32/intl/input-method-manager-messages + + /// + /// Sent to an application to notify it of changes to the IME window. + /// + WM_IME_NOTIFY = 0x0282, + + /// + /// Sent to an application when a window is activated. + /// + WM_IME_SETCONTEXT = 0x281, + + #endregion + + #endregion + + #region Learn / Windows / Apps / Win32 / Desktop Technologies / Desktop App User Interface / Menus and Other Resources + // see https://learn.microsoft.com/en-us/windows/win32/menurc/resources + + #region Cursors / Cursor Reference / Cursor Notifications + // see https://learn.microsoft.com/en-us/windows/win32/menurc/cursor-notifications + + /// + /// Sent to a window if the mouse causes the cursor to move within + /// a window and mouse input is not captured. + /// + WM_SETCURSOR = 0x0020, + + #endregion + + #region Keyboard Accelerators / Keyboard Accelerator Reference / Keyboard Accelerator Notifications + // see https://learn.microsoft.com/en-us/windows/win32/menurc/keyboard-accelerator-notifications + + /// + /// Sent when a drop-down menu or submenu is about to become active. + /// This allows an application to modify the menu before it is displayed, without changing the entire menu. + /// + WM_INITMENUPOPUP = 0x0117, + + /// + /// Sent when a menu is active and the user presses a key that does not correspond to any + /// mnemonic or accelerator key. This message is sent to the window that owns the menu. + /// + WM_MENUCHAR = 0x0120, + + /// + /// Sent to a menu's owner window when the user selects a menu item. + /// + WM_MENUSELECT = 0x011F, + + /// + /// Posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by + /// the TranslateMessage function. It specifies the character code of a system character key + /// that is, a character key that is pressed while the ALT key is down. + /// + WM_SYSCHAR = 0x0106, + + /// + /// A window receives this message when the user chooses a command from the Window menu + /// (formerly known as the system or control menu) or when the user chooses the maximize + /// button, minimize button, restore button, or close button. + /// + WM_SYSCOMMAND = 0x0112, + + #endregion + + #endregion + + #region Learn / Windows / Apps / Win32 / Desktop Technologies / Desktop App User Interface / Windows and Messages + // see https://learn.microsoft.com/en-us/windows/win32/winmsg/windowing + + #region Windows / Window Reference / Window Messages + // see https://learn.microsoft.com/en-us/windows/win32/winmsg/window-messages + + /// + /// Retrieves the menu handle for the current window. + /// + MN_GETHMENU = 0x01E1, + + /// + /// Sent when the window background must be erased (for example, when a window is resized). + /// The message is sent to prepare an invalidated portion of a window for painting. + /// + WM_ERASEBKGND = 0x0014, + + /// + /// Retrieves the font with which the control is currently drawing its text. + /// + WM_GETFONT = 0x0031, + + /// + /// Copies the text that corresponds to a window into a buffer provided by the caller. + /// + WM_GETTEXT = 0x000D, + + /// + /// Determines the length, in characters, of the text associated with a window. + /// + WM_GETTEXTLENGTH = 0x000E, + + /// + /// Sets the font that a control is to use when drawing text. + /// + WM_SETFONT = 0x0030, + + /// + /// Associates a new large or small icon with a window. + /// The system displays the large icon in the ALT+TAB dialog box, + /// and the small icon in the window caption. + /// + WM_SETICON = 0x0080, + + /// + /// Sets the text of a window. + /// + WM_SETTEXT = 0x000C, + + #endregion + + #region Windows / Window Reference / Window Notifications + // see https://learn.microsoft.com/en-us/windows/win32/winmsg/window-notifications + + /// + /// Sent when a window belonging to a different application than the active window is + /// about to be activated. The message is sent to the application whose window is being + /// activated and to the application whose window is being deactivated. + /// + WM_ACTIVATEAPP = 0x001C, + + /// + /// Sent to cancel certain modes, such as mouse capture. For example, the system sends this + /// message to the active window when a dialog box or message box is displayed. Certain functions + /// also send this message explicitly to the specified window regardless of whether it is the + /// active window. For example, the EnableWindow function sends this message when disabling the + /// specified window. + /// + WM_CANCELMODE = 0x001F, + + /// + /// Sent to a child window when the user clicks the window's title bar or when the window + /// is activated, moved, or sized. + /// + WM_CHILDACTIVATE = 0x0022, + + /// + /// Sent as a signal that a window or an application should terminate. + /// + WM_CLOSE = 0x0010, + + /// + /// Sent to all top-level windows when the system detects more than 12.5 percent of system + /// time over a 30- to 60-second interval is being spent compacting memory. This indicates + /// that system memory is low. + /// + WM_COMPACTING = 0x0041, + + /// + /// Sent when an application requests that a window be created by calling the CreateWindowEx + /// or CreateWindow function. (The message is sent before the function returns.) The window + /// procedure of the new window receives this message after the window is created, but before + /// the window becomes visible. + /// + WM_CREATE = 0x0001, + + /// + /// Sent when a window is being destroyed. It is sent to the window procedure of the window + /// being destroyed after the window is removed from the screen. + /// + /// This message is sent first to the window being destroyed and then to the child windows + /// (if any) as they are destroyed.During the processing of the message, it can be assumed + /// that all child windows still exist. + /// + WM_DESTROY = 0x0002, + + /// + /// Sent when an application changes the enabled state of a window. It is sent to the window + /// whose enabled state is changing. This message is sent before the EnableWindow function + /// returns, but after the enabled state (WS_DISABLED style bit) of the window has changed. + /// + WM_ENABLE = 0x000A, + + /// + /// Sent one time to a window after it enters the moving or sizing modal loop. The window + /// enters the moving or sizing modal loop when the user clicks the window's title bar or + /// sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc + /// function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. + /// The operation is complete when DefWindowProc returns. + /// + /// The system sends the WM_ENTERSIZEMOVE message regardless of whether the dragging of + /// full windows is enabled. + /// + WM_ENTERSIZEMOVE = 0x0231, + + /// + /// Sent one time to a window, after it has exited the moving or sizing modal loop. The + /// window enters the moving or sizing modal loop when the user clicks the window's title + /// bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the + /// DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE + /// or SC_SIZE value. The operation is complete when DefWindowProc returns. + /// + WM_EXITSIZEMOVE = 0x0232, + + /// + /// Sent to a window to retrieve a handle to the large or small icon associated with a + /// window. The system displays the large icon in the ALT+TAB dialog, and the small + /// icon in the window caption. + /// + WM_GETICON = 0x007F, + + /// + /// Sent to a window when the size or position of the window is about to change. An + /// application can use this message to override the window's default maximized size + /// and position, or its default minimum or maximum tracking size. + /// + WM_GETMINMAXINFO = 0x0024, + + /// + /// Sent to the topmost affected window after an application's input language has been + /// changed. You should make any application-specific settings and pass the message to + /// the DefWindowProc function, which passes the message to all first-level child windows. + /// These child windows can pass the message to DefWindowProc to have it pass the message + /// to their child windows, and so on. + /// + WM_INPUTLANGCHANGE = 0x0051, + + /// + /// Posted to the window with the focus when the user chooses a new input language, either + /// with the hotkey (specified in the Keyboard control panel application) or from the + /// indicator on the system taskbar. An application can accept the change by passing the + /// message to the DefWindowProc function or reject the change (and prevent it from taking + /// place) by returning immediately. + /// + WM_INPUTLANGCHANGEREQUEST = 0x0050, + + /// + /// Sent after a window has been moved. + /// + WM_MOVE = 0x0003, + + /// + /// Sent to a window that the user is moving. By processing this message, an application + /// can monitor the position of the drag rectangle and, if needed, change its position. + /// + WM_MOVING = 0x0216, + + /// + /// Sent to a window when its nonclient area needs to be changed to indicate an active + /// or inactive state. + /// + WM_NCACTIVATE = 0x0086, + + /// + /// Sent when the size and position of a window's client area must be calculated. By + /// processing this message, an application can control the content of the window's + /// client area when the size or position of the window changes. + /// + WM_NCCALCSIZE = 0x0083, + + /// + /// Sent prior to the WM_CREATE message when a window is first created. + /// + WM_NCCREATE = 0x0081, + + /// + /// Notifies a window that its nonclient area is being destroyed. The DestroyWindow + /// function sends the WM_NCDESTROY message to the window following the WM_DESTROY + /// message.WM_DESTROY is used to free the allocated memory object associated with + /// the window. + /// + /// The WM_NCDESTROY message is sent after the child windows have been destroyed. + /// In contrast, WM_DESTROY is sent before the child windows are destroyed. + /// + WM_NCDESTROY = 0x0082, + + /// + /// Performs no operation. An application sends the WM_NULL message if it wants to + /// post a message that the recipient window will ignore. + /// + WM_NULL = 0x0000, + + /// + /// Sent to a minimized (iconic) window. The window is about to be dragged by the + /// user but does not have an icon defined for its class. An application can return + /// a handle to an icon or cursor. The system displays this cursor or icon while + /// the user drags the icon. + /// + WM_QUERYDRAGICON = 0x0037, + + /// + /// Sent to an icon when the user requests that the window be restored to its + /// previous size and position. + /// + WM_QUERYOPEN = 0x0013, + + /// + /// Indicates a request to terminate an application, and is generated when the + /// application calls the PostQuitMessage function. This message causes the + /// GetMessage function to return zero. + /// + WM_QUIT = 0x0012, + + /// + /// Sent to a window when the window is about to be hidden or shown. + /// + WM_SHOWWINDOW = 0x0018, + + /// + /// Sent to a window after its size has changed. + /// + WM_SIZE = 0x0005, + + /// + /// Sent to a window that the user is resizing. By processing this message, an + /// application can monitor the size and position of the drag rectangle and, if + /// needed, change its size or position. + /// + WM_SIZING = 0x0214, + + /// + /// Sent to a window after the SetWindowLong function has changed one or more + /// of the window's styles. + /// + WM_STYLECHANGED = 0x007D, + + /// + /// Sent to a window when the SetWindowLong function is about to change one or + /// more of the window's styles. + /// + WM_STYLECHANGING = 0x007C, + + /// + /// Broadcast to every window following a theme change event. Examples of theme + /// change events are the activation of a theme, the deactivation of a theme, or + /// a transition from one theme to another. + /// + WM_THEMECHANGED = 0x031A, + + /// + /// Sent to all windows after the user has logged on or off. When the user logs on + /// or off, the system updates the user-specific settings. The system sends this + /// message immediately after updating the settings. + /// + WM_USERCHANGED = 0x0054, + + /// + /// Sent to a window whose size, position, or place in the Z order has changed as a + /// result of a call to the SetWindowPos function or another window-management function. + /// + WM_WINDOWPOSCHANGED = 0x0047, + + /// + /// Sent to a window whose size, position, or place in the Z order is about to change + /// as a result of a call to the SetWindowPos function or another window-management function. + /// + WM_WINDOWPOSCHANGING = 0x0046, + + #endregion + + #endregion + + #region Learn / Windows / Apps / Win32 / Desktop Technologies / Graphics and Gaming / Windows GDI + // see https://learn.microsoft.com/en-us/windows/win32/gdi/windows-gdi + + #region Painting and Drawing / Painting and Drawing Reference / Painting and Drawing Messages + // see https://learn.microsoft.com/en-us/windows/win32/gdi/painting-and-drawing-messages + + /// + /// The WM_NCPAINT message is sent to a window when its frame must be painted. + /// + WM_NCPAINT = 0x0085, + + /// + /// The WM_PAINT message is sent when the system or another application makes a request + /// to paint a portion of an application's window. The message is sent when the UpdateWindow + /// or RedrawWindow function is called, or by the DispatchMessage function when the + /// application obtains a WM_PAINT message by using the GetMessage or PeekMessage function. + /// + WM_PAINT = 0x000f, + + #endregion + + #endregion + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs new file mode 100644 index 0000000..55149e6 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs @@ -0,0 +1,49 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Contains message information from a thread's message queue. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-msg + /// https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Interop/Windows/User32/Interop.MSG.cs + /// + [SuppressMessage("SA1307", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "Names match Win32 api")] + [StructLayout(LayoutKind.Sequential)] + internal readonly struct MSG + { + public readonly HWND hwnd; + public readonly MESSAGE_TYPE message; + public readonly WPARAM wParam; + public readonly LPARAM lParam; + public readonly DWORD time; + public readonly POINT pt; + public readonly DWORD lPrivate; + + public MSG( + HWND hwnd, + MESSAGE_TYPE message, + WPARAM wParam, + LPARAM lParam, + DWORD time, + POINT pt, + DWORD lPrivate) + { + this.hwnd = hwnd; + this.message = message; + this.wParam = wParam; + this.lParam = lParam; + this.time = time; + this.pt = pt; + this.lPrivate = lPrivate; + } + + public static int Size => + Marshal.SizeOf(typeof(MSG)); + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs new file mode 100644 index 0000000..41abf86 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs @@ -0,0 +1,36 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Places (posts) a message in the message queue associated with the thread that created the + /// specified window and returns without waiting for the thread to process the message. + /// + /// To post a message in the message queue associated with a thread, use the PostThreadMessage function. + /// + /// A handle to the window whose window procedure is to receive the message. + /// The message to be posted. + /// wParam - Additional message-specific information. + /// lParam - Additional message-specific information. + /// + /// If the function succeeds, the return value is nonzero. + /// If the function fails, the return value is zero. + /// To get extended error information, call GetLastError. + /// GetLastError returns ERROR_NOT_ENOUGH_QUOTA when the limit is hit. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-postmessagew + /// https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Interop/Windows/User32/Interop.PostMessage.cs + /// + [LibraryImport(Libraries.User32, StringMarshalling = StringMarshalling.Utf16)] + internal static partial BOOL PostMessageW( + HWND hWnd, + [SuppressMessage("SA1313", "SA1313:ParameterNamesMustBeginWithLowerCaseLetter", Justification = "Parameter name matches Win32 api")] + MESSAGE_TYPE Msg, + WPARAM wParam, + LPARAM lParam); +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs new file mode 100644 index 0000000..282f979 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs @@ -0,0 +1,31 @@ +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Posts a message to the message queue of the specified thread. It returns without waiting for the thread to process the message. + /// + /// The identifier of the thread to which the message is to be posted. + /// The type of message to be posted. + /// wParam - Additional message-specific information. + /// lParam - Additional message-specific information. + /// + /// If the function succeeds, the return value is nonzero. + /// If the function fails, the return value is zero. + /// To get extended error information, call GetLastError.GetLastError returns ERROR_INVALID_THREAD_ID + /// if idThread is not a valid thread identifier, or if the thread specified by idThread does not have + /// a message queue.GetLastError returns ERROR_NOT_ENOUGH_QUOTA when the message limit is hit. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-postmessagew + /// + [LibraryImport(Libraries.User32, StringMarshalling = StringMarshalling.Utf16, SetLastError = true)] + internal static partial BOOL PostThreadMessageW( + DWORD idThread, + MESSAGE_TYPE Msg, + WPARAM wParam, + LPARAM lParam); +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs new file mode 100644 index 0000000..17dd81f --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs @@ -0,0 +1,28 @@ +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function. + /// + /// + /// A pointer to a WNDCLASSEX structure. + /// You must fill the structure with the appropriate class attributes before passing it to the function. + /// + /// + /// If the function succeeds, the return value is a class atom that uniquely identifies the class being registered. + /// This atom can only be used by the CreateWindow, CreateWindowEx, GetClassInfo, GetClassInfoEx, FindWindow, + /// FindWindowEx, and UnregisterClass functions and the IActiveIMMap::FilterClientWindows method. + /// If the function fails, the return value is zero. + /// To get extended error information, call GetLastError. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerclassexw + /// + [DllImport(Libraries.User32, CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern ATOM RegisterClassExW( + WNDCLASSEXW unnamedParam1); +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs new file mode 100644 index 0000000..107f194 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs @@ -0,0 +1,23 @@ +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Translates virtual-key messages into character messages. + /// + /// + /// If the message is translated (that is, a character message is posted to the thread's message queue), the return value is nonzero. + /// If the message is WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, or WM_SYSKEYUP, the return value is nonzero, regardless of the translation. + /// If the message is not translated (that is, a character message is not posted to the thread's message queue), the return value is zero. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-translatemessage + /// https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Interop/Windows/User32/Interop.TranslateMessage.cs + /// + [LibraryImport(Libraries.User32)] + internal static partial BOOL TranslateMessage( + MSG lpMsg); +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs new file mode 100644 index 0000000..a435803 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs @@ -0,0 +1,52 @@ +using System.Diagnostics.CodeAnalysis; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Extended window styles. + /// + /// + /// https://learn.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles + /// + [Flags] + [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Names and values taken from Win32Api")] + [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "Names and values taken from Win32Api")] + [SuppressMessage("CA1069", "CA1069:EnumsShouldNotHaveDuplicateValues", Justification = "Values match Win32 api")] + internal enum WINDOW_EX_STYLE : uint + { + WS_EX_ACCEPTFILES = 0x00000010, + WS_EX_APPWINDOW = 0x00040000, + WS_EX_CLIENTEDGE = 0x00000200, + WS_EX_COMPOSITED = 0x02000000, + WS_EX_CONTEXTHELP = 0x00000400, + WS_EX_CONTROLPARENT = 0x00010000, + WS_EX_DLGMODALFRAME = 0x00000001, + WS_EX_LAYERED = 0x00080000, + WS_EX_LAYOUTRTL = 0x00400000, + WS_EX_LEFT = 0x00000000, + WS_EX_LEFTSCROLLBAR = 0x00004000, + WS_EX_LTRREADING = 0x00000000, + WS_EX_MDICHILD = 0x00000040, + WS_EX_NOACTIVATE = 0x08000000, + WS_EX_NOINHERITLAYOUT = 0x00100000, + WS_EX_NOPARENTNOTIFY = 0x00000004, + WS_EX_NOREDIRECTIONBITMAP = 0x00200000, + WS_EX_OVERLAPPEDWINDOW = + WINDOW_EX_STYLE.WS_EX_WINDOWEDGE | + WINDOW_EX_STYLE.WS_EX_CLIENTEDGE, + WS_EX_PALETTEWINDOW = + WINDOW_EX_STYLE.WS_EX_WINDOWEDGE | + WINDOW_EX_STYLE.WS_EX_TOOLWINDOW | + WINDOW_EX_STYLE.WS_EX_TOPMOST, + WS_EX_RIGHT = 0x00001000, + WS_EX_RIGHTSCROLLBAR = 0x00000000, + WS_EX_RTLREADING = 0x00002000, + WS_EX_STATICEDGE = 0x00020000, + WS_EX_TOOLWINDOW = 0x00000080, + WS_EX_TOPMOST = 0x00000008, + WS_EX_TRANSPARENT = 0x00000020, + WS_EX_WINDOWEDGE = 0x00000100, + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs new file mode 100644 index 0000000..837709b --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs @@ -0,0 +1,217 @@ +using System.Diagnostics.CodeAnalysis; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winmsg/window-styles + /// https://github.com/dotnet/pinvoke/blob/main/src/User32/User32+WindowStyles.cs + /// + [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Names and values taken from Win32Api")] + [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "Names and values taken from Win32Api")] + internal enum WINDOW_STYLE : uint + { + /// + /// The window has a thin-line border + /// + WS_BORDER = 0x00800000, + + /// + /// The window has a title bar (includes the WS_BORDER style). + /// + WS_CAPTION = 0x00C00000, + + /// + /// The window is a child window. + /// A window with this style cannot have a menu bar. + /// This style cannot be used with the WS_POPUP style. + /// + WS_CHILD = 0x40000000, + + /// + /// Same as the WS_CHILD style. + /// + [SuppressMessage("Naming", "CA1069", Justification = "Name and value taken from Win32Api")] + WS_CHILDWINDOW = 0x40000000, + + /// + /// Excludes the area occupied by child windows when drawing occurs within the + /// parent window. This style is used when creating the parent window. + /// + WS_CLIPCHILDREN = 0x02000000, + + /// + /// Clips child windows relative to each other; that is, when a particular child + /// window receives a WM_PAINT message, the WS_CLIPSIBLINGS style clips all other + /// overlapping child windows out of the region of the child window to be updated. + /// If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, + /// when drawing within the client area of a child window, to draw within the + /// client area of a neighboring child window. + /// + WS_CLIPSIBLINGS = 0x04000000, + + /// + /// The window is initially disabled. + /// A disabled window cannot receive input from the user. + /// To change this after a window has been created, use the EnableWindow function. + /// + WS_DISABLED = 0x08000000, + + /// + /// The window has a border of a style typically used with dialog boxes. + /// A window with this style cannot have a title bar. + /// + WS_DLGFRAME = 0x00400000, + + /// + /// The window is the first control of a group of controls. The group consists of this + /// first control and all controls defined after it, up to the next control with the + /// WS_GROUP style. The first control in each group usually has the WS_TABSTOP style + /// so that the user can move from group to group. The user can subsequently change the + /// keyboard focus from one control in the group to the next control in the group by + /// using the direction keys. + /// + /// You can turn this style on and off to change dialog box navigation. To change this + /// style after a window has been created, use the SetWindowLong function. + /// + WS_GROUP = 0x00020000, + + /// + /// The window has a horizontal scroll bar. + /// + WS_HSCROLL = 0x00100000, + + /// + /// The window is initially minimized. + /// Same as the WS_MINIMIZE style. + /// + WS_ICONIC = 0x20000000, + + /// + /// The window is initially maximized. + /// + WS_MAXIMIZE = 0x01000000, + + /// + /// The window has a maximize button. + /// Cannot be combined with the WS_EX_CONTEXTHELP style. + /// The WS_SYSMENU style must also be specified. + /// + WS_MAXIMIZEBOX = 0x00010000, + + /// + /// The window is initially minimized. + /// Same as the WS_ICONIC style. + /// + [SuppressMessage("Naming", "CA1069", Justification = "Name and value taken from Win32Api")] + WS_MINIMIZE = 0x20000000, + + /// + /// The window has a minimize button. + /// Cannot be combined with the WS_EX_CONTEXTHELP style. + /// The WS_SYSMENU style must also be specified. + /// + [SuppressMessage("Naming", "CA1069", Justification = "Name and value taken from Win32Api")] + WS_MINIMIZEBOX = 0x00020000, + + /// + /// The window is an overlapped window. + /// An overlapped window has a title bar and a border. + /// Same as the WS_TILED style. + /// + WS_OVERLAPPED = 0x00000000, + + /// + /// The window is an overlapped window. + /// Same as the WS_TILEDWINDOW style. + /// + WS_OVERLAPPEDWINDOW = + WINDOW_STYLE.WS_OVERLAPPED | + WINDOW_STYLE.WS_CAPTION | + WINDOW_STYLE.WS_SYSMENU | + WINDOW_STYLE.WS_THICKFRAME | + WINDOW_STYLE.WS_MINIMIZEBOX | + WINDOW_STYLE.WS_MAXIMIZEBOX, + + /// + /// The window is a pop-up window. + /// This style cannot be used with the WS_CHILD style. + /// + WS_POPUP = 0x80000000, + + /// + /// The window is a pop-up window. + /// The WS_CAPTION and WS_POPUPWINDOW styles must be combined + /// to make the window menu visible. + /// + WS_POPUPWINDOW = + WINDOW_STYLE.WS_POPUP | + WINDOW_STYLE.WS_BORDER | + WINDOW_STYLE.WS_SYSMENU, + + /// + /// The window has a sizing border. + /// Same as the WS_THICKFRAME style. + /// + WS_SIZEBOX = 0x00040000, + + /// + /// The window has a window menu on its title bar. + /// The WS_CAPTION style must also be specified. + /// + WS_SYSMENU = 0x00080000, + + /// + /// The window is a control that can receive the keyboard focus when the user + /// presses the TAB key. Pressing the TAB key changes the keyboard focus to the + /// next control with the WS_TABSTOP style. + /// + /// You can turn this style on and off to change dialog box navigation. To change + /// this style after a window has been created, use the SetWindowLong function. + /// For user-created windows and modeless dialogs to work with tab stops, alter + /// the message loop to call the IsDialogMessage function. + /// + [SuppressMessage("Naming", "CA1069", Justification = "Name and value taken from Win32Api")] + WS_TABSTOP = 0x00010000, + + /// + /// The window has a sizing border. + /// Same as the WS_SIZEBOX style. + /// + [SuppressMessage("Naming", "CA1069", Justification = "Name and value taken from Win32Api")] + WS_THICKFRAME = 0x00040000, + + /// + /// The window is an overlapped window. + /// An overlapped window has a title bar and a border. + /// Same as the WS_OVERLAPPED style. + /// + [SuppressMessage("Naming", "CA1069", Justification = "Name and value taken from Win32Api")] + WS_TILED = 0x00000000, + + /// + /// The window is an overlapped window. + /// Same as the WS_OVERLAPPEDWINDOW style. + /// + [SuppressMessage("Naming", "CA1069", Justification = "Name and value taken from Win32Api")] + WS_TILEDWINDOW = + WINDOW_STYLE.WS_OVERLAPPED | + WINDOW_STYLE.WS_CAPTION | + WINDOW_STYLE.WS_SYSMENU | + WINDOW_STYLE.WS_THICKFRAME | + WINDOW_STYLE.WS_MINIMIZEBOX | + WINDOW_STYLE.WS_MAXIMIZEBOX, + + /// + /// The window is initially visible. + /// This style can be turned on and off by using the ShowWindow or SetWindowPos function. + /// + WS_VISIBLE = 0x10000000, + + /// + /// The window has a vertical scroll bar. + /// + WS_VSCROLL = 0x00200000, + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs new file mode 100644 index 0000000..0fcdf5a --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs @@ -0,0 +1,65 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using static FancyMouse.HotKeys.NativeMethods.Core; +using static FancyMouse.HotKeys.NativeMethods.User32; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// Contains window class information. It is used with the RegisterClassEx and GetClassInfoEx functions. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-wndclassexw + /// + [SuppressMessage("SA1307", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "Names match Win32 api")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal readonly struct WNDCLASSEXW + { + public readonly UINT cbSize; + public readonly WNDCLASS_STYLES style; + public readonly WNDPROC lpfnWndProc; + public readonly int cbClsExtra; + public readonly int cbWndExtra; + public readonly HINSTANCE hInstance; + public readonly HICON hIcon; + public readonly HCURSOR hCursor; + public readonly HBRUSH hbrBackground; + public readonly PCWSTR lpszMenuName; + public readonly PCWSTR lpszClassName; + public readonly HICON hIconSm; + + public WNDCLASSEXW( + UINT cbSize, + WNDCLASS_STYLES style, + [MarshalAs(UnmanagedType.FunctionPtr)] + WNDPROC lpfnWndProc, + int cbClsExtra, + int cbWndExtra, + HINSTANCE hInstance, + HICON hIcon, + HCURSOR hCursor, + HBRUSH hbrBackground, + PCWSTR lpszMenuName, + PCWSTR lpszClassName, + HICON hIconSm) + { + this.cbSize = cbSize; + this.style = style; + this.lpfnWndProc = lpfnWndProc; + this.cbClsExtra = cbClsExtra; + this.cbWndExtra = cbWndExtra; + this.hInstance = hInstance; + this.hIcon = hIcon; + this.hCursor = hCursor; + this.hbrBackground = hbrBackground; + this.lpszMenuName = lpszMenuName; + this.lpszClassName = lpszClassName; + this.hIconSm = hIconSm; + } + + public static int Size => + Marshal.SizeOf(typeof(WNDCLASSEXW)); + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs new file mode 100644 index 0000000..fc19718 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs @@ -0,0 +1,103 @@ +using System.Diagnostics.CodeAnalysis; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// The class styles define additional elements of the window class. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/winmsg/window-class-styles + /// + [Flags] + [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Names and values taken from Win32Api")] + [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "Names and values taken from Win32Api")] + internal enum WNDCLASS_STYLES : uint + { + /// + /// Aligns the window's client area on a byte boundary (in the x direction). + /// This style affects the width of the window and its horizontal placement on the display. + /// + CS_BYTEALIGNCLIENT = 0x1000, + + /// + /// Aligns the window on a byte boundary (in the x direction). + /// This style affects the width of the window and its horizontal placement on the display. + /// + CS_BYTEALIGNWINDOW = 0x2000, + + /// + /// Allocates one device context to be shared by all windows in the class. + /// Because window classes are process specific, it is possible for multiple threads of an + /// application to create a window of the same class. It is also possible for the threads + /// to attempt to use the device context simultaneously. When this happens, the system + /// allows only one thread to successfully finish its drawing operation. + /// + CS_CLASSDC = 0x0040, + + /// + /// Sends a double-click message to the window procedure when the user double-clicks + /// the mouse while the cursor is within a window belonging to the class. + /// + CS_DBLCLKS = 0x0008, + + /// + /// Enables the drop shadow effect on a window. The effect is turned on and off through + /// SPI_SETDROPSHADOW. Typically, this is enabled for small, short-lived windows such + /// as menus to emphasize their Z-order relationship to other windows. Windows created + /// from a class with this style must be top-level windows; they may not be child windows. + /// + CS_DROPSHADOW = 0x00020000, + + /// + /// Indicates that the window class is an application global class. For more information, + /// see the "Application Global Classes" section of About Window Classes. + /// + CS_GLOBALCLASS = 0x4000, + + /// + /// Redraws the entire window if a movement or size adjustment changes the width of + /// the client area. + /// + CS_HREDRAW = 0x0002, + + /// + /// Disables Close on the window menu. + /// + CS_NOCLOSE = 0x0200, + + /// + /// Allocates a unique device context for each window in the class. + /// + CS_OWNDC = 0x0020, + + /// + /// Sets the clipping rectangle of the child window to that of the parent window so that + /// the child can draw on the parent. A window with the CS_PARENTDC style bit receives a + /// regular device context from the system's cache of device contexts. It does not give + /// the child the parent's device context or device context settings. Specifying + /// CS_PARENTDC enhances an application's performance. + /// + CS_PARENTDC = 0x0080, + + /// + /// Saves, as a bitmap, the portion of the screen image obscured by a window of this class. + /// When the window is removed, the system uses the saved bitmap to restore the screen image, + /// including other windows that were obscured. Therefore, the system does not send WM_PAINT + /// messages to windows that were obscured if the memory used by the bitmap has not been + /// discarded and if other screen actions have not invalidated the stored image. + /// This style is useful for small windows (for example, menus or dialog boxes) that are + /// displayed briefly and then removed before other screen activity takes place. This style + /// increases the time required to display the window, because the system must first allocate + /// memory to store the bitmap. + /// + CS_SAVEBITS = 0x0800, + + /// + /// Redraws the entire window if a movement or size adjustment changes the height of + /// the client area. + /// + CS_VREDRAW = 0x0001, + } +} diff --git a/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs new file mode 100644 index 0000000..8313c76 --- /dev/null +++ b/src/FancyMouse.HotKeys/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs @@ -0,0 +1,26 @@ +using static FancyMouse.HotKeys.NativeMethods.Core; + +namespace FancyMouse.HotKeys.NativeMethods; + +internal static partial class User32 +{ + /// + /// A callback function, which you define in your application, that processes messages sent to a window. + /// + /// A handle to the window. This parameter is typically named hWnd. + /// The message. This parameter is typically named uMsg. + /// Additional message information. This parameter is typically named wParam. + /// Additional message information. This parameter is typically named lParam. + /// + /// The return value is the result of the message processing, and depends on the message sent. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nc-winuser-wndproc + /// https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Interop/Windows/User32/Interop.WndProc.cs + /// + internal delegate LRESULT WNDPROC( + HWND hWnd, + MESSAGE_TYPE msg, + WPARAM wParam, + LPARAM lParam); +} diff --git a/src/FancyMouse.UnitTests/Models/Settings/AppSettingsReaderTests.cs b/src/FancyMouse.Settings.UnitTests/AppSettingsReaderTests.cs similarity index 98% rename from src/FancyMouse.UnitTests/Models/Settings/AppSettingsReaderTests.cs rename to src/FancyMouse.Settings.UnitTests/AppSettingsReaderTests.cs index 76ec171..5fccc6d 100644 --- a/src/FancyMouse.UnitTests/Models/Settings/AppSettingsReaderTests.cs +++ b/src/FancyMouse.Settings.UnitTests/AppSettingsReaderTests.cs @@ -2,12 +2,12 @@ using System.Drawing; using System.Text.Json; using FancyMouse.Common.Models.Styles; -using FancyMouse.Internal.HotKeys; -using FancyMouse.Internal.Models.Settings; -using FancyMouse.UnitTests.TestUtils; +using FancyMouse.HotKeys; +using FancyMouse.Settings; +using FancyMouse.UnitTests.Settings.TestUtils; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace FancyMouse.UnitTests.Models.Settings; +namespace FancyMouse.UnitTests.Settings; [TestClass] public sealed class AppSettingsReaderTests diff --git a/src/FancyMouse.Settings.UnitTests/FancyMouse.Settings.UnitTests.csproj b/src/FancyMouse.Settings.UnitTests/FancyMouse.Settings.UnitTests.csproj new file mode 100644 index 0000000..2ecf1cf --- /dev/null +++ b/src/FancyMouse.Settings.UnitTests/FancyMouse.Settings.UnitTests.csproj @@ -0,0 +1,32 @@ + + + + net8.0-windows + enable + enable + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/FancyMouse.UnitTests/TestUtils/SerializationUtils.cs b/src/FancyMouse.Settings.UnitTests/TestUtils/SerializationUtils.cs similarity index 90% rename from src/FancyMouse.UnitTests/TestUtils/SerializationUtils.cs rename to src/FancyMouse.Settings.UnitTests/TestUtils/SerializationUtils.cs index 93d3103..5d39124 100644 --- a/src/FancyMouse.UnitTests/TestUtils/SerializationUtils.cs +++ b/src/FancyMouse.Settings.UnitTests/TestUtils/SerializationUtils.cs @@ -1,7 +1,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace FancyMouse.UnitTests.TestUtils; +namespace FancyMouse.UnitTests.Settings.TestUtils; internal static class SerializationUtils { diff --git a/src/FancyMouse/Internal/Models/Settings/AppSettings.cs b/src/FancyMouse.Settings/AppSettings.cs similarity index 90% rename from src/FancyMouse/Internal/Models/Settings/AppSettings.cs rename to src/FancyMouse.Settings/AppSettings.cs index 05401cd..2c675b8 100644 --- a/src/FancyMouse/Internal/Models/Settings/AppSettings.cs +++ b/src/FancyMouse.Settings/AppSettings.cs @@ -1,15 +1,16 @@ -using FancyMouse.Common.Models.Styles; -using FancyMouse.Internal.HotKeys; -using Keys = FancyMouse.Internal.HotKeys.Keys; +using System.Drawing; +using FancyMouse.Common.Models.Styles; +using FancyMouse.HotKeys; +using Keys = FancyMouse.HotKeys.Keys; -namespace FancyMouse.Internal.Models.Settings; +namespace FancyMouse.Settings; /// /// Represents the settings used to control application behaviour. /// This is different to the AppConfig class that is used to /// serialize / deserialize settings into the application config file. /// -internal sealed class AppSettings +public sealed class AppSettings { public static readonly AppSettings DefaultSettings = new( hotkey: new( diff --git a/src/FancyMouse/Internal/Models/Settings/AppSettingsReader.cs b/src/FancyMouse.Settings/AppSettingsReader.cs similarity index 93% rename from src/FancyMouse/Internal/Models/Settings/AppSettingsReader.cs rename to src/FancyMouse.Settings/AppSettingsReader.cs index 0608d45..f5bda5f 100644 --- a/src/FancyMouse/Internal/Models/Settings/AppSettingsReader.cs +++ b/src/FancyMouse.Settings/AppSettingsReader.cs @@ -1,8 +1,8 @@ using System.Text.Json.Nodes; -namespace FancyMouse.Internal.Models.Settings; +namespace FancyMouse.Settings; -internal static class AppSettingsReader +public static class AppSettingsReader { public static AppSettings ReadFile(string filename) { diff --git a/src/FancyMouse.Settings/FancyMouse.Settings.csproj b/src/FancyMouse.Settings/FancyMouse.Settings.csproj new file mode 100644 index 0000000..5f3830d --- /dev/null +++ b/src/FancyMouse.Settings/FancyMouse.Settings.csproj @@ -0,0 +1,25 @@ + + + + net8.0-windows + enable + enable + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/FancyMouse/Internal/Models/Settings/V1/AppConfig.cs b/src/FancyMouse.Settings/V1/AppConfig.cs similarity index 88% rename from src/FancyMouse/Internal/Models/Settings/V1/AppConfig.cs rename to src/FancyMouse.Settings/V1/AppConfig.cs index 43c1509..1690c18 100644 --- a/src/FancyMouse/Internal/Models/Settings/V1/AppConfig.cs +++ b/src/FancyMouse.Settings/V1/AppConfig.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.Internal.Models.Settings.V1; +namespace FancyMouse.Settings.V1; /// /// Represents the configuration file format to allow for easier diff --git a/src/FancyMouse/Internal/Models/Settings/V1/FancyMouse.cs b/src/FancyMouse.Settings/V1/FancyMouse.cs similarity index 90% rename from src/FancyMouse/Internal/Models/Settings/V1/FancyMouse.cs rename to src/FancyMouse.Settings/V1/FancyMouse.cs index bd3c1f1..52ae89e 100644 --- a/src/FancyMouse/Internal/Models/Settings/V1/FancyMouse.cs +++ b/src/FancyMouse.Settings/V1/FancyMouse.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace FancyMouse.Internal.Models.Settings.V1; +namespace FancyMouse.Settings.V1; /// /// Represents the "fancymouse"' node in the V1 config file diff --git a/src/FancyMouse/Internal/Models/Settings/V1/SettingsConverter.cs b/src/FancyMouse.Settings/V1/SettingsConverter.cs similarity index 95% rename from src/FancyMouse/Internal/Models/Settings/V1/SettingsConverter.cs rename to src/FancyMouse.Settings/V1/SettingsConverter.cs index 47dba52..a12085c 100644 --- a/src/FancyMouse/Internal/Models/Settings/V1/SettingsConverter.cs +++ b/src/FancyMouse.Settings/V1/SettingsConverter.cs @@ -2,9 +2,9 @@ using System.Text.Json; using System.Text.Json.Serialization; using FancyMouse.Common.Models.Styles; -using FancyMouse.Internal.HotKeys; +using FancyMouse.HotKeys; -namespace FancyMouse.Internal.Models.Settings.V1; +namespace FancyMouse.Settings.V1; internal static class SettingsConverter { diff --git a/src/FancyMouse/Internal/Models/Settings/V1/_FancyMouse.json b/src/FancyMouse.Settings/V1/_FancyMouse.json similarity index 100% rename from src/FancyMouse/Internal/Models/Settings/V1/_FancyMouse.json rename to src/FancyMouse.Settings/V1/_FancyMouse.json diff --git a/src/FancyMouse/Internal/Models/Settings/V2/AppConfig.cs b/src/FancyMouse.Settings/V2/AppConfig.cs similarity index 95% rename from src/FancyMouse/Internal/Models/Settings/V2/AppConfig.cs rename to src/FancyMouse.Settings/V2/AppConfig.cs index 13e4233..38902db 100644 --- a/src/FancyMouse/Internal/Models/Settings/V2/AppConfig.cs +++ b/src/FancyMouse.Settings/V2/AppConfig.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace FancyMouse.Internal.Models.Settings.V2; +namespace FancyMouse.Settings.V2; /// /// Represents the configuration file format to allow for easier diff --git a/src/FancyMouse/Internal/Models/Settings/V2/BackgroundStyleSettings.cs b/src/FancyMouse.Settings/V2/BackgroundStyleSettings.cs similarity index 94% rename from src/FancyMouse/Internal/Models/Settings/V2/BackgroundStyleSettings.cs rename to src/FancyMouse.Settings/V2/BackgroundStyleSettings.cs index 848f7ec..871040f 100644 --- a/src/FancyMouse/Internal/Models/Settings/V2/BackgroundStyleSettings.cs +++ b/src/FancyMouse.Settings/V2/BackgroundStyleSettings.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace FancyMouse.Internal.Models.Settings.V2; +namespace FancyMouse.Settings.V2; /// /// Represents the background fill style for a drawing object. diff --git a/src/FancyMouse/Internal/Models/Settings/V2/BorderStyleSettings.cs b/src/FancyMouse.Settings/V2/BorderStyleSettings.cs similarity index 95% rename from src/FancyMouse/Internal/Models/Settings/V2/BorderStyleSettings.cs rename to src/FancyMouse.Settings/V2/BorderStyleSettings.cs index f29549b..3485629 100644 --- a/src/FancyMouse/Internal/Models/Settings/V2/BorderStyleSettings.cs +++ b/src/FancyMouse.Settings/V2/BorderStyleSettings.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace FancyMouse.Internal.Models.Settings.V2; +namespace FancyMouse.Settings.V2; /// /// Represents the border style for a drawing object. diff --git a/src/FancyMouse/Internal/Models/Settings/V2/CanvasSizeSettings.cs b/src/FancyMouse.Settings/V2/CanvasSizeSettings.cs similarity index 91% rename from src/FancyMouse/Internal/Models/Settings/V2/CanvasSizeSettings.cs rename to src/FancyMouse.Settings/V2/CanvasSizeSettings.cs index 35b1125..5596dea 100644 --- a/src/FancyMouse/Internal/Models/Settings/V2/CanvasSizeSettings.cs +++ b/src/FancyMouse.Settings/V2/CanvasSizeSettings.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace FancyMouse.Internal.Models.Settings.V2; +namespace FancyMouse.Settings.V2; internal sealed class CanvasSizeSettings { diff --git a/src/FancyMouse/Internal/Models/Settings/V2/CanvasStyleSettings.cs b/src/FancyMouse.Settings/V2/CanvasStyleSettings.cs similarity index 96% rename from src/FancyMouse/Internal/Models/Settings/V2/CanvasStyleSettings.cs rename to src/FancyMouse.Settings/V2/CanvasStyleSettings.cs index c37d394..4c38d33 100644 --- a/src/FancyMouse/Internal/Models/Settings/V2/CanvasStyleSettings.cs +++ b/src/FancyMouse.Settings/V2/CanvasStyleSettings.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace FancyMouse.Internal.Models.Settings.V2; +namespace FancyMouse.Settings.V2; /// /// Doesn't have a MarginStyle setting like the BoxStyle class does - we don't diff --git a/src/FancyMouse/Internal/Models/Settings/V2/Converters/ColorConverter.cs b/src/FancyMouse.Settings/V2/Converters/ColorConverter.cs similarity index 97% rename from src/FancyMouse/Internal/Models/Settings/V2/Converters/ColorConverter.cs rename to src/FancyMouse.Settings/V2/Converters/ColorConverter.cs index 371537c..cce0ffe 100644 --- a/src/FancyMouse/Internal/Models/Settings/V2/Converters/ColorConverter.cs +++ b/src/FancyMouse.Settings/V2/Converters/ColorConverter.cs @@ -1,8 +1,9 @@ -using System.Globalization; +using System.Drawing; +using System.Globalization; using System.Text.Json; using System.Text.Json.Serialization; -namespace FancyMouse.Internal.Models.Settings.V2; +namespace FancyMouse.Settings.V2; /// /// Converts a color string from the settings file into a color, and vice versa. diff --git a/src/FancyMouse/Internal/Models/Settings/V2/MarginStyleSettings.cs b/src/FancyMouse.Settings/V2/MarginStyleSettings.cs similarity index 91% rename from src/FancyMouse/Internal/Models/Settings/V2/MarginStyleSettings.cs rename to src/FancyMouse.Settings/V2/MarginStyleSettings.cs index 86b4228..5c9cd00 100644 --- a/src/FancyMouse/Internal/Models/Settings/V2/MarginStyleSettings.cs +++ b/src/FancyMouse.Settings/V2/MarginStyleSettings.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace FancyMouse.Internal.Models.Settings.V2; +namespace FancyMouse.Settings.V2; /// /// Represents the margin style for a drawing object. diff --git a/src/FancyMouse/Internal/Models/Settings/V2/PaddingStyleSettings.cs b/src/FancyMouse.Settings/V2/PaddingStyleSettings.cs similarity index 91% rename from src/FancyMouse/Internal/Models/Settings/V2/PaddingStyleSettings.cs rename to src/FancyMouse.Settings/V2/PaddingStyleSettings.cs index c804f40..9a9701c 100644 --- a/src/FancyMouse/Internal/Models/Settings/V2/PaddingStyleSettings.cs +++ b/src/FancyMouse.Settings/V2/PaddingStyleSettings.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace FancyMouse.Internal.Models.Settings.V2; +namespace FancyMouse.Settings.V2; /// /// Represents the margin style for a drawing object. diff --git a/src/FancyMouse/Internal/Models/Settings/V2/PreviewStyleSettings.cs b/src/FancyMouse.Settings/V2/PreviewStyleSettings.cs similarity index 90% rename from src/FancyMouse/Internal/Models/Settings/V2/PreviewStyleSettings.cs rename to src/FancyMouse.Settings/V2/PreviewStyleSettings.cs index 427ecf1..f11c955 100644 --- a/src/FancyMouse/Internal/Models/Settings/V2/PreviewStyleSettings.cs +++ b/src/FancyMouse.Settings/V2/PreviewStyleSettings.cs @@ -1,8 +1,8 @@ using System.Text.Json.Serialization; -namespace FancyMouse.Internal.Models.Settings.V2; +namespace FancyMouse.Settings.V2; -internal class PreviewStyleSettings +internal sealed class PreviewStyleSettings { public PreviewStyleSettings( CanvasSizeSettings? canvasSize, diff --git a/src/FancyMouse/Internal/Models/Settings/V2/ScreenStyleSettings.cs b/src/FancyMouse.Settings/V2/ScreenStyleSettings.cs similarity index 96% rename from src/FancyMouse/Internal/Models/Settings/V2/ScreenStyleSettings.cs rename to src/FancyMouse.Settings/V2/ScreenStyleSettings.cs index 196809b..5e075d4 100644 --- a/src/FancyMouse/Internal/Models/Settings/V2/ScreenStyleSettings.cs +++ b/src/FancyMouse.Settings/V2/ScreenStyleSettings.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace FancyMouse.Internal.Models.Settings.V2; +namespace FancyMouse.Settings.V2; /// /// Doesn't have a PaddingStyle setting like the BoxStyle class does - we don't diff --git a/src/FancyMouse/Internal/Models/Settings/V2/SettingsConverter.cs b/src/FancyMouse.Settings/V2/SettingsConverter.cs similarity index 95% rename from src/FancyMouse/Internal/Models/Settings/V2/SettingsConverter.cs rename to src/FancyMouse.Settings/V2/SettingsConverter.cs index 8651556..59afc4c 100644 --- a/src/FancyMouse/Internal/Models/Settings/V2/SettingsConverter.cs +++ b/src/FancyMouse.Settings/V2/SettingsConverter.cs @@ -1,8 +1,8 @@ -using System.Text.Json; +using System.Drawing; +using System.Text.Json; using FancyMouse.Common.Models.Styles; -using BorderStyle = FancyMouse.Common.Models.Styles.BorderStyle; -namespace FancyMouse.Internal.Models.Settings.V2; +namespace FancyMouse.Settings.V2; internal static class SettingsConverter { @@ -11,13 +11,13 @@ internal static class SettingsConverter PropertyNameCaseInsensitive = true, }; - public static Settings.AppSettings ParseAppSettings(string json) + public static AppSettings ParseAppSettings(string json) { var appConfig = JsonSerializer.Deserialize(json, SettingsConverter.JsonSerializerOptions) ?? throw new InvalidOperationException(); var hotkey = V1.SettingsConverter.ConvertToKeystroke(appConfig.Hotkey); - var previewStyle = SettingsConverter.MergePreviewStyles(appConfig.Preview, Settings.AppSettings.DefaultSettings.PreviewStyle); - var appSettings = new Settings.AppSettings(hotkey, previewStyle); + var previewStyle = SettingsConverter.MergePreviewStyles(appConfig.Preview, AppSettings.DefaultSettings.PreviewStyle); + var appSettings = new AppSettings(hotkey, previewStyle); return appSettings; } diff --git a/src/FancyMouse/Internal/Models/Settings/V2/_FancyMouse.json b/src/FancyMouse.Settings/V2/_FancyMouse.json similarity index 100% rename from src/FancyMouse/Internal/Models/Settings/V2/_FancyMouse.json rename to src/FancyMouse.Settings/V2/_FancyMouse.json diff --git a/src/FancyMouse.sln b/src/FancyMouse.sln index fb3c80e..458b09f 100644 --- a/src/FancyMouse.sln +++ b/src/FancyMouse.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 17.4.33015.44 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FancyMouse", "FancyMouse\FancyMouse.csproj", "{EFE2A257-6979-4067-99A7-0C762492A8C7}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FancyMouse.UnitTests", "FancyMouse.UnitTests\FancyMouse.UnitTests.csproj", "{9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{49E13F75-3D64-4529-B0AA-55DFE69795FB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{C92998B2-2E21-4DA8-A73D-ADE970C87F25}" @@ -15,6 +13,22 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ ..\.github\workflows\02_codeql.yaml = ..\.github\workflows\02_codeql.yaml EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FancyMouse.Common", "FancyMouse.Common\FancyMouse.Common.csproj", "{1BBB9184-2ECA-465A-A990-C15A6A60BA0F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FancyMouse.HotKeys", "FancyMouse.HotKeys\FancyMouse.HotKeys.csproj", "{F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FancyMouse.Settings", "FancyMouse.Settings\FancyMouse.Settings.csproj", "{88ABCB98-3494-4B18-81B1-6C7A419DD369}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FancyMouse.Common.UnitTests", "FancyMouse.Common.UnitTests\FancyMouse.Common.UnitTests.csproj", "{74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FancyMouse.HotKeys.UnitTests", "FancyMouse.HotKeys.UnitTests\FancyMouse.HotKeys.UnitTests.csproj", "{DB015689-4BF8-479C-9168-A93C6A76AE6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FancyMouse.Settings.UnitTests", "FancyMouse.Settings.UnitTests\FancyMouse.Settings.UnitTests.csproj", "{E2822B3F-B07D-4E41-9A39-41E23F8EC058}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{CDF25995-93DB-430F-9DA8-D77778CD8439}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{ECE2017E-843D-40C8-BAA4-DC0B5BAE0CAB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -43,28 +57,114 @@ Global {EFE2A257-6979-4067-99A7-0C762492A8C7}.Release|x64.Build.0 = Release|Any CPU {EFE2A257-6979-4067-99A7-0C762492A8C7}.Release|x86.ActiveCfg = Release|Any CPU {EFE2A257-6979-4067-99A7-0C762492A8C7}.Release|x86.Build.0 = Release|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Debug|ARM64.Build.0 = Debug|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Debug|x64.ActiveCfg = Debug|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Debug|x64.Build.0 = Debug|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Debug|x86.ActiveCfg = Debug|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Debug|x86.Build.0 = Debug|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Release|Any CPU.Build.0 = Release|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Release|ARM64.ActiveCfg = Release|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Release|ARM64.Build.0 = Release|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Release|x64.ActiveCfg = Release|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Release|x64.Build.0 = Release|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Release|x86.ActiveCfg = Release|Any CPU - {9A9E15AF-3E85-4F20-AA23-A14ACA4805B5}.Release|x86.Build.0 = Release|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Debug|ARM64.Build.0 = Debug|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Debug|x64.ActiveCfg = Debug|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Debug|x64.Build.0 = Debug|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Debug|x86.ActiveCfg = Debug|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Debug|x86.Build.0 = Debug|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Release|Any CPU.Build.0 = Release|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Release|ARM64.ActiveCfg = Release|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Release|ARM64.Build.0 = Release|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Release|x64.ActiveCfg = Release|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Release|x64.Build.0 = Release|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Release|x86.ActiveCfg = Release|Any CPU + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F}.Release|x86.Build.0 = Release|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Debug|ARM64.Build.0 = Debug|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Debug|x64.ActiveCfg = Debug|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Debug|x64.Build.0 = Debug|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Debug|x86.ActiveCfg = Debug|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Debug|x86.Build.0 = Debug|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Release|Any CPU.Build.0 = Release|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Release|ARM64.ActiveCfg = Release|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Release|ARM64.Build.0 = Release|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Release|x64.ActiveCfg = Release|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Release|x64.Build.0 = Release|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Release|x86.ActiveCfg = Release|Any CPU + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3}.Release|x86.Build.0 = Release|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Debug|ARM64.Build.0 = Debug|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Debug|x64.ActiveCfg = Debug|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Debug|x64.Build.0 = Debug|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Debug|x86.ActiveCfg = Debug|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Debug|x86.Build.0 = Debug|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Release|Any CPU.Build.0 = Release|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Release|ARM64.ActiveCfg = Release|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Release|ARM64.Build.0 = Release|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Release|x64.ActiveCfg = Release|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Release|x64.Build.0 = Release|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Release|x86.ActiveCfg = Release|Any CPU + {88ABCB98-3494-4B18-81B1-6C7A419DD369}.Release|x86.Build.0 = Release|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Debug|ARM64.Build.0 = Debug|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Debug|x64.ActiveCfg = Debug|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Debug|x64.Build.0 = Debug|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Debug|x86.ActiveCfg = Debug|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Debug|x86.Build.0 = Debug|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Release|Any CPU.Build.0 = Release|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Release|ARM64.ActiveCfg = Release|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Release|ARM64.Build.0 = Release|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Release|x64.ActiveCfg = Release|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Release|x64.Build.0 = Release|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Release|x86.ActiveCfg = Release|Any CPU + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF}.Release|x86.Build.0 = Release|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Debug|ARM64.Build.0 = Debug|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Debug|x64.ActiveCfg = Debug|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Debug|x64.Build.0 = Debug|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Debug|x86.ActiveCfg = Debug|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Debug|x86.Build.0 = Debug|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Release|Any CPU.Build.0 = Release|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Release|ARM64.ActiveCfg = Release|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Release|ARM64.Build.0 = Release|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Release|x64.ActiveCfg = Release|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Release|x64.Build.0 = Release|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Release|x86.ActiveCfg = Release|Any CPU + {DB015689-4BF8-479C-9168-A93C6A76AE6C}.Release|x86.Build.0 = Release|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Debug|ARM64.Build.0 = Debug|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Debug|x64.ActiveCfg = Debug|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Debug|x64.Build.0 = Debug|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Debug|x86.ActiveCfg = Debug|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Debug|x86.Build.0 = Debug|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Release|Any CPU.Build.0 = Release|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Release|ARM64.ActiveCfg = Release|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Release|ARM64.Build.0 = Release|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Release|x64.ActiveCfg = Release|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Release|x64.Build.0 = Release|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Release|x86.ActiveCfg = Release|Any CPU + {E2822B3F-B07D-4E41-9A39-41E23F8EC058}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {C92998B2-2E21-4DA8-A73D-ADE970C87F25} = {49E13F75-3D64-4529-B0AA-55DFE69795FB} + {1BBB9184-2ECA-465A-A990-C15A6A60BA0F} = {ECE2017E-843D-40C8-BAA4-DC0B5BAE0CAB} + {F15EA282-EE90-4F18-B1DB-DC9309CE0CA3} = {ECE2017E-843D-40C8-BAA4-DC0B5BAE0CAB} + {88ABCB98-3494-4B18-81B1-6C7A419DD369} = {ECE2017E-843D-40C8-BAA4-DC0B5BAE0CAB} + {74C3F6B7-8333-49CE-8701-3CAB48CC1FEF} = {CDF25995-93DB-430F-9DA8-D77778CD8439} + {DB015689-4BF8-479C-9168-A93C6A76AE6C} = {CDF25995-93DB-430F-9DA8-D77778CD8439} + {E2822B3F-B07D-4E41-9A39-41E23F8EC058} = {CDF25995-93DB-430F-9DA8-D77778CD8439} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3D14D3DA-D261-4E05-A448-4AACF57F15D5} diff --git a/src/FancyMouse/FancyMouse.csproj b/src/FancyMouse/FancyMouse.csproj index 0f74613..4ee1415 100644 --- a/src/FancyMouse/FancyMouse.csproj +++ b/src/FancyMouse/FancyMouse.csproj @@ -46,11 +46,17 @@ - + - + - + + + + + + + diff --git a/src/FancyMouse/Internal/Helpers/ConfigHelper.cs b/src/FancyMouse/Internal/Helpers/ConfigHelper.cs index d6bf5b5..78f40a2 100644 --- a/src/FancyMouse/Internal/Helpers/ConfigHelper.cs +++ b/src/FancyMouse/Internal/Helpers/ConfigHelper.cs @@ -1,5 +1,5 @@ -using FancyMouse.Internal.HotKeys; -using FancyMouse.Internal.Models.Settings; +using FancyMouse.HotKeys; +using FancyMouse.Settings; namespace FancyMouse.Internal.Helpers; @@ -84,7 +84,7 @@ private static void OnAppSettingsChanged(object sender, FileSystemEventArgs e) // the file might not have been released yet by the application that saved it // and caused the file system event (e.g. notepad) so we need to do a couple - // of retries to give it a change to release the lock so we can load the file contents. + // of retries to give it a chance to release the lock so we can load the file contents. for (var i = 0; i < 3; i++) { try diff --git a/src/FancyMouse/Properties/AssemblyInfo.cs b/src/FancyMouse/Properties/AssemblyInfo.cs deleted file mode 100644 index cf12ec4..0000000 --- a/src/FancyMouse/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("FancyMouse.UnitTests")] diff --git a/src/FancyMouse/UI/FancyMouseForm.cs b/src/FancyMouse/UI/FancyMouseForm.cs index 42da162..87f1db4 100644 --- a/src/FancyMouse/UI/FancyMouseForm.cs +++ b/src/FancyMouse/UI/FancyMouseForm.cs @@ -8,7 +8,7 @@ namespace FancyMouse.UI; -internal partial class FancyMouseForm : Form +internal sealed partial class FancyMouseForm : Form { public FancyMouseForm(ILogger logger) { @@ -130,9 +130,9 @@ private void Thumbnail_Click(object sender, EventArgs e) if (mouseEventArgs.Button == MouseButtons.Left) { - // there's no layout data so we can't work out what screen was clicked if (this.PreviewLayout is null) { + // there's no layout data so we can't work out what screen was clicked return; }