xdg-activation-v1: add token timeout

There isn't always a good time to prune old tokens. Compositors
which only implement a "give focus on activation" logic can prune
tokens on focus change. However other compositors might want to
implement other semantics, e.g. "mark urgent on activation". In this
case a focus change shouldn't invalidate other tokens.

Additionally, some tokens aren't necessarily tied to a seat.

To avoid ending up with an ever-growing list of tokens, add a timeout.
This commit is contained in:
Simon Ser 2021-06-01 11:29:10 +02:00
parent 8ff435831f
commit 76f51a949f
2 changed files with 26 additions and 1 deletions

View file

@ -26,12 +26,14 @@ struct wlr_xdg_activation_token_v1 {
char *token;
struct wl_resource *resource; // can be NULL
struct wl_event_source *timeout; // can be NULL
struct wl_listener seat_destroy;
struct wl_listener surface_destroy;
};
struct wlr_xdg_activation_v1 {
uint32_t token_timeout_msec; // token timeout in milliseconds (0 to disable)
struct wl_list tokens; // wlr_xdg_activation_token_v1.link