Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify window on mouseEntered (mac only) #15251

Merged
merged 3 commits into from
Jun 25, 2024

Conversation

ltetak
Copy link
Contributor

@ltetak ltetak commented Apr 5, 2024

What does the pull request do?

Fixes issue when Tooltip hides immediately on mac - see #13565 (comment)

What is the current behavior?

Tooltip flickers (hides) which should be solved by #13565 but it does not fix this for mac

What is the updated/expected behavior with this PR?

no flickering

cc: @grokys

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0046981-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0047044-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6
Copy link
Member

cc @grokys, not sure who else can review it.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0047582-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0048033-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@ltetak
Copy link
Contributor Author

ltetak commented May 10, 2024

To reiterate this problem. AFAIK there is no Avalonia equivalent for MouseEnter. There is only LeaveWindow (https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Base/Input/Raw/RawPointerEventArgs.cs#L9)
I guess this roots from the Windows API which does have WM_MOUSEMOVE + WM_MOUSELEAVE but does not have WM_MOUSEENTER (or equivalent) - do not mix this with WM_POINTERENTER and WM_POINTERLEAVE which handles non-mouse devices. In general, WM_MOUSEMOVE handles the "window enter" as well (the first time you receive this event you know you must be over the window. And you receive it immediately).
On Mac this is different. There is mouse handling for all three events (enter + move + leave). So they don't need to send the mouse-move event immediately after mouse-enter event. This creates a race condition in many cases (e.g. the ToolTip will hide since the mouse seems not to hover it yet).
That's why I think this solution maps well to the Windows behavior and should work fine in all cases.
cc: @grokys @maxkatz6

@ltetak
Copy link
Contributor Author

ltetak commented May 16, 2024

@Gillibald I think you are working with mac as well. Can you please take a look at this PR?

Copy link
Member

@grokys grokys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure that I'm the right person to review this, as I've not really been involved in mouse event handling in the macOS backend, but from what I can see I don't think it should cause problems, so giving it a tentative +1. Thanks @ltetak !

@maxkatz6 maxkatz6 merged commit b1e96ad into AvaloniaUI:master Jun 25, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants