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

Tripled key inputs after wake from sleep using "prefer Wayland" #95144

Closed
Tracked by #88346
eobet opened this issue Aug 4, 2024 · 4 comments · Fixed by #95331
Closed
Tracked by #88346

Tripled key inputs after wake from sleep using "prefer Wayland" #95144

eobet opened this issue Aug 4, 2024 · 4 comments · Fixed by #95331

Comments

@eobet
Copy link
Contributor

eobet commented Aug 4, 2024

Tested versions

4.3 rc2

System information

Godot v4.3.rc2 - Nobara Linux 40 (GNOME Edition) - Wayland - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3050 Ti Laptop GPU - 11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz (8 Threads)

Issue description

This is me typing "test" after opening the lid on my laptop with "prefer wayland" toggled on:

Screenshot from 2024-08-04 20-10-18

This does not always happen, but has never happened with "prefer wayland" toggled off.

No other application is affected by this (as evident from me typing this).

Typing functionality in Godot can be returned to normal by restarting the editor.

Steps to reproduce

  • Use a laptop with Linux.
  • Toggle the "prefer Wayland" option on in Godot & restart.
  • Put the laptop to sleep.
  • ???
  • Type something in the Godot editor.

Minimal reproduction project (MRP)

N/A

@Riteo
Copy link
Contributor

Riteo commented Aug 5, 2024

Sorry, I'm currently on vacation, so I have limited testing capabilities. I can't reproduce this on sway, with commit e343dbb (not the latest but that's what I had on hand).

Perhaps the keyboard objects aren't being cleaned up or something, not sure. Could you attach a debug Wayland log? The incantation is the usual: WAYLAND_DEBUG=1 godot --verbose > wayland.log 2>&1

@eobet
Copy link
Contributor Author

eobet commented Aug 7, 2024

Here is the log.

During the session, I typed "test" into the scene search then cleared it. Closed the lid on the laptop for a while. Opened it and again typed "test" into the search (and saw "ttteeesssttt", cleared it and closed Godot.

waylanddebug.log

@Riteo
Copy link
Contributor

Riteo commented Aug 7, 2024

Thank you! It indeed looks like three keyboard objects are coexisting:

[1736003.781] wl_keyboard@132.key(107020, 69004954, 20, 1)
[1736003.861] wl_keyboard@126.key(107020, 69004954, 20, 1)
[1736003.894] wl_keyboard@33.key(107020, 69004954, 20, 1)

Curiously, none of those IDs match the keyboard used before suspending (wl_keyboard@29).

The issue seems to stem from GNOME reporting the available input devices ("capabilities") multiple times, perhaps from a sequential power up:

[1729947.857] wl_seat@13.capabilities(2)
[1729947.907]  -> wl_seat@13.get_keyboard(new id wl_keyboard@33)
[1729947.939] wl_seat@13.capabilities(6)
[1729947.964]  -> wl_seat@13.get_keyboard(new id wl_keyboard@126)
[1729947.991] wl_seat@13.capabilities(7)
[1729948.069]  -> wl_seat@13.get_keyboard(new id wl_keyboard@132)

(the above is shortened for convenience)

The compositor is doing a perfectly normal thing, but we just keep recreating keyboards every time we get a capabilities event with a keyboard in it. I'm actually quite surprised this didn't pop up sooner. I'll soon add some checks to avoid duplicate objects.

Note that I'm still on vacation, so I might be a tad slower at sending a patch. I'll see what I can do.

@eobet
Copy link
Contributor Author

eobet commented Aug 8, 2024

Vacation is more important than fixing bugs! 🤍

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