aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorAleksei Bavshin <alebastr89@gmail.com>2023-12-26 22:26:02 -0800
committerRonan Pigott <ronan@rjp.ie>2024-02-17 00:54:30 -0700
commitd19810eba8959f052d91fd6609cef6adf36b3951 (patch)
tree90b727f8cb792b06bf9aa1cc527d254c6c23edbf /sway/desktop
parentf6d22f8e6886edfeca3ecbb695b02079e81ce360 (diff)
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.
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/launcher.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sway/desktop/launcher.c b/sway/desktop/launcher.c
index 4a4255d7..0c02b997 100644
--- a/sway/desktop/launcher.c
+++ b/sway/desktop/launcher.c
@@ -216,6 +216,8 @@ struct launcher_ctx *launcher_ctx_create(struct wlr_xdg_activation_token_v1 *tok
ctx->fallback_name = strdup(fallback_name);
ctx->token = token;
ctx->node = node;
+ // Having surface set means that the focus check in wlroots has passed
+ ctx->had_focused_surface = token->surface != NULL;
ctx->node_destroy.notify = ctx_handle_node_destroy;
wl_signal_add(&ctx->node->events.destroy, &ctx->node_destroy);