Skip to content

Fix stylus hover button handling - #1246

Open
CodeDoctorDE wants to merge 1 commit into
developfrom
bug/use-hover-buttons
Open

CodeDoctorDE wants to merge 1 commit into
developfrom
bug/use-hover-buttons

Conversation

@CodeDoctorDE

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The merged stylus button state is not propagated to shortcut detection and handler callbacks that still observe the raw event.buttons, leaving the fix incomplete for stylus shortcuts/consumers.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR aims to fix stylus barrel-button handling by preserving stylus hover button state and merging it into subsequent pointer-down handling so stylus button presses can be recognized even when PointerDownEvent.buttons is reported as 0.

Changes:

  • Added mergeStylusButtonState helper to combine stylus hover button state with pointer-down button state.
  • Tracked stylus hover button state per device and used it to compute an “effective buttons” mask on pointer down.
  • Routed onPointerHover through the input coordinator and added a unit test validating the merge behavior.
File summaries
File Description
app/test/services/pointer_shortcuts_test.dart Adds unit test coverage for mergeStylusButtonState.
app/lib/views/view/input.dart Tracks stylus hover button state and merges it into pointer-down button handling.
app/lib/views/view/content.dart Delegates hover events to the input coordinator for centralized handling.
app/lib/cubits/settings.dart Introduces mergeStylusButtonState utility used by input handling (and tested).
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 76 to +80
_pointerKinds[event.pointer] = event.kind;
final effectiveButtons = mergeStylusButtonState(
kind: event.kind,
eventButtons: event.buttons,
hoverButtons: _stylusHoverButtonState[event.device] ?? 0,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants