aboutsummaryrefslogtreecommitdiffstats
path: root/sway/xdg_activation_v1.c
diff options
context:
space:
mode:
authorLibravatar Ronan Pigott <ronan@rjp.ie>2024-02-07 16:13:25 -0700
committerLibravatar Ronan Pigott <ronan@rjp.ie>2024-02-17 00:54:30 -0700
commitf6d22f8e6886edfeca3ecbb695b02079e81ce360 (patch)
tree75cb3af1922edc274cd5d7a35d68810dbe86ffe4 /sway/xdg_activation_v1.c
parentDrop unnecessary includes from sway/server.h (diff)
downloadsway-f6d22f8e6886edfeca3ecbb695b02079e81ce360.tar.gz
sway-f6d22f8e6886edfeca3ecbb695b02079e81ce360.tar.zst
sway-f6d22f8e6886edfeca3ecbb695b02079e81ce360.zip
launcher: track the seat in the launcher ctx
This is a more suitable place to track the requesting seat, since we are able to respond appropriately to destroy notifications.
Diffstat (limited to 'sway/xdg_activation_v1.c')
-rw-r--r--sway/xdg_activation_v1.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sway/xdg_activation_v1.c b/sway/xdg_activation_v1.c
index 47270f73..72c7fa4c 100644
--- a/sway/xdg_activation_v1.c
+++ b/sway/xdg_activation_v1.c
@@ -18,11 +18,15 @@ void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
18 return; 18 return;
19 } 19 }
20 20
21 struct launcher_ctx *ctx = event->token->data;
22 if (ctx == NULL) {
23 return;
24 }
25
21 if (!xdg_surface->surface->mapped) { 26 if (!xdg_surface->surface->mapped) {
22 // This is a startup notification. If we are tracking it, the data 27 // This is a startup notification. If we are tracking it, the data
23 // field is a launcher_ctx. 28 // field is a launcher_ctx.
24 struct launcher_ctx *ctx = event->token->data; 29 if (ctx->activated) {
25 if (!ctx || ctx->activated) {
26 // This ctx has already been activated and cannot be used again 30 // This ctx has already been activated and cannot be used again
27 // for a startup notification. It will be destroyed 31 // for a startup notification. It will be destroyed
28 return; 32 return;
@@ -33,9 +37,16 @@ void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
33 return; 37 return;
34 } 38 }
35 39
36 struct wlr_seat *wlr_seat = event->token->seat; 40 // This is an activation request. If this context is internal we have ctx->seat.
37 struct sway_seat *seat = wlr_seat ? wlr_seat->data : NULL; 41 struct sway_seat *seat = ctx->seat;
38 view_request_activate(view, seat); 42 if (!seat) {
43 // Otherwise, use the seat indicated by the launcher client in set_serial
44 seat = ctx->token->seat ? ctx->token->seat->data : NULL;
45 }
46
47 if (seat) {
48 view_request_activate(view, seat);
49 }
39} 50}
40 51
41void xdg_activation_v1_handle_new_token(struct wl_listener *listener, void *data) { 52void xdg_activation_v1_handle_new_token(struct wl_listener *listener, void *data) {