Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressing SHIFT when holding ALT on windows emits a nil key event #1348

Closed
connorjclark opened this issue Jul 14, 2022 · 3 comments · Fixed by #1404
Closed

Pressing SHIFT when holding ALT on windows emits a nil key event #1348

connorjclark opened this issue Jul 14, 2022 · 3 comments · Fixed by #1404
Milestone

Comments

@connorjclark
Copy link
Contributor

connorjclark commented Jul 14, 2022

I found this bug because there's a command in my application that does something when SHIFT and ALT are held down. It works when first pressing SHIFT then holding ALT too, but not the other way around.

From debugging, I found that the second key event received when doing ALT then SHIFT is zero'd out and only has the ALT bit enabled in modifiers:

{type=11 source=0x00007ffe3bcf6d40 {allegro-5.2.dll!ALLEGRO_KEYBOARD the_keyboard} {...} timestamp=341.56358236244910 ...}
    type: 11
    source: 0x00007ffe3bcf6d40 {allegro-5.2.dll!ALLEGRO_KEYBOARD the_keyboard} {...}
    timestamp: 341.56358236244910
    display: 0x000001eed147f840 {...}
    keycode: 0
    unichar: 0
    modifiers: 4
    repeat: false

My expectation is that either modifiers would have the SHIFT bit enabled, or that (also?) keycode is set to the value for the shift key.

Perhaps related: #713

@connorjclark
Copy link
Contributor Author

Any pointers on where to start with this?

@EdgarReynaldo
Copy link
Contributor

EdgarReynaldo commented Sep 1, 2022 via email

@SiegeLord SiegeLord added this to the 5.2.9 milestone Jan 31, 2023
SiegeLord pushed a commit to SiegeLord/allegro5 that referenced this issue Feb 1, 2023
There were two issues.

1. Holding Shift + tapping Alt would send spurious Control(!?) key up messages.
I can reliably identify them by checking whether the repeat(aka previous) flag
is set. MSDN says it always should be 1, but it's 0 for these weird events.

2. Holding Alt + tapping Shift would set weird KEY_CHAR events. This evidently
can be fixed by sending the scan code to our event decoder from WM_SYSKEYDOWN
messages. I'm not sure why we didn't before.

Fixes liballeg#1348
SiegeLord pushed a commit to SiegeLord/allegro5 that referenced this issue Feb 1, 2023
There were two issues.

1. Holding Shift + tapping Alt would send spurious Control(!?) key up messages.
I can reliably identify them by checking whether the repeat(aka previous) flag
is set. MSDN says it always should be 1, but it's 0 for these weird events.

2. Holding Alt + tapping Shift would set weird KEY_CHAR events. This evidently
can be fixed by sending the scan code to our event decoder from WM_SYSKEYDOWN
messages. I'm not sure why we didn't before.

Fixes liballeg#1348
SiegeLord pushed a commit to SiegeLord/allegro5 that referenced this issue Feb 1, 2023
There were two issues.

1. Holding Shift + tapping Alt would send spurious Control(!?) key up messages.
I can reliably identify them by checking whether the repeat(aka previous) flag
is set. MSDN says it always should be 1, but it's 0 for these weird events.

2. Holding Alt + tapping Shift would set weird KEY_CHAR events. This evidently
can be fixed by sending the scan code to our event decoder from WM_SYSKEYDOWN
messages. I'm not sure why we didn't before.

Fixes liballeg#1348
SiegeLord pushed a commit to SiegeLord/allegro5 that referenced this issue Feb 1, 2023
There were two issues.

1. Holding Shift + tapping Alt would send spurious Control(!?) key up messages.
I can reliably identify them by checking whether the repeat(aka previous) flag
is set. MSDN says it always should be 1, but it's 0 for these weird events.

2. Holding Alt + tapping Shift would set weird KEY_CHAR events. This evidently
can be fixed by sending the scan code to our event decoder from WM_SYSKEYDOWN
messages. I'm not sure why we didn't before.

Fixes liballeg#1348
@SiegeLord
Copy link
Member

#1404 should fix the weird key event, but the fixed key down events don't have modifiers. Ctrl/Shift/Alt are pretty wonky keys, I'm not sure I can get modifiers for them.

SiegeLord pushed a commit that referenced this issue Feb 5, 2023
There were two issues.

1. Holding Shift + tapping Alt would send spurious Control(!?) key up messages.
I can reliably identify them by checking whether the repeat(aka previous) flag
is set. MSDN says it always should be 1, but it's 0 for these weird events.

2. Holding Alt + tapping Shift would set weird KEY_CHAR events. This evidently
can be fixed by sending the scan code to our event decoder from WM_SYSKEYDOWN
messages. I'm not sure why we didn't before.

Fixes #1348
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants