Skip to content

Fix #1112: simultaneous key presses being dropped#1472

Closed
LunaRood wants to merge 2 commits intoglfw:masterfrom
LunaRood:fix1112
Closed

Fix #1112: simultaneous key presses being dropped#1472
LunaRood wants to merge 2 commits intoglfw:masterfrom
LunaRood:fix1112

Conversation

@LunaRood
Copy link
Copy Markdown

This improves the mechanism to check for duplicate key press events, by
checking if the event with the same time code actually corresponds to
the same key.

This will correctly process any key known to GLFW, handling simultanous
presses of different keys, while still filtering out duplicate presses
of the same key.

Note that this still does not properly handle keys that are
GLFW_KEY_UNKNOWN, as I am not aware of a good way to check for previous
events on those keys.

This improves the mechanism to check for duplicate key press events, by
checking if the event with the same time code actually corresponds to
the same key.

This will correctly process any key known to GLFW, handling simultanous
presses of different keys, while still filtering out duplicate presses
of the same key.

Note that this still does not properly handle keys that are
GLFW_KEY_UNKNOWN, as I am not aware of a good way to check for previous
events on those keys.
@linkmauve linkmauve added bug Bug reports and bugfix pull requests X11 labels Sep 18, 2019
@elmindreda elmindreda self-assigned this Oct 16, 2019
@smldis
Copy link
Copy Markdown

smldis commented Nov 4, 2019

Any progress? I am hitting this on Julia GLFW bindings package

@kiroma
Copy link
Copy Markdown

kiroma commented Dec 11, 2019

What's the status on this?

@kiroma
Copy link
Copy Markdown

kiroma commented Dec 13, 2019

Update? I think this is far too simple of a fix for a far too annoying of a bug.

@elmindreda elmindreda added the input Keyboard, joystick or mouse label Jan 20, 2020
@kiroma
Copy link
Copy Markdown

kiroma commented Feb 7, 2020

update?

@Brokkonaut
Copy link
Copy Markdown

Any chance to get this pulled soon?

Copy link
Copy Markdown

@CerberPup CerberPup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on 6th of April 2020. Fixes issue with simultaneous key press https://bugs.mojang.com/browse/MC-122421 in minecraft 1.15.2

@elmindreda elmindreda added the verified Reproduced or otherwise verified bugs label Jun 30, 2020
@elmindreda elmindreda added this to the 3.3.3 milestone Jun 30, 2020
@elmindreda elmindreda closed this in 9a3664b Jul 2, 2020
@elmindreda
Copy link
Copy Markdown
Member

Thank you for this PR. This should be fixed now with 9a3664b, which is based on it.

elmindreda added a commit that referenced this pull request Jul 16, 2020
Background: The IM will filter out key events, instead sending exact
duplicate events that are not filtered.  It does not send these for
every event, however, so the duplicate events cannot be relied on for
key input.  Instead we need to identify and discard them.  Since they
are identical, they have the same timestamp as the originals.

The previous duplicate event detection would consume unrelated key
events if the keys were pressed simultaneously, as it only tracked
a single timestamp.

This fixes that issue for any combination of keys, at the expense of
a 1 KB array per GLFW window.

This fix is a stopgap until explicit IME support is done.

Based on #1472 by @LucaRood.

Fixes #1112.
Fixes #1415.
Fixes #1616.
Fixes #1663.
Closes #1472.

(cherry picked from commit 9a3664b)
Copy link
Copy Markdown

@hyperdregon hyperdregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it

swarnimarun pushed a commit to swarnimarun/glfw-meson that referenced this pull request Jul 9, 2022
Background: The IM will filter out key events, instead sending exact
duplicate events that are not filtered.  It does not send these for
every event, however, so the duplicate events cannot be relied on for
key input.  Instead we need to identify and discard them.  Since they
are identical, they have the same timestamp as the originals.

The previous duplicate event detection would consume unrelated key
events if the keys were pressed simultaneously, as it only tracked
a single timestamp.

This fixes that issue for any combination of keys, at the expense of
a 1 KB array per GLFW window.

This fix is a stopgap until explicit IME support is done.

Based on glfw#1472 by @LucaRood.

Fixes glfw#1112.
Fixes glfw#1415.
Fixes glfw#1616.
Fixes glfw#1663.
Closes glfw#1472.

(cherry picked from commit 9a3664b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug reports and bugfix pull requests input Keyboard, joystick or mouse verified Reproduced or otherwise verified bugs X11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants