diff options
Diffstat (limited to 'sway/xdg_activation_v1.c')
-rw-r--r-- | sway/xdg_activation_v1.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sway/xdg_activation_v1.c b/sway/xdg_activation_v1.c index c26ee19a..399d81cd 100644 --- a/sway/xdg_activation_v1.c +++ b/sway/xdg_activation_v1.c | |||
@@ -17,11 +17,15 @@ void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, | |||
17 | return; | 17 | return; |
18 | } | 18 | } |
19 | 19 | ||
20 | struct launcher_ctx *ctx = event->token->data; | ||
21 | if (ctx == NULL) { | ||
22 | return; | ||
23 | } | ||
24 | |||
20 | if (!xdg_surface->surface->mapped) { | 25 | if (!xdg_surface->surface->mapped) { |
21 | // This is a startup notification. If we are tracking it, the data | 26 | // This is a startup notification. If we are tracking it, the data |
22 | // field is a launcher_ctx. | 27 | // field is a launcher_ctx. |
23 | struct launcher_ctx *ctx = event->token->data; | 28 | if (ctx->activated) { |
24 | if (!ctx || ctx->activated) { | ||
25 | // This ctx has already been activated and cannot be used again | 29 | // This ctx has already been activated and cannot be used again |
26 | // for a startup notification. It will be destroyed | 30 | // for a startup notification. It will be destroyed |
27 | return; | 31 | return; |
@@ -32,9 +36,16 @@ void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, | |||
32 | return; | 36 | return; |
33 | } | 37 | } |
34 | 38 | ||
35 | struct wlr_seat *wlr_seat = event->token->seat; | 39 | // This is an activation request. If this context is internal we have ctx->seat. |
36 | struct sway_seat *seat = wlr_seat ? wlr_seat->data : NULL; | 40 | struct sway_seat *seat = ctx->seat; |
37 | view_request_activate(view, seat); | 41 | if (!seat) { |
42 | // Otherwise, use the seat indicated by the launcher client in set_serial | ||
43 | seat = ctx->token->seat ? ctx->token->seat->data : NULL; | ||
44 | } | ||
45 | |||
46 | if (seat) { | ||
47 | view_request_activate(view, seat); | ||
48 | } | ||
38 | } | 49 | } |
39 | 50 | ||
40 | void xdg_activation_v1_handle_new_token(struct wl_listener *listener, void *data) { | 51 | void xdg_activation_v1_handle_new_token(struct wl_listener *listener, void *data) { |