xdg-activation: distinguish activation and urgency requests

Check if the app that requested a token has provided a valid input
serial and a focused surface. Downgrade activation request to urgency
otherwise.

This is mostly in line with what other Wayland compositors decided to
do, and offers a better security than the original logic.

(cherry picked from commit d19810eba8)
This commit is contained in:
Aleksei Bavshin 2023-12-26 22:26:02 -08:00 committed by Simon Ser
parent d91779d647
commit b4800fbc90
5 changed files with 18 additions and 1 deletions

View file

@ -14,6 +14,7 @@ struct launcher_ctx {
struct wl_listener seat_destroy;
bool activated;
bool had_focused_surface;
struct sway_node *node;
struct wl_listener node_destroy;

View file

@ -277,6 +277,11 @@ void view_set_activated(struct sway_view *view, bool activated);
*/
void view_request_activate(struct sway_view *view, struct sway_seat *seat);
/*
* Called when the view requests urgent state
*/
void view_request_urgent(struct sway_view *view);
/**
* If possible, instructs the client to change their decoration mode.
*/