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

"stuck" keys on xwayland #350

Open
c0h2r opened this issue Mar 10, 2024 · 5 comments
Open

"stuck" keys on xwayland #350

c0h2r opened this issue Mar 10, 2024 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@c0h2r
Copy link

c0h2r commented Mar 10, 2024

description

So, I have 2 xwayland windows (one is a terminal, and another one doesn't really matter). Then I exit the shell with <C-d> which closes the terminal, and 'd' gets kinda "stuck" (for the lack of a better word in my vocab) for all other xwayland windows I focus after that and until I press something else.

demo

untitled.mp4

Here I show the behavior on 2 instances of wezterm with enable_wayland = false specified in the config, but the same also goes for 2 sts or wezterm and brave (without the env vars that tell chromium stuff to run natively)

details

OS: NixOS
Cosmic-comp commit: probably 9cb1adb (i.e. the one in https://github.com/lilyinstarlight/nixos-cosmic/blob/d9f0cdbc53b3a602e9faea5b2efbe7804639cb3c/pkgs/cosmic-comp/package.nix)

@Drakulix
Copy link
Member

Oh that is a fun bug... thanks for reporting.

Initial guess what is causing this issue (more a note to myself): Application closes, cosmic-comp revokes focus from the window, we don't have a valid target to send keyboard events to, Xwayland never gets wl_keyboard::key-event for the released key. (It should however get the keyboard::leave event, but most likely doesn't do anything with it.)

Needs some more in-depth debugging and probably some workaround for release-events with long-running clients.

@WatchMkr WatchMkr moved this to Alpha 2 in COSMIC Epoch 1 May 21, 2024
@WatchMkr WatchMkr added this to the alpha 2 milestone May 21, 2024
@WatchMkr WatchMkr modified the milestones: alpha 2, alpha 3 Sep 17, 2024
@WatchMkr
Copy link

I'm unable to reproduce this bug. Can it be closed?

@WatchMkr WatchMkr added the bug Something isn't working label Jan 14, 2025
@WatchMkr WatchMkr removed this from the alpha 3 milestone Jan 14, 2025
@hgaiser
Copy link

hgaiser commented Jan 14, 2025

I still have this issue on alpha 5. If I run glxgears and exit by pressing Escape, then run glxgears again it closes immediately because it receives an Escape key event.

The same thing seems to happen in any XWayland application that can be closed by a key event. Ie. if I write an OpenCV image viewing application and add an option to exit through some key event, the same thing happens.

Small disclaimer: it seems to be XWayland applications only, but I'm not 100% sure. For example if I try to fix it by going to a Qt application, hit the stuck key, then glxgears still exits immediately. However what puzzles me is that I configured electron to run under Wayland, not XWayland 🤷

Let me know if you have some pointers in the code where I can put some debugging code to help resolve this issue.

@leviport
Copy link
Member

It can also be recreated with Chromium. If I close Chromium with Super + Q, relaunching it causes it to close immediately.

Another way to show the bug is to hold a letter key down while clicking the X button on the Chromium window. Then (with the key released) I can open Chromium again, and the URL bar starts filling up with the letter I was previously holding until I hit some keys again to send it new key release events.

@WatchMkr WatchMkr moved this to Alpha 5 in COSMIC Epoch 1 Jan 16, 2025
@WatchMkr WatchMkr moved this from Alpha 5 to Post-Current-Alpha ToDo in COSMIC Epoch 1 Jan 16, 2025
@WatchMkr WatchMkr added this to the alpha 7 milestone Jan 16, 2025
@hgaiser
Copy link

hgaiser commented Jan 16, 2025

@WatchMkr just curious if you've managed to reproduce the issue or if you need more information. I see the alpha 7 milestone has been added which is fine for me. It's a minor annoyance to be honest, but it definitely still exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Post-Current-Alpha ToDo
Development

No branches or pull requests

5 participants