diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-02 18:25:45 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-02 18:25:45 +1000 |
commit | 6fb03817c9d2bd29697a91f92d680b0c6a2c5996 (patch) | |
tree | fb510fe69ef12a9de9d299fa1543c32b49a16e8e /sway/tree | |
parent | f057a0195ee79dfcaeddbcab026c06e310998c75 (diff) | |
download | sway-6fb03817c9d2bd29697a91f92d680b0c6a2c5996.tar.xz |
Rename fowa enum and use switch in view_request_activate
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/view.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index c6ed68f6..6bd0ef67 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -281,25 +281,25 @@ 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 { + struct sway_seat *seat = input_manager_current_seat(input_manager); + + switch (config->focus_on_window_activation) { + case FOWA_SMART: + if (workspace_is_visible(ws)) { + seat_set_focus(seat, view->swayc); + } else { + view_set_urgent(view, true); + } + break; + case FOWA_URGENT: view_set_urgent(view, true); + break; + case FOWA_FOCUS: + seat_set_focus(seat, view->swayc); + break; + case FOWA_NONE: + break; } } |