aboutsummaryrefslogtreecommitdiffstats
path: root/sway/xdg_activation_v1.c
diff options
context:
space:
mode:
authorLibravatar Aleksei Bavshin <alebastr89@gmail.com>2023-12-26 22:26:02 -0800
committerLibravatar Ronan Pigott <ronan@rjp.ie>2024-02-17 00:54:30 -0700
commitd19810eba8959f052d91fd6609cef6adf36b3951 (patch)
tree90b727f8cb792b06bf9aa1cc527d254c6c23edbf /sway/xdg_activation_v1.c
parentlauncher: track the seat in the launcher ctx (diff)
downloadsway-d19810eba8959f052d91fd6609cef6adf36b3951.tar.gz
sway-d19810eba8959f052d91fd6609cef6adf36b3951.tar.zst
sway-d19810eba8959f052d91fd6609cef6adf36b3951.zip
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/xdg_activation_v1.c')
-rw-r--r--sway/xdg_activation_v1.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sway/xdg_activation_v1.c b/sway/xdg_activation_v1.c
index 72c7fa4c..b7c80dd4 100644
--- a/sway/xdg_activation_v1.c
+++ b/sway/xdg_activation_v1.c
@@ -44,8 +44,11 @@ void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
44 seat = ctx->token->seat ? ctx->token->seat->data : NULL; 44 seat = ctx->token->seat ? ctx->token->seat->data : NULL;
45 } 45 }
46 46
47 if (seat) { 47 if (seat && ctx->had_focused_surface) {
48 view_request_activate(view, seat); 48 view_request_activate(view, seat);
49 } else {
50 // The token is valid, but cannot be used to activate a window
51 view_request_urgent(view);
49 } 52 }
50} 53}
51 54