From 6836074fed83255438960fdc9597532d8bcae4bd Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 29 Mar 2018 16:51:36 -0400 Subject: Implement enough IPC for swaybar to work --- sway/input/seat.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'sway/input/seat.c') diff --git a/sway/input/seat.c b/sway/input/seat.c index 648e7914..81bef7bd 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -6,6 +6,7 @@ #include "sway/input/cursor.h" #include "sway/input/input-manager.h" #include "sway/input/keyboard.h" +#include "sway/ipc-server.h" #include "sway/output.h" #include "sway/view.h" #include "log.h" @@ -309,18 +310,31 @@ void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) { if (container->type == C_VIEW) { struct sway_view *view = container->sway_view; view_set_activated(view, true); - struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->wlr_seat); + struct wlr_keyboard *keyboard = + wlr_seat_get_keyboard(seat->wlr_seat); if (keyboard) { - wlr_seat_keyboard_notify_enter(seat->wlr_seat, view->surface, - keyboard->keycodes, keyboard->num_keycodes, - &keyboard->modifiers); + wlr_seat_keyboard_notify_enter(seat->wlr_seat, + view->surface, keyboard->keycodes, + keyboard->num_keycodes, &keyboard->modifiers); } else { - wlr_seat_keyboard_notify_enter(seat->wlr_seat, view->surface, - NULL, 0, NULL); + wlr_seat_keyboard_notify_enter( + seat->wlr_seat, view->surface, NULL, 0, NULL); } } } + if (last_focus) { + swayc_t *last_ws = last_focus; + if (last_ws && last_ws->type != C_WORKSPACE) { + last_ws = swayc_parent_by_type( + last_focus, C_WORKSPACE); + } + if (last_ws) { + wlr_log(L_DEBUG, "sending workspace event"); + ipc_event_workspace(last_ws, container, "focus"); + } + } + if (last_focus && last_focus->type == C_VIEW && !sway_input_manager_has_focus(seat->input, last_focus)) { struct sway_view *view = last_focus->sway_view; -- cgit v1.2.3