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

keys_pressed does not seem to accurately reflect the keys being pressed on Wayland #100879

Closed
pcvonz opened this issue Dec 28, 2024 · 3 comments · Fixed by #101848
Closed

keys_pressed does not seem to accurately reflect the keys being pressed on Wayland #100879

pcvonz opened this issue Dec 28, 2024 · 3 comments · Fixed by #101848

Comments

@pcvonz
Copy link

pcvonz commented Dec 28, 2024

Tested versions

System information

Manjaro Gnome Wayland

Issue description

Keys pressed seems to not be reset sometimes.

I noticed this issue because the method is_anything_pressed returns true when I was trying out the new tooltip feature, even it should be returning false.

if (!keys_pressed.is_empty() || !joy_buttons_pressed.is_empty() || !mouse_button_mask.is_empty()) {

Steps to reproduce

It seems like I can trigger it fairly consistently by searching and then opening a file in the filesystem browser.

Screencast.From.2024-12-28.12-58-29.mp4

Minimal reproduction project (MRP)

This is just a simple project with a tool script that calls is_anything_pressed
project.zip

@pcvonz
Copy link
Author

pcvonz commented Dec 31, 2024

Looking into this further.. It seems to be reproducible by:

  1. Pressing any key
  2. Pressing shift
  3. Releasing both keys

Some logging of the bug (print statements put in the if and else block of:

keys_pressed.insert(k->get_keycode());

INSERT: Minus 45
INSERT: Shift 4194325
ERASE: Shift+UnderScore 95
ERASE: Shift+Shift 4194325

@pcvonz pcvonz changed the title keys_pressed does not seem to accurately reflect the keys being pressed on Wayland keys_pressed does not seem to accurately reflect the keys being pressed ~on Wayland~ Jan 18, 2025
@pcvonz pcvonz changed the title keys_pressed does not seem to accurately reflect the keys being pressed ~on Wayland~ keys_pressed does not seem to accurately reflect the keys being pressed on Wayland Jan 18, 2025
@pcvonz
Copy link
Author

pcvonz commented Jan 18, 2025

I don't think this is a wayland issue. I have a PR open that moves away from using the keys_pressed set to detect if a key is pressed here. I'm not sure what the proper solution is for this issue. Maybe deriving the the set of keys pressed from physical_keys_pressed instead of attempting to keep track of them?

@Riteo
Copy link
Contributor

Riteo commented Jan 20, 2025

Hi @pcvonz, thanks for the report and for investigating! I did some further research and it looks like the issue actually does actually come from the Wayland backend. As you found out, the keycodes come "composed" with the various modifier keys, which should not happen (you can see that when using the X11 display driver). I just pushed a PR with a proposed fix over at #101848.

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

Successfully merging a pull request may close this issue.

4 participants