diff --git a/CHANGELOG.md b/CHANGELOG.md index 95aaab07..0b11bbc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -123,6 +123,8 @@ causing a crash (double-free) on exit ([#1259][1259]). * Double-width glyphs glitching when surrounded by glyphs overflowing into the double-width glyph ([#1256][1256]). +* Wayland protocol violation when ack:ing a configure event for an + unmapped surface ([#1249][1249]). [1173]: https://codeberg.org/dnkl/foot/issues/1173 [1190]: https://codeberg.org/dnkl/foot/issues/1190 @@ -131,6 +133,7 @@ [1218]: https://codeberg.org/dnkl/foot/issues/1218 [1259]: https://codeberg.org/dnkl/foot/issues/1259 [1256]: https://codeberg.org/dnkl/foot/issues/1256 +[1249]: https://codeberg.org/dnkl/foot/issues/1249 ### Security diff --git a/wayland.c b/wayland.c index 55d45da7..68a7a4f1 100644 --- a/wayland.c +++ b/wayland.c @@ -769,6 +769,16 @@ xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, struct wl_window *win = data; struct terminal *term = win->term; + if (win->unmapped) { + /* + * https://codeberg.org/dnkl/foot/issues/1249 + * https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3487 + * https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3719 + * https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/108 + */ + return; + } + bool wasnt_configured = !win->is_configured; bool was_resizing = win->is_resizing; bool csd_was_enabled = win->csd_mode == CSD_YES && !win->is_fullscreen; @@ -1619,6 +1629,7 @@ wayl_win_destroy(struct wl_window *win) wayl_roundtrip(win->term->wl); /* Main window */ + win->unmapped = true; wl_surface_attach(win->surface, NULL, 0, 0); wl_surface_commit(win->surface); wayl_roundtrip(win->term->wl); diff --git a/wayland.h b/wayland.h index e86c6a3d..4b6939ab 100644 --- a/wayland.h +++ b/wayland.h @@ -327,6 +327,7 @@ struct wl_window { tll(struct xdg_activation_token_context *) xdg_tokens; bool urgency_token_is_pending; #endif + bool unmapped; struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;