diff options
-rw-r--r-- | include/sway/desktop/launcher.h | 1 | ||||
-rw-r--r-- | include/sway/tree/view.h | 5 | ||||
-rw-r--r-- | sway/desktop/launcher.c | 2 | ||||
-rw-r--r-- | sway/tree/view.c | 6 | ||||
-rw-r--r-- | sway/xdg_activation_v1.c | 5 |
5 files changed, 18 insertions, 1 deletions
diff --git a/include/sway/desktop/launcher.h b/include/sway/desktop/launcher.h index ad465a9e..412068a9 100644 --- a/include/sway/desktop/launcher.h +++ b/include/sway/desktop/launcher.h | |||
@@ -14,6 +14,7 @@ struct launcher_ctx { | |||
14 | struct wl_listener seat_destroy; | 14 | struct wl_listener seat_destroy; |
15 | 15 | ||
16 | bool activated; | 16 | bool activated; |
17 | bool had_focused_surface; | ||
17 | 18 | ||
18 | struct sway_node *node; | 19 | struct sway_node *node; |
19 | struct wl_listener node_destroy; | 20 | struct wl_listener node_destroy; |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 8bfda018..ef1a26b8 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -242,6 +242,11 @@ void view_set_activated(struct sway_view *view, bool activated); | |||
242 | */ | 242 | */ |
243 | void view_request_activate(struct sway_view *view, struct sway_seat *seat); | 243 | void view_request_activate(struct sway_view *view, struct sway_seat *seat); |
244 | 244 | ||
245 | /* | ||
246 | * Called when the view requests urgent state | ||
247 | */ | ||
248 | void view_request_urgent(struct sway_view *view); | ||
249 | |||
245 | /** | 250 | /** |
246 | * If possible, instructs the client to change their decoration mode. | 251 | * If possible, instructs the client to change their decoration mode. |
247 | */ | 252 | */ |
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 | |||
216 | ctx->fallback_name = strdup(fallback_name); | 216 | ctx->fallback_name = strdup(fallback_name); |
217 | ctx->token = token; | 217 | ctx->token = token; |
218 | ctx->node = node; | 218 | ctx->node = node; |
219 | // Having surface set means that the focus check in wlroots has passed | ||
220 | ctx->had_focused_surface = token->surface != NULL; | ||
219 | 221 | ||
220 | ctx->node_destroy.notify = ctx_handle_node_destroy; | 222 | ctx->node_destroy.notify = ctx_handle_node_destroy; |
221 | wl_signal_add(&ctx->node->events.destroy, &ctx->node_destroy); | 223 | wl_signal_add(&ctx->node->events.destroy, &ctx->node_destroy); |
diff --git a/sway/tree/view.c b/sway/tree/view.c index 5525bf63..4a0d8069 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -412,6 +412,12 @@ void view_request_activate(struct sway_view *view, struct sway_seat *seat) { | |||
412 | transaction_commit_dirty(); | 412 | transaction_commit_dirty(); |
413 | } | 413 | } |
414 | 414 | ||
415 | void view_request_urgent(struct sway_view *view) { | ||
416 | if (config->focus_on_window_activation != FOWA_NONE) { | ||
417 | view_set_urgent(view, true); | ||
418 | } | ||
419 | } | ||
420 | |||
415 | void view_set_csd_from_server(struct sway_view *view, bool enabled) { | 421 | void view_set_csd_from_server(struct sway_view *view, bool enabled) { |
416 | sway_log(SWAY_DEBUG, "Telling view %p to set CSD to %i", view, enabled); | 422 | sway_log(SWAY_DEBUG, "Telling view %p to set CSD to %i", view, enabled); |
417 | if (view->xdg_decoration) { | 423 | if (view->xdg_decoration) { |
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 | ||