diff --git a/Hyperbar.Windows.Controls/DesktopFlyout/DesktopFlyoutHost.cs b/Hyperbar.Windows.Controls/DesktopFlyout/DesktopFlyoutHost.cs index bed1762..cab0abd 100644 --- a/Hyperbar.Windows.Controls/DesktopFlyout/DesktopFlyoutHost.cs +++ b/Hyperbar.Windows.Controls/DesktopFlyout/DesktopFlyoutHost.cs @@ -1,7 +1,8 @@ -using Hyperbar.Windows.Win32; -using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; +using Hyperbar.Windows.UI; +using Hyperbar.Windows.Interop; namespace Hyperbar.Windows.Controls; diff --git a/Hyperbar.Windows.Controls/Hyperbar.Windows.Controls.csproj b/Hyperbar.Windows.Controls/Hyperbar.Windows.Controls.csproj index 1e29107..adab486 100644 --- a/Hyperbar.Windows.Controls/Hyperbar.Windows.Controls.csproj +++ b/Hyperbar.Windows.Controls/Hyperbar.Windows.Controls.csproj @@ -13,6 +13,7 @@ - + + diff --git a/Hyperbar.Windows.Win32/HwndExtensions.cs b/Hyperbar.Windows.Interop/HwndExtensions.cs similarity index 93% rename from Hyperbar.Windows.Win32/HwndExtensions.cs rename to Hyperbar.Windows.Interop/HwndExtensions.cs index 7a9aa0e..8c323f4 100644 --- a/Hyperbar.Windows.Win32/HwndExtensions.cs +++ b/Hyperbar.Windows.Interop/HwndExtensions.cs @@ -5,7 +5,7 @@ using Windows.Win32.Foundation; using Windows.Win32.Graphics.Gdi; using Windows.Win32.UI.WindowsAndMessaging; -namespace Hyperbar.Windows.Win32; +namespace Hyperbar.Windows.Interop; public static class HwndExtensions { @@ -44,7 +44,7 @@ public static class HwndExtensions } public static void SnapWindow(this IntPtr hwnd, - WindowPlacement placement, + int placement, double? width = null, double? height = null) { @@ -68,22 +68,22 @@ public static class HwndExtensions switch (placement) { - case WindowPlacement.Left: + case 0: left = 0; top = (info.rcWork.bottom + info.rcWork.top) / 2 - actualHeight / 2; break; - case WindowPlacement.Top: + case 1: left = (info.rcWork.left + info.rcWork.right) / 2 - actualWidth / 2; top = 0; break; - case WindowPlacement.Right: + case 2: left = info.rcWork.left + info.rcWork.right - actualWidth; top = (info.rcWork.bottom + info.rcWork.top) / 2 - actualHeight / 2; break; - case WindowPlacement.Bottom: + case 3: left = (info.rcWork.left + info.rcWork.right) / 2 - actualWidth / 2; top = info.rcWork.bottom + info.rcWork.top - actualHeight; break; diff --git a/Hyperbar.Windows.Interop/Hyperbar.Windows.Interop.csproj b/Hyperbar.Windows.Interop/Hyperbar.Windows.Interop.csproj new file mode 100644 index 0000000..fa7484f --- /dev/null +++ b/Hyperbar.Windows.Interop/Hyperbar.Windows.Interop.csproj @@ -0,0 +1,13 @@ + + + net8.0-windows10.0.19041.0 + enable + enable + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + \ No newline at end of file diff --git a/Hyperbar.Windows.Win32/IVirtualKeyboard.cs b/Hyperbar.Windows.Interop/IVirtualKeyboard.cs similarity index 73% rename from Hyperbar.Windows.Win32/IVirtualKeyboard.cs rename to Hyperbar.Windows.Interop/IVirtualKeyboard.cs index 931f3e2..e1c9792 100644 --- a/Hyperbar.Windows.Win32/IVirtualKeyboard.cs +++ b/Hyperbar.Windows.Interop/IVirtualKeyboard.cs @@ -1,4 +1,4 @@ -namespace Hyperbar.Windows.Win32 +namespace Hyperbar.Windows.Interop { public interface IVirtualKeyboard { diff --git a/Hyperbar.Windows.Win32/NativeMethods.txt b/Hyperbar.Windows.Interop/NativeMethods.txt similarity index 100% rename from Hyperbar.Windows.Win32/NativeMethods.txt rename to Hyperbar.Windows.Interop/NativeMethods.txt diff --git a/Hyperbar.Windows.Win32/PInvoke.cs b/Hyperbar.Windows.Interop/PInvoke.cs similarity index 100% rename from Hyperbar.Windows.Win32/PInvoke.cs rename to Hyperbar.Windows.Interop/PInvoke.cs diff --git a/Hyperbar.Windows.Win32/VirtualKeyboard.cs b/Hyperbar.Windows.Interop/VirtualKeyboard.cs similarity index 98% rename from Hyperbar.Windows.Win32/VirtualKeyboard.cs rename to Hyperbar.Windows.Interop/VirtualKeyboard.cs index 843a0e5..2ef2c9d 100644 --- a/Hyperbar.Windows.Win32/VirtualKeyboard.cs +++ b/Hyperbar.Windows.Interop/VirtualKeyboard.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; using Windows.Win32; using Windows.Win32.UI.KeyboardAndMouseInput; -namespace Hyperbar.Windows.Win32; +namespace Hyperbar.Windows.Interop; public class VirtualKeyboard : IVirtualKeyboard diff --git a/Hyperbar.Windows.Win32/WindowStyle.cs b/Hyperbar.Windows.Interop/WindowStyle.cs similarity index 92% rename from Hyperbar.Windows.Win32/WindowStyle.cs rename to Hyperbar.Windows.Interop/WindowStyle.cs index ecc878f..8a0d564 100644 --- a/Hyperbar.Windows.Win32/WindowStyle.cs +++ b/Hyperbar.Windows.Interop/WindowStyle.cs @@ -1,6 +1,4 @@ -using System; - -namespace Hyperbar.Windows.Win32; +namespace Hyperbar.Windows.Interop; [Flags] public enum WindowStyle diff --git a/Hyperbar.Windows.Win32/Hyperbar.Windows.Win32.csproj b/Hyperbar.Windows.UI/Hyperbar.Windows.UI.csproj similarity index 60% rename from Hyperbar.Windows.Win32/Hyperbar.Windows.Win32.csproj rename to Hyperbar.Windows.UI/Hyperbar.Windows.UI.csproj index 1aa5ff3..696dbb4 100644 --- a/Hyperbar.Windows.Win32/Hyperbar.Windows.Win32.csproj +++ b/Hyperbar.Windows.UI/Hyperbar.Windows.UI.csproj @@ -5,13 +5,15 @@ win10-x86;win10-x64;win10-arm64 true true + enable + enable - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + + + + \ No newline at end of file diff --git a/Hyperbar.Windows.Win32/WindowExtensions.cs b/Hyperbar.Windows.UI/WindowExtensions.cs similarity index 89% rename from Hyperbar.Windows.Win32/WindowExtensions.cs rename to Hyperbar.Windows.UI/WindowExtensions.cs index 8c5d36a..f937ba8 100644 --- a/Hyperbar.Windows.Win32/WindowExtensions.cs +++ b/Hyperbar.Windows.UI/WindowExtensions.cs @@ -1,9 +1,9 @@ -using Microsoft.UI.Windowing; +using Hyperbar.Windows.Interop; +using Microsoft.UI.Windowing; using Microsoft.UI.Xaml; -using System; using WinRT.Interop; -namespace Hyperbar.Windows.Win32; +namespace Hyperbar.Windows.UI; public static class WindowExtensions { @@ -32,5 +32,5 @@ public static class WindowExtensions public static void Snap(this Window window, WindowPlacement placement, double? width = null, - double? height = null) => window.GetHandle().SnapWindow(placement, width, height); + double? height = null) => window.GetHandle().SnapWindow((int)placement, width, height); } \ No newline at end of file diff --git a/Hyperbar.Windows.UI/WindowPlacement.cs b/Hyperbar.Windows.UI/WindowPlacement.cs new file mode 100644 index 0000000..c81b841 --- /dev/null +++ b/Hyperbar.Windows.UI/WindowPlacement.cs @@ -0,0 +1,9 @@ +namespace Hyperbar.Windows.UI; + +public enum WindowPlacement +{ + Left = 0, + Top = 1, + Right = 2, + Bottom = 3, +} \ No newline at end of file diff --git a/Hyperbar.Windows.Win32/WindowPlacement.cs b/Hyperbar.Windows.Win32/WindowPlacement.cs deleted file mode 100644 index f38d4cc..0000000 --- a/Hyperbar.Windows.Win32/WindowPlacement.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Hyperbar.Windows.Win32; - -public enum WindowPlacement -{ - Left, - Top, - Right, - Bottom -} \ No newline at end of file diff --git a/Hyperbar.Windows/Commands/KeyAcceleratorCommandHandler.cs b/Hyperbar.Windows/Commands/KeyAcceleratorCommandHandler.cs index a7e0507..b3d3486 100644 --- a/Hyperbar.Windows/Commands/KeyAcceleratorCommandHandler.cs +++ b/Hyperbar.Windows/Commands/KeyAcceleratorCommandHandler.cs @@ -1,4 +1,4 @@ -using Hyperbar.Windows.Win32; +using Hyperbar.Windows.Interop; namespace Hyperbar.Windows; diff --git a/Hyperbar.Windows/Hyperbar.Windows.csproj b/Hyperbar.Windows/Hyperbar.Windows.csproj index 23a7b82..6594d46 100644 --- a/Hyperbar.Windows/Hyperbar.Windows.csproj +++ b/Hyperbar.Windows/Hyperbar.Windows.csproj @@ -7,11 +7,11 @@ x86;x64;ARM64 win-x86;win-x64;win-arm64 win-$(Platform).pubxml - true true true enable enable + true @@ -37,6 +37,7 @@ + diff --git a/Hyperbar.Windows/Lifecycles/IServiceCollectionExtensions.cs b/Hyperbar.Windows/Lifecycles/IServiceCollectionExtensions.cs index 7c0cbf2..ccc706a 100644 --- a/Hyperbar.Windows/Lifecycles/IServiceCollectionExtensions.cs +++ b/Hyperbar.Windows/Lifecycles/IServiceCollectionExtensions.cs @@ -1,5 +1,5 @@ using Hyperbar.Extensions; -using Hyperbar.Windows.Win32; +using Hyperbar.Windows.Interop; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; diff --git a/Hyperbar.sln b/Hyperbar.sln index a95a408..4e3df00 100644 --- a/Hyperbar.sln +++ b/Hyperbar.sln @@ -7,14 +7,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Windows", "Hyperba EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Windows.Controls", "Hyperbar.Windows.Controls\Hyperbar.Windows.Controls.csproj", "{48ECC6A3-94FF-405D-9DB5-46A725C1B117}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Windows.Win32", "Hyperbar.Windows.Win32\Hyperbar.Windows.Win32.csproj", "{8A4BBC50-970C-4FA8-9F21-0FA63269222F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar", "Hyperbar\Hyperbar.csproj", "{E5795878-C7E3-4386-86FA-33681BCF8D5B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Widget.Contextual", "Hyperbar.Windows.Contextual\Hyperbar.Widget.Contextual.csproj", "{C32D4073-2A9B-4257-8895-09951FAD8E7A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Widget.Primary", "Hyperbar.Windows.Primary\Hyperbar.Widget.Primary.csproj", "{AFB8A3EB-8831-4041-AE05-3E0EF672887C}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Windows.UI", "Hyperbar.Windows.UI\Hyperbar.Windows.UI.csproj", "{ED489968-89A5-42B5-9FC3-20DCF5D78A5E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Windows.Interop", "Hyperbar.Windows.Interop\Hyperbar.Windows.Interop.csproj", "{B64085FB-7B4E-48B9-BEE2-8F158A6CF697}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -67,22 +69,6 @@ Global {48ECC6A3-94FF-405D-9DB5-46A725C1B117}.Release|x64.Build.0 = Release|Any CPU {48ECC6A3-94FF-405D-9DB5-46A725C1B117}.Release|x86.ActiveCfg = Release|Any CPU {48ECC6A3-94FF-405D-9DB5-46A725C1B117}.Release|x86.Build.0 = Release|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Debug|ARM64.Build.0 = Debug|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Debug|x64.ActiveCfg = Debug|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Debug|x64.Build.0 = Debug|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Debug|x86.ActiveCfg = Debug|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Debug|x86.Build.0 = Debug|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Release|Any CPU.Build.0 = Release|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Release|ARM64.ActiveCfg = Release|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Release|ARM64.Build.0 = Release|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Release|x64.ActiveCfg = Release|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Release|x64.Build.0 = Release|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Release|x86.ActiveCfg = Release|Any CPU - {8A4BBC50-970C-4FA8-9F21-0FA63269222F}.Release|x86.Build.0 = Release|Any CPU {E5795878-C7E3-4386-86FA-33681BCF8D5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E5795878-C7E3-4386-86FA-33681BCF8D5B}.Debug|Any CPU.Build.0 = Debug|Any CPU {E5795878-C7E3-4386-86FA-33681BCF8D5B}.Debug|ARM64.ActiveCfg = Debug|Any CPU @@ -131,6 +117,38 @@ Global {AFB8A3EB-8831-4041-AE05-3E0EF672887C}.Release|x64.Build.0 = Release|Any CPU {AFB8A3EB-8831-4041-AE05-3E0EF672887C}.Release|x86.ActiveCfg = Release|Any CPU {AFB8A3EB-8831-4041-AE05-3E0EF672887C}.Release|x86.Build.0 = Release|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Debug|ARM64.Build.0 = Debug|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Debug|x64.ActiveCfg = Debug|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Debug|x64.Build.0 = Debug|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Debug|x86.ActiveCfg = Debug|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Debug|x86.Build.0 = Debug|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Release|Any CPU.Build.0 = Release|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Release|ARM64.ActiveCfg = Release|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Release|ARM64.Build.0 = Release|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Release|x64.ActiveCfg = Release|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Release|x64.Build.0 = Release|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Release|x86.ActiveCfg = Release|Any CPU + {ED489968-89A5-42B5-9FC3-20DCF5D78A5E}.Release|x86.Build.0 = Release|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Debug|ARM64.Build.0 = Debug|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Debug|x64.ActiveCfg = Debug|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Debug|x64.Build.0 = Debug|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Debug|x86.ActiveCfg = Debug|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Debug|x86.Build.0 = Debug|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Release|Any CPU.Build.0 = Release|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Release|ARM64.ActiveCfg = Release|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Release|ARM64.Build.0 = Release|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Release|x64.ActiveCfg = Release|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Release|x64.Build.0 = Release|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Release|x86.ActiveCfg = Release|Any CPU + {B64085FB-7B4E-48B9-BEE2-8F158A6CF697}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE