Open tisonkun opened 7 months ago
For my use case, I may want only an API to get the current pressed key ..
This bug can be reproduced if I switch the command order, that is:
Key.cmd_r pressed, current_modifiers: {<Key.cmd_r: <54>>}
Key.cmd pressed, current_modifiers: {<Key.cmd: <55>>, <Key.cmd_r: <54>>}
Key.cmd pressed, current_modifiers: {<Key.cmd: <55>>, <Key.cmd_r: <54>>}
Thank you for your report.
Unfortunately I no longer have access to a macOS system, so I cannot test this, but reading through the code here reveals a possible cause; the modifier keys do not emit proper keyboard events, but only flag changed events, and this library uses heuristics to determine whether a key has been pressed or released. shift and ctrl should exhibit the same behaviour.
I am uncertain about how to proceed, as I have trouble finding any reasonable way to determine the pressed state.
Description
Platform and pynput version
To Reproduce
Keep the left command pressed, and press the right command and release it, then release the left command:
As you can see, two "Key.cmd_r pressed" events were emitted instead of a press and a release.