wayland: throttle xdg activation token requests for window urgency

When XDG activation support was added to URL mode, we introduced a
regression, where it is possible to flood the Wayland socket with XDG
activation token requests.

Start foot with “foot -o bell.urgency=yes”, then run:

  while true; do echo -en ‘\a’; done

Finally, switch keyboard focus to another window. Foot crashes.

Throttle the token requests by limiting the number of outstanding
urgency token requests to 1.

Closes #1065
This commit is contained in:
Daniel Eklöf 2022-05-11 21:17:52 +02:00
parent fc67bff9c0
commit 200c5cbc79
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 16 additions and 3 deletions

View file

@ -319,6 +319,7 @@ struct wl_window {
struct xdg_toplevel *xdg_toplevel;
#if defined(HAVE_XDG_ACTIVATION)
tll(struct xdg_activation_token_context *) xdg_tokens;
bool urgency_token_is_pending;
#endif
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;