aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/launcher.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/launcher.c')
-rw-r--r--sway/desktop/launcher.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sway/desktop/launcher.c b/sway/desktop/launcher.c
index 00a7e38a..4a4255d7 100644
--- a/sway/desktop/launcher.c
+++ b/sway/desktop/launcher.c
@@ -67,6 +67,9 @@ void launcher_ctx_destroy(struct launcher_ctx *ctx) {
67 } 67 }
68 wl_list_remove(&ctx->node_destroy.link); 68 wl_list_remove(&ctx->node_destroy.link);
69 wl_list_remove(&ctx->token_destroy.link); 69 wl_list_remove(&ctx->token_destroy.link);
70 if (ctx->seat) {
71 wl_list_remove(&ctx->seat_destroy.link);
72 }
70 wl_list_remove(&ctx->link); 73 wl_list_remove(&ctx->link);
71 wlr_xdg_activation_token_v1_destroy(ctx->token); 74 wlr_xdg_activation_token_v1_destroy(ctx->token);
72 free(ctx->fallback_name); 75 free(ctx->fallback_name);
@@ -227,6 +230,12 @@ struct launcher_ctx *launcher_ctx_create(struct wlr_xdg_activation_token_v1 *tok
227 return ctx; 230 return ctx;
228} 231}
229 232
233static void launch_ctx_handle_seat_destroy(struct wl_listener *listener, void *data) {
234 struct launcher_ctx *ctx = wl_container_of(listener, ctx, seat_destroy);
235 ctx->seat = NULL;
236 wl_list_remove(&ctx->seat_destroy.link);
237}
238
230// Creates a context with a new token for the internal launcher 239// Creates a context with a new token for the internal launcher
231struct launcher_ctx *launcher_ctx_create_internal(void) { 240struct launcher_ctx *launcher_ctx_create_internal(void) {
232 struct sway_seat *seat = input_manager_current_seat(); 241 struct sway_seat *seat = input_manager_current_seat();
@@ -238,13 +247,15 @@ struct launcher_ctx *launcher_ctx_create_internal(void) {
238 247
239 struct wlr_xdg_activation_token_v1 *token = 248 struct wlr_xdg_activation_token_v1 *token =
240 wlr_xdg_activation_token_v1_create(server.xdg_activation_v1); 249 wlr_xdg_activation_token_v1_create(server.xdg_activation_v1);
241 token->seat = seat->wlr_seat;
242 250
243 struct launcher_ctx *ctx = launcher_ctx_create(token, &ws->node); 251 struct launcher_ctx *ctx = launcher_ctx_create(token, &ws->node);
244 if (!ctx) { 252 if (!ctx) {
245 wlr_xdg_activation_token_v1_destroy(token); 253 wlr_xdg_activation_token_v1_destroy(token);
246 return NULL; 254 return NULL;
247 } 255 }
256 ctx->seat = seat;
257 ctx->seat_destroy.notify = launch_ctx_handle_seat_destroy;
258 wl_signal_add(&seat->wlr_seat->events.destroy, &ctx->seat_destroy);
248 259
249 return ctx; 260 return ctx;
250} 261}