فهرست منبع

fix hit testing.

Dan Walmsley 5 سال پیش
والد
کامیت
693487313d
1فایلهای تغییر یافته به همراه13 افزوده شده و 6 حذف شده
  1. 13 6
      src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs

+ 13 - 6
src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs

@@ -1,6 +1,5 @@
 using System;
 using System;
-using System.Collections.Generic;
-using System.Text;
+using System.Diagnostics;
 using Avalonia.Controls;
 using Avalonia.Controls;
 using Avalonia.Input;
 using Avalonia.Input;
 using static Avalonia.Win32.Interop.UnmanagedMethods;
 using static Avalonia.Win32.Interop.UnmanagedMethods;
@@ -34,6 +33,11 @@ namespace Avalonia.Win32
                 border_thickness = new RECT { bottom = 1, left = 1, right = 1, top = 1 };
                 border_thickness = new RECT { bottom = 1, left = 1, right = 1, top = 1 };
             }
             }
 
 
+            if (_extendTitleBarHint >= 0)
+            {
+                border_thickness.top = (int)(_extendedMargins.Top * Scaling);
+            }
+
             // Determine if the hit test is for resizing. Default middle (1,1).
             // Determine if the hit test is for resizing. Default middle (1,1).
             ushort uRow = 1;
             ushort uRow = 1;
             ushort uCol = 1;
             ushort uCol = 1;
@@ -86,11 +90,13 @@ namespace Avalonia.Win32
                 case WindowsMessage.WM_NCHITTEST:
                 case WindowsMessage.WM_NCHITTEST:
                     if (lRet == IntPtr.Zero)
                     if (lRet == IntPtr.Zero)
                     {
                     {
-                        lRet = (IntPtr)HitTestNCA(hWnd, wParam, lParam);
+                        var hittestResult = HitTestNCA(hWnd, wParam, lParam);
+
+                        lRet = (IntPtr)hittestResult;
 
 
                         uint timestamp = unchecked((uint)GetMessageTime());
                         uint timestamp = unchecked((uint)GetMessageTime());
 
 
-                        if (((HitTestValues)lRet) == HitTestValues.HTCAPTION)
+                        if (hittestResult == HitTestValues.HTCAPTION)
                         {
                         {
                             var position = PointToClient(PointFromLParam(lParam));
                             var position = PointToClient(PointFromLParam(lParam));
 
 
@@ -106,11 +112,12 @@ namespace Avalonia.Win32
 
 
                             if (visual != null)
                             if (visual != null)
                             {
                             {
-                                lRet = (IntPtr)HitTestValues.HTCLIENT;
+                                hittestResult = HitTestValues.HTCLIENT;
+                                lRet = (IntPtr)hittestResult;
                             }
                             }
                         }
                         }
 
 
-                        if (((HitTestValues)lRet) != HitTestValues.HTNOWHERE)
+                        if (hittestResult != HitTestValues.HTNOWHERE)
                         {
                         {
                             callDwp = false;
                             callDwp = false;
                         }
                         }