-
Notifications
You must be signed in to change notification settings - Fork 28
Multikey-press behaves strangely depending on key up/down sequence #22
Comments
If I understand your explanation correctly, then I believe the first example is correct. Because if you lift up 'S' first, A is still |
I'm not very familiar with the windows API unfortunately, so I can't seem to find where the code is going wrong with this. Do you have any ideas? |
No ideas off the top of my head. I can't promise I'll have time to look at this soon, but I will try to get to it when I can. |
Don´t worry, I found myself a workaround. |
What is the workaround that you found? |
I did a little digging and I found this example also exhibits the same behavior. (Not surprisingly since this repository is a spitting image of the example). Something else that perhaps I do not fully understand, and therefore found confusing is that |
I created a daemon thread and an function which would wait till this thread outputs something |
Consider the following code which prints the event type, key, and list of currently pressed keys for a keyboard event.
When a key, 'a' for example, is held down, the output is:
key down A ['A']
and it is repeated until the key is released, which then yields a single output of:key up A []
.Now consider pressing the 'A' and 'S' Keys simultaneously. For the first example, consider holding 'A' first, then 'S', then letting go of 'A', then 'S'. The output is (in order, repeated if dots follow):
Now consider the case of releasing 'S' first instead. The output is (in order, repeated if dots follow):
Notice that the difference is that the
key down
event does not repeat for 'A' after 'S' has been released as was the case for 'S' in the first example. This can be generalized for the case when more than two buttons are pressed as well. In every case, if the last button that was pressed is released, the output stops repeating.This behavior is inconsistent, however I'm not sure what the intended behavior is. Do we define a keyboard event as a triggered event? Then holding a key down should not repeat output. Or do we define it as the state of the key? In that case the output should repeat for the key(s) being held and when one is released the other(s) should continue to repeat.
Do you have thoughts on what should be the proper output?
The text was updated successfully, but these errors were encountered: