diff options
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index aa0b1d50..7cf0dd08 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include "sway/input/cursor.h" | 6 | #include "sway/input/cursor.h" |
7 | #include "sway/input/input-manager.h" | 7 | #include "sway/input/input-manager.h" |
8 | #include "sway/input/keyboard.h" | 8 | #include "sway/input/keyboard.h" |
9 | #include "sway/ipc-server.h" | ||
9 | #include "sway/output.h" | 10 | #include "sway/output.h" |
10 | #include "sway/tree/view.h" | 11 | #include "sway/tree/view.h" |
11 | #include "log.h" | 12 | #include "log.h" |
@@ -309,18 +310,30 @@ void sway_seat_set_focus(struct sway_seat *seat, struct sway_container *containe | |||
309 | if (container->type == C_VIEW) { | 310 | if (container->type == C_VIEW) { |
310 | struct sway_view *view = container->sway_view; | 311 | struct sway_view *view = container->sway_view; |
311 | view_set_activated(view, true); | 312 | view_set_activated(view, true); |
312 | struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat); | 313 | struct wlr_keyboard *keyboard = |
314 | wlr_seat_get_keyboard(seat->wlr_seat); | ||
313 | if (keyboard) { | 315 | if (keyboard) { |
314 | wlr_seat_keyboard_notify_enter(seat->wlr_seat, view->surface, | 316 | wlr_seat_keyboard_notify_enter(seat->wlr_seat, |
315 | keyboard->keycodes, keyboard->num_keycodes, | 317 | view->surface, keyboard->keycodes, |
316 | &keyboard->modifiers); | 318 | keyboard->num_keycodes, &keyboard->modifiers); |
317 | } else { | 319 | } else { |
318 | wlr_seat_keyboard_notify_enter(seat->wlr_seat, view->surface, | 320 | wlr_seat_keyboard_notify_enter( |
319 | NULL, 0, NULL); | 321 | seat->wlr_seat, view->surface, NULL, 0, NULL); |
320 | } | 322 | } |
321 | } | 323 | } |
322 | } | 324 | } |
323 | 325 | ||
326 | if (last_focus) { | ||
327 | struct sway_container *last_ws = last_focus; | ||
328 | if (last_ws && last_ws->type != C_WORKSPACE) { | ||
329 | last_ws = container_parent(last_focus, C_WORKSPACE); | ||
330 | } | ||
331 | if (last_ws) { | ||
332 | wlr_log(L_DEBUG, "sending workspace event"); | ||
333 | ipc_event_workspace(last_ws, container, "focus"); | ||
334 | } | ||
335 | } | ||
336 | |||
324 | if (last_focus && last_focus->type == C_VIEW && | 337 | if (last_focus && last_focus->type == C_VIEW && |
325 | !sway_input_manager_has_focus(seat->input, last_focus)) { | 338 | !sway_input_manager_has_focus(seat->input, last_focus)) { |
326 | struct sway_view *view = last_focus->sway_view; | 339 | struct sway_view *view = last_focus->sway_view; |