input/seat: emit focus events when focusing parent

Emit a focus event when a container or the entire workspace gets focused
(for example, when focus_parent is called).

Previously, focus events were only emitted when another view or
workspace was focused. This made it impossible to accurately follow the
focus by monitoring focus events.
This commit is contained in:
Tim Hallmann 2022-02-03 19:30:44 +01:00
parent ee7668c1f2
commit 9cfcff0039

View file

@ -1198,8 +1198,10 @@ void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
// emit ipc events // emit ipc events
set_workspace(seat, new_workspace); set_workspace(seat, new_workspace);
if (container && container->view) { if (container) {
ipc_event_window(container, "focus"); ipc_event_window(container, "focus");
} else if(last_workspace == new_workspace) {
ipc_event_workspace(NULL, new_workspace, "focus");
} }
// Move sticky containers to new workspace // Move sticky containers to new workspace