Skip to content

fix(macOS): external trackpad handle#22629

Open
ajpinedam wants to merge 7 commits intounoplatform:masterfrom
ajpinedam:fix/macOS.external.trackpad.handle
Open

fix(macOS): external trackpad handle#22629
ajpinedam wants to merge 7 commits intounoplatform:masterfrom
ajpinedam:fix/macOS.external.trackpad.handle

Conversation

@ajpinedam
Copy link
Contributor

@ajpinedam ajpinedam commented Feb 11, 2026

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:

Other information ℹ️

@ajpinedam ajpinedam self-assigned this Feb 11, 2026
Copilot AI review requested due to automatic review settings February 11, 2026 05:15
@github-actions github-actions bot added the platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform label Feb 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@unodevops
Copy link
Contributor

🤖 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

@ajpinedam ajpinedam force-pushed the fix/macOS.external.trackpad.handle branch from 2e18cda to 5825a18 Compare February 11, 2026 06:09
@unodevops
Copy link
Contributor

🤖 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

@unodevops
Copy link
Contributor

⚠️⚠️ The build 195779 has failed on Uno.UI - CI.

Copilot AI review requested due to automatic review settings February 13, 2026 16:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@unodevops
Copy link
Contributor

🤖 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-actions github-actions bot added the area/automation Categorizes an issue or PR as relevant to project automation label Feb 13, 2026
@unodevops
Copy link
Contributor

🤖 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>
Copilot AI review requested due to automatic review settings February 13, 2026 18:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@unodevops
Copy link
Contributor

🤖 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>
Copilot AI review requested due to automatic review settings February 13, 2026 18:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@unodevops
Copy link
Contributor

🤖 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

@ajpinedam ajpinedam marked this pull request as ready for review February 13, 2026 21:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +980 to +982
// We trust AppKit and reset our counters.
if (mask != 0 && ((uint32)NSEvent.pressedMouseButtons) == 0) {
mask = [MouseButtons buttonMask:event];
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
// 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];
}

Copilot uses AI. Check for mistakes.
@unodevops
Copy link
Contributor

🤖 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

@unodevops
Copy link
Contributor

⚠️⚠️ The build 196301 has failed on Uno.UI - CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants