[0.6.x] Fix modifier key binding with mouse events on macOS#4233
Conversation
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.
It does, but it's not guaranteed on all tablets yet. You should be resetting these in |
|
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. |
|
Ah, can you check if the report is an |
gonX
left a comment
There was a problem hiding this comment.
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.
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.