aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2026-08-29 17:28:39 +0000
committerDaniel Eklöf <daniel@ekloef.se>2026-08-29 17:28:39 +0000
commit14cd25d4b17408fb09f395b03a5eab0628c7d725 (patch)
tree7f7140f95bdf081f4c384fe2a7e28398e38f591e
parentAdd support for file:// URLs for initial working directory (diff)
input: ignore keyboard_enter() with NULL surface
It's a compositor bug to emit a keyboard_enter() event with a NULL surface, but has been seen happening on Hyprland. Workaround by ignoring the event. Closes #2438
-rw-r--r--CHANGELOG.md3
-rw-r--r--input.c6
2 files changed, 8 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e3650d56..bfff027d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -141,6 +141,8 @@
* Crash when closing a window that touch input focus.
* Application mouse grabbing not working when there is no keymap
available.
+* Crash when a buggy compositor sends a `keyboard_enter()` event with
+ a `NULL` surface ([#2438][2438]).
[2353]: https://codeberg.org/dnkl/foot/issues/2353
[2352]: https://codeberg.org/dnkl/foot/issues/2352
@@ -153,6 +155,7 @@
[2397]: https://codeberg.org/dnkl/foot/issues/2397
[2411]: https://codeberg.org/dnkl/foot/issues/2411
[2405]: https://codeberg.org/dnkl/foot/issues/2405
+[2438]: https://codeberg.org/dnkl/foot/issues/2438
### Security
diff --git a/input.c b/input.c
index 6a829a70..74cd320f 100644
--- a/input.c
+++ b/input.c
@@ -704,9 +704,13 @@ static void
keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
struct wl_surface *surface, struct wl_array *keys)
{
- xassert(surface != NULL);
xassert(serial != 0);
+ if (unlikely(surface == NULL)) {
+ /* Seen on Hyprland */
+ return;
+ }
+
struct seat *seat = data;
struct wl_window *win = wl_surface_get_user_data(surface);
struct terminal *term = win->term;