fix(macOS): external trackpad handle#22629
fix(macOS): external trackpad handle#22629ajpinedam wants to merge 7 commits intounoplatform:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts macOS (Skia) mouse button state reporting to better handle macOS 15+ external trackpads where NSEvent.pressedMouseButtons can be incorrect, by incorporating Quartz button state into the decision logic.
Changes:
- Always compute a Quartz (CoreGraphics) mouse-button mask and use it to decide when to reset tracked button state.
- Change reset behavior to only clear tracked state when both AppKit and Quartz report no pressed buttons.
- When there is no tracked state, return AppKit’s mask if non-zero, otherwise fall back to Quartz.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/MouseButtons.m
Outdated
Show resolved
Hide resolved
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/MouseButtons.m
Outdated
Show resolved
Hide resolved
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/MouseButtons.m
Outdated
Show resolved
Hide resolved
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22629/wasm-skia-net9/index.html |
2e18cda to
5825a18
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22629/wasm-skia-net9/index.html |
|
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOWindow.m
Outdated
Show resolved
Hide resolved
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOWindow.m
Outdated
Show resolved
Hide resolved
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOWindow.m
Outdated
Show resolved
Hide resolved
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOWindow.m
Outdated
Show resolved
Hide resolved
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOWindow.m
Outdated
Show resolved
Hide resolved
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/MouseButtons.m
Outdated
Show resolved
Hide resolved
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22629/wasm-skia-net9/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22629/wasm-skia-net9/index.html |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...plesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_MouseEvents.xaml.cs
Outdated
Show resolved
Hide resolved
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/MouseButtons.h
Outdated
Show resolved
Hide resolved
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22629/wasm-skia-net9/index.html |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...plesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_MouseEvents.xaml.cs
Show resolved
Hide resolved
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22629/wasm-skia-net9/index.html |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...plesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_MouseEvents.xaml.cs
Show resolved
Hide resolved
| // We trust AppKit and reset our counters. | ||
| if (mask != 0 && ((uint32)NSEvent.pressedMouseButtons) == 0) { | ||
| mask = [MouseButtons buttonMask:event]; |
There was a problem hiding this comment.
The logic here has a potential issue. When mask != 0 && NSEvent.pressedMouseButtons == 0, this code calls buttonMask:event which resets ALL button depths to 0 and then tracks only the current event. However, if the current event is not a mouse button event (e.g., it's a mouse move event), tracking it won't restore any button state, and the mask will return 0. This is correct if we genuinely missed a MouseUp. But if NSEvent.pressedMouseButtons is simply unreliable (as the FIXME comment suggests for Sequoia with external trackpads), this reset could incorrectly clear valid button state during non-button events. Consider whether the reset should only happen for specific event types or if there's a better way to handle the Sequoia trackpad inconsistency.
| // We trust AppKit and reset our counters. | |
| if (mask != 0 && ((uint32)NSEvent.pressedMouseButtons) == 0) { | |
| mask = [MouseButtons buttonMask:event]; | |
| // We trust AppKit and reset our counters, but only when handling a mouse button event. | |
| if (mask != 0 && ((uint32)NSEvent.pressedMouseButtons) == 0) { | |
| NSEventType type = event.type; | |
| BOOL isMouseButtonEvent = | |
| type == NSEventTypeLeftMouseDown || | |
| type == NSEventTypeLeftMouseUp || | |
| type == NSEventTypeRightMouseDown || | |
| type == NSEventTypeRightMouseUp || | |
| type == NSEventTypeOtherMouseDown || | |
| type == NSEventTypeOtherMouseUp || | |
| type == NSEventTypeLeftMouseDragged || | |
| type == NSEventTypeRightMouseDragged|| | |
| type == NSEventTypeOtherMouseDragged; | |
| if (isMouseButtonEvent) { | |
| mask = [MouseButtons buttonMask:event]; | |
| } |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22629/wasm-skia-net9/index.html |
|
|
GitHub Issue: closes #
PR Type:
What is the current behavior? 🤔
What is the new behavior? 🚀
PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information ℹ️