AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology

Home Page:https://avaloniaui.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PointerMovedEvent and PointerReleasedEvent do not trigger after mouse leaves the title bar with pressed

huangliu opened this issue · comments

Describe the bug

I add a contorl to the titlebar, and add Handlers PointerPressedEvent/PointerMovedEvent/PointerReleasedEvent/PointerCaptureLostEvent. When I press/move/release mouse left button over the control, all events trigger as expected.

If I just press mouse and move out the titlebar, PointerMovedEvent will not trigger, unless I release the left button. PointerReleasedEvent does not trigger at this point, and e.GetCurrentPoint(this).Properties.IsLeftButtonPressed still return true in PointerMovedEvent event, until I press left button and release next time.

But If I remove property OSXThickTitleBar from ExtendClientAreaChromeHints, everything works well.

Here is a demo video:

iShot_2024-05-12_01.01.30.mp4

Here is the other demo which works perfect when I just remove OSXThickTitleBar property from ExtendClientAreaChromeHints:

iShot_2024-05-12_01.27.21.mp4

To Reproduce

  1. Set window properties ExtendClientAreaToDecorationsHint="True" / ExtendClientAreaTitleBarHeightHint="38" / ExtendClientAreaChromeHints="Default,OSXThickTitleBar"
  2. Add a control to the top, use the following code to listen for events
this.AddHandler(PointerPressedEvent, this.OnPointerPressed, RoutingStrategies.Tunnel);
this.AddHandler(PointerMovedEvent, this.OnPointerMove, RoutingStrategies.Tunnel);
this.AddHandler(PointerReleasedEvent, this.OnPointerReleased, RoutingStrategies.Tunnel);
this.AddHandler(PointerCaptureLostEvent, this.OnPointerCaptureLost, RoutingStrategies.Tunnel);
  1. Press the control with mouse left button, and move out from titlebar, but don't leave the window.

Expected behavior

No response

Avalonia version

11.0.10

OS

macOS

Additional context

No response

After move out of titlebar with mouse left button hold on, no more PointerMoved event triggered, if OSXThickTitleBar is set.