diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 000000000..b9f694123 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "csharpier": { + "version": "1.0.1", + "commands": [ + "csharpier" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/.csharpierignore b/.csharpierignore new file mode 100644 index 000000000..7f0c25398 --- /dev/null +++ b/.csharpierignore @@ -0,0 +1 @@ +*.csproj diff --git a/Directory.Build.props b/Directory.Build.props index ea8bf55a2..32d5b3484 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,15 +1,12 @@ - $(MSBuildThisFileDirectory) $(RepositoryDirectory)build\ - - 4.0.2 + 4.0.3 4.0.0 - lepo.co lepo.co @@ -25,11 +22,9 @@ main git - - + - true moderate @@ -38,16 +33,13 @@ true <_SilenceIsAotCompatibleUnsupportedWarning>true - true - true 13.0 enable - $(NoWarn);CS8500 - $(MSBuildProjectName.Contains('Test')) False True - True + Or '$(TargetFramework)' == 'net7.0'" + >True - true true $(TF_BUILD) - $(DefineConstants);NET8_0_OR_GREATER - @@ -95,7 +86,6 @@ - @@ -111,5 +101,4 @@ - - \ No newline at end of file + diff --git a/Directory.Build.targets b/Directory.Build.targets index 1a12fc514..d2042d28d 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,15 +1,12 @@ - true - $(CommonTags);.NET $(CommonTags);$(PackageTags) $(CommonTags) - true README.md @@ -19,23 +16,23 @@ true true - - - + <_Parameter1>CommitHash <_Parameter2>$(SourceRevisionId) - true @@ -43,13 +40,15 @@ true true - true $(RepositoryDirectory)\src\lepo.snk - - + + ButtonType="Maximize" + IsHitTestVisible="True" /> > 16) & 0xFFFF)); + // winPoint = new System.Drawing.Point(fallbackX, fallbackY); + // } - if (!gotCursorPos) - { - int fallbackX = unchecked((short)((long)lParam & 0xFFFF)); - int fallbackY = unchecked((short)(((long)lParam >> 16) & 0xFFFF)); - winPoint = new System.Drawing.Point(fallbackX, fallbackY); - } + // var screenPoint = new System.Windows.Point(winPoint.X, winPoint.Y); - var screenPoint = new System.Windows.Point(winPoint.X, winPoint.Y); + // presentationSource ??= PresentationSource.FromVisual(this); - presentationSource ??= PresentationSource.FromVisual(this); + // if (presentationSource?.CompositionTarget != null) + // { + // screenPoint = presentationSource.CompositionTarget.TransformFromDevice.Transform(screenPoint); + // } - if (presentationSource?.CompositionTarget != null) - { - screenPoint = presentationSource.CompositionTarget.TransformFromDevice.Transform(screenPoint); - } + // var localPoint = this.PointFromScreen(screenPoint); - var localPoint = this.PointFromScreen(screenPoint); + // var hitTestRect = new System.Windows.Rect(0, 0, this.ActualWidth, this.ActualHeight); - var hitTestRect = - new System.Windows.Rect( - 0, - 0, - this.ActualWidth, - this.ActualHeight); - - return hitTestRect.Contains(localPoint); - } + // return hitTestRect.Contains(localPoint); + //} } diff --git a/src/Wpf.Ui/Extensions/UiElementExtensions.cs b/src/Wpf.Ui/Extensions/UiElementExtensions.cs index 441fcf0f6..4f82824a9 100644 --- a/src/Wpf.Ui/Extensions/UiElementExtensions.cs +++ b/src/Wpf.Ui/Extensions/UiElementExtensions.cs @@ -22,11 +22,23 @@ public static bool IsMouseOverElement(this UIElement element, IntPtr lParam) try { var mousePosScreen = new Point(Get_X_LParam(lParam), Get_Y_LParam(lParam)); - - return new Rect(default, element.RenderSize).Contains(element.PointFromScreen(mousePosScreen)) && element.IsHitTestVisible && - (!(element is System.Windows.Controls.Panel panel) || // If element is Panel, check if children at mousePosRelative is with IsHitTestVisible false. - (panel.Children.OfType().FirstOrDefault(child => new Rect(default, child.RenderSize).Contains(child.PointFromScreen(mousePosScreen))) - ?.IsHitTestVisible ?? false)); + + return new Rect(default, element.RenderSize).Contains(element.PointFromScreen(mousePosScreen)) + && element.IsHitTestVisible + && ( + !(element is System.Windows.Controls.Panel panel) + || // If element is Panel, check if children at mousePosRelative is with IsHitTestVisible false. + ( + panel + .Children.OfType() + .FirstOrDefault(child => + new Rect(default, child.RenderSize).Contains( + child.PointFromScreen(mousePosScreen) + ) + ) + ?.IsHitTestVisible ?? false + ) + ); } catch { diff --git a/src/Wpf.Ui/Interop/User32.cs b/src/Wpf.Ui/Interop/User32.cs index ffc967ed6..289c816da 100644 --- a/src/Wpf.Ui/Interop/User32.cs +++ b/src/Wpf.Ui/Interop/User32.cs @@ -1450,9 +1450,9 @@ [In] IntPtr lParam [DllImport(Libraries.User32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetCursorPos([Out] out WinDef.POINT lpPoint); + [DllImport(Libraries.User32, SetLastError = true)] - public static extern bool GetCursorPos(out System.Drawing.Point lpPoint); - + public static extern bool GetCursorPos(out System.Drawing.Point lpPoint); [DllImport(Libraries.User32)] public static extern bool UnionRect(out WinDef.RECT rcDst, ref WinDef.RECT rc1, ref WinDef.RECT rc2); diff --git a/src/Wpf.Ui/Markup/Design.cs b/src/Wpf.Ui/Markup/Design.cs index 35f6915dc..d0357ffe8 100644 --- a/src/Wpf.Ui/Markup/Design.cs +++ b/src/Wpf.Ui/Markup/Design.cs @@ -20,12 +20,7 @@ namespace Wpf.Ui.Markup; /// public static class Design { - private static readonly string[] DesignProcesses = - [ - "devenv", - "dotnet", - "RiderWpfPreviewerLauncher64" - ]; + private static readonly string[] DesignProcesses = ["devenv", "dotnet", "RiderWpfPreviewerLauncher64"]; private static bool? _inDesignMode; @@ -38,9 +33,11 @@ public static class Design DependencyPropertyDescriptor .FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)) .Metadata.DefaultValue - || DesignProcesses.Any(process => System - .Diagnostics.Process.GetCurrentProcess() - .ProcessName.StartsWith(process, StringComparison.Ordinal)); + || DesignProcesses.Any(process => + System + .Diagnostics.Process.GetCurrentProcess() + .ProcessName.StartsWith(process, StringComparison.Ordinal) + ); public static readonly DependencyProperty BackgroundProperty = DependencyProperty.RegisterAttached( "Background",