X Tutup
Skip to content

Wayland: Misc keyboard touchups#113256

Merged
akien-mga merged 3 commits intogodotengine:masterfrom
deralmas:wl-keyboard-stuff
Dec 16, 2025
Merged

Wayland: Misc keyboard touchups#113256
akien-mga merged 3 commits intogodotengine:masterfrom
deralmas:wl-keyboard-stuff

Conversation

@deralmas
Copy link
Contributor

This PR is a patchset, it should not be squashed.

It introduces a bunch of tiny fixes (few lines each) to the Wayland keyboard implementation that I didn't feel were worth as separate PRs.

Each commit is properly formatted with a message but here's the tl;dr and some extra info:

Wayland: Fix SIGFPE with repeat rate of 0

You can disable key repetition by setting the rate to 0, classic divide-by-zero.

Confimed before-and-after on sway with sway input * repeat_rate 0.

Wayland: Add default keyboard repetition values

It is technically possible to have a compositor so old that it doesn't support the repeat_info event. Let's add some useful default values for key repetition (instead of 0), just in case.

Confirmed that it works on Weston with this patch:

--- a/libweston/input.c
+++ b/libweston/input.c
@@ -4330,7 +4330,7 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
 	wl_signal_init(&seat->tablet_tool_added_signal);
 
 	seat->global = wl_global_create(ec->wl_display, &wl_seat_interface,
-					MIN(wl_seat_interface.version, 7),
+					MIN(wl_seat_interface.version, 3),
 					seat, bind_seat);
 
 	seat->compositor = ec;

Also double-checked that the existing wl_keyboard::repeat_info logic still works on sway, with sway input * repeat_rate 10.

Destroy XKB keymap and state on seat capability change

I forgor 💀

Luckily it eventually cleaned up anyways, but y'know.


They should all hopefully be cherry-pickable to 4.5. The SIGFPE one is particularly important.

I'm also planning to do some other changes (wl_keyboard version 10, key handling logic consolidation), but I think that those are juicy enough for their own PR.

deralmas and others added 3 commits November 27, 2025 22:37
We always divided by the rate, which could be zero, which is a valid
value (it means "disable key repeating").
The `wl_keyboard::repeat_info` event got introduced in version 4. On
versions older than that, we defaulted to 0 delay, which means no
repetition. That's a veeery old version and basically everything offers
it, but it doesn't hurt to add a reasonable default.
Wasn't that much of a concern as it would have been disposed of next
time a keyboard got added, but it's still a good thing to do.
@deralmas deralmas requested a review from a team as a code owner November 27, 2025 22:46
@deralmas deralmas marked this pull request as draft November 27, 2025 22:47
@akien-mga akien-mga added the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Nov 27, 2025
@akien-mga akien-mga added this to the 4.6 milestone Nov 27, 2025
@deralmas deralmas marked this pull request as ready for review November 27, 2025 22:53
@deralmas
Copy link
Contributor Author

deralmas commented Nov 27, 2025

Ok nevermind sorry for the flip-flop draft, I looked at my todo list and found another keyboard fix pending, but either I forgot what I meant or I was wrong xD

Worst case I'll do it in another PR :P

@akien-mga akien-mga merged commit 61b5f80 into godotengine:master Dec 16, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 4.5.2.

@akien-mga akien-mga removed the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup