Skip to content

Conversation

@AkiSakurai
Copy link
Contributor

The previous approach relied on an undocumented flag to automatically preserve active modifier states in synthetic CGEvent mouse events. However, this flag has no effect on synthetic keyboard events, leading to modifier bindings (e.g., Ctrl+Click) to fail because the modifier states were not properly passed to the CGEvent.

To resolve this, manually set the CGEvent flags to the current keyboard modifiers when modifier binding is active; otherwise, use the ~0U auto-preserve flag, ensuring modifiers are effectively applied on both synthetic or physical modifier states.

Note: The current implementation in OpenTabletDriver lacks a mechanism to cancel modifier bindings when a pen button is clicked and the pen is dragged outside the tablet area. This can result in sticky modifier states (e.g., a persistent Shift key) if the user has configured a modifier like Shift on a pen button and drags the pen off the tablet.

The previous approach relied on an undocumented flag to automatically preserve active modifier states in synthetic CGEvent mouse events. However, this flag has no effect on synthetic keyboard events, leading to modifier bindings (e.g., Ctrl+Click) to fail because the modifier states were not properly passed to the CGEvent.

To resolve this, manually set the CGEvent flags to the current keyboard modifiers when modifier binding is active; otherwise, use the ~0U auto-preserve flag, ensuring modifiers are effectively applied on both synthetic or physical modifier states.

Note: The current implementation in OpenTabletDriver lacks a mechanism to cancel modifier bindings when a pen button is clicked and the pen is dragged outside the tablet area. This can result in sticky modifier states (e.g., a persistent Shift key) if the user has configured a modifier like Shift on a pen button and drags the pen off the tablet.
@github-actions github-actions bot added macos Affects the MacOS platform desktop OpenTabletDriver.Desktop library, UX and Daemon use this as the core implementation. labels Oct 14, 2025
@gonX
Copy link
Member

gonX commented Oct 14, 2025

Note: The current implementation in OpenTabletDriver lacks a mechanism to cancel modifier bindings when a pen button is clicked and the pen is dragged outside the tablet area. This can result in sticky modifier states (e.g., a persistent Shift key) if the user has configured a modifier like Shift on a pen button and drags the pen off the tablet.

It does, but it's not guaranteed on all tablets yet. You should be resetting these in Reset() on the ISynchronousPointer interface of the output mode.

@AkiSakurai
Copy link
Contributor Author

I'm not sure if resetting in ISynchronousPointer is a good idea. It's more or less an ad-hoc solution because it bypasses the state binding, and the state binding is still active. I would rather change the binding state; after all, the binding action might not even be a pointer event. For example, it could trigger the display of an on-screen menu, like in the Wacom driver.

@gonX
Copy link
Member

gonX commented Oct 14, 2025

Ah, can you check if the report is an OutOfRangeReport instead then? It's what's used to hit the reset code path in the output mode.

Copy link
Member

@gonX gonX left a comment

Choose a reason for hiding this comment

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

LGTM. I had a hunch that local modifiers wouldn't get passed through so I guess I'll just speak up next time I approve a macOS PR.

@gonX gonX merged commit c5e8b70 into OpenTabletDriver:0.6.x Oct 15, 2025
12 checks passed
@gonX gonX added this to the v0.6.6.2 milestone Oct 15, 2025
@gonX gonX added the needs-forward-port PR or its features needs to be ported to development branch label Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop OpenTabletDriver.Desktop library, UX and Daemon use this as the core implementation. macos Affects the MacOS platform needs-forward-port PR or its features needs to be ported to development branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants