aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ronan Pigott <ronan@rjp.ie>2022-11-30 12:02:10 -0700
committerLibravatar Ronan Pigott <ronan@rjp.ie>2023-02-05 00:53:47 -0700
commit842609da6432c054c19c8d10f1660085653daa64 (patch)
tree679a42fc407a1e11ef1f29daa755489202fcf54e
parentci: install hwdata-dev on Alpine (diff)
downloadsway-842609da6432c054c19c8d10f1660085653daa64.tar.gz
sway-842609da6432c054c19c8d10f1660085653daa64.tar.zst
sway-842609da6432c054c19c8d10f1660085653daa64.zip
view: make request_activate take a seat
This way we can move focus on the same seat an activation token originates from.
-rw-r--r--include/sway/tree/view.h2
-rw-r--r--sway/desktop/xwayland.c2
-rw-r--r--sway/tree/view.c6
-rw-r--r--sway/xdg_activation_v1.c7
4 files changed, 12 insertions, 5 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 273ff364..7fc2d95d 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -271,7 +271,7 @@ void view_set_activated(struct sway_view *view, bool activated);
271/** 271/**
272 * Called when the view requests to be focused. 272 * Called when the view requests to be focused.
273 */ 273 */
274void view_request_activate(struct sway_view *view); 274void view_request_activate(struct sway_view *view, struct sway_seat *seat);
275 275
276/** 276/**
277 * If possible, instructs the client to change their decoration mode. 277 * If possible, instructs the client to change their decoration mode.
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index e15a3341..9c29f66b 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -630,7 +630,7 @@ static void handle_request_activate(struct wl_listener *listener, void *data) {
630 if (!xsurface->mapped) { 630 if (!xsurface->mapped) {
631 return; 631 return;
632 } 632 }
633 view_request_activate(view); 633 view_request_activate(view, NULL);
634 634
635 transaction_commit_dirty(); 635 transaction_commit_dirty();
636} 636}
diff --git a/sway/tree/view.c b/sway/tree/view.c
index ec0ad4af..ba3ef489 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -366,12 +366,14 @@ void view_set_activated(struct sway_view *view, bool activated) {
366 } 366 }
367} 367}
368 368
369void view_request_activate(struct sway_view *view) { 369void view_request_activate(struct sway_view *view, struct sway_seat *seat) {
370 struct sway_workspace *ws = view->container->pending.workspace; 370 struct sway_workspace *ws = view->container->pending.workspace;
371 if (!ws) { // hidden scratchpad container 371 if (!ws) { // hidden scratchpad container
372 return; 372 return;
373 } 373 }
374 struct sway_seat *seat = input_manager_current_seat(); 374 if (!seat) {
375 seat = input_manager_current_seat();
376 }
375 377
376 switch (config->focus_on_window_activation) { 378 switch (config->focus_on_window_activation) {
377 case FOWA_SMART: 379 case FOWA_SMART:
diff --git a/sway/xdg_activation_v1.c b/sway/xdg_activation_v1.c
index cc3dcec0..c20e42c1 100644
--- a/sway/xdg_activation_v1.c
+++ b/sway/xdg_activation_v1.c
@@ -31,5 +31,10 @@ void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
31 return; 31 return;
32 } 32 }
33 33
34 view_request_activate(view); 34 struct wlr_seat *wlr_seat = event->token->seat;
35 // The requesting seat may have been destroyed.
36 if (wlr_seat) {
37 struct sway_seat *seat = wlr_seat->data;
38 view_request_activate(view, seat);
39 }
35} 40}