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

Fix quick shift key presses getting ignored on dinput driver #17185

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

schellingb
Copy link
Contributor

Description

The main issue with shift keys in the dinput driver on Windows is that when both shift keys are pressed simultaneously, the OS will not issue a WM_KEYUP for the one first pressed down. 4 years ago the PR #11543 fixed this by moving shift key event handling out of the windows message handler into the dinput polling function.

But because shift keys were now ignored in the event message handler and only issued during polling, a quick key press and release between two polls would get missed. This PR fixes this by having the event message handler still issue these key presses and only do the very special issuing of the missing shift key up event in the dinput polling upon simultaneous pressing of both shift keys. This way all key presses are caught no matter how quick they are.

This PR also fixes left alt up key events getting sent to the core twice.

One remaining issue is that the ALT-TAB handling is not yet perfect. If a user holds down any other key before pressing ALT-TAB, no up event will get issued for the keys already pressed before ALT until pressed and then released again while the window has focus again. A core can still work around this by manually querying any pressed keys during retro_run with input_state_cb to see if they are actually still down. DOSBox Pure does this. This should be rather rare though so fixing it doesn't have high priority.

Related Issues

Related Pull Requests

#11543

Reviewers

@sonninnos

Because shift keys were ignored in the event message  and only issued during polling, a quick key press and release between polling would get ignored.
This change also fixes left alt up key events getting issued (and sent to the core) twice.
@LibretroAdmin LibretroAdmin merged commit c039576 into libretro:master Nov 14, 2024
27 checks passed
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 this pull request may close these issues.

2 participants