From f057a0195ee79dfcaeddbcab026c06e310998c75 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 2 Sep 2018 15:03:58 +1000 Subject: Implement focus_on_window_activation Depends on https://github.com/swaywm/wlroots/pull/1223 --- sway/tree/view.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'sway/tree/view.c') diff --git a/sway/tree/view.c b/sway/tree/view.c index 1a98c5f2..c6ed68f6 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -280,6 +280,29 @@ void view_set_activated(struct sway_view *view, bool activated) { } } +void view_request_activate(struct sway_view *view) { + if (config->focus_on_window_activation == FOWA_NONE) { + return; + } + if (config->focus_on_window_activation == FOWA_FOCUS) { + struct sway_seat *seat = input_manager_current_seat(input_manager); + seat_set_focus(seat, view->swayc); + return; + } + if (config->focus_on_window_activation == FOWA_URGENT) { + view_set_urgent(view, true); + return; + } + // FOWA_SMART + struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); + if (workspace_is_visible(ws)) { + struct sway_seat *seat = input_manager_current_seat(input_manager); + seat_set_focus(seat, view->swayc); + } else { + view_set_urgent(view, true); + } +} + void view_set_tiled(struct sway_view *view, bool tiled) { if (!tiled) { view->using_csd = true; -- cgit v1.2.3-54-g00ecf