diff options
-rw-r--r-- | include/sway/config.h | 4 | ||||
-rw-r--r-- | sway/tree/view.c | 34 |
2 files changed, 19 insertions, 19 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index 45fa73c4..4ee8c3c2 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -60,7 +60,7 @@ struct sway_mouse_binding { | |||
60 | /** | 60 | /** |
61 | * Focus on window activation. | 61 | * Focus on window activation. |
62 | */ | 62 | */ |
63 | enum fowa { | 63 | enum sway_fowa { |
64 | FOWA_SMART, | 64 | FOWA_SMART, |
65 | FOWA_URGENT, | 65 | FOWA_URGENT, |
66 | FOWA_FOCUS, | 66 | FOWA_FOCUS, |
@@ -350,7 +350,7 @@ struct sway_config { | |||
350 | size_t font_height; | 350 | size_t font_height; |
351 | bool pango_markup; | 351 | bool pango_markup; |
352 | size_t urgent_timeout; | 352 | size_t urgent_timeout; |
353 | enum fowa focus_on_window_activation; | 353 | enum sway_fowa focus_on_window_activation; |
354 | 354 | ||
355 | // Flags | 355 | // Flags |
356 | bool focus_follows_mouse; | 356 | bool focus_follows_mouse; |
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) { | |||
281 | } | 281 | } |
282 | 282 | ||
283 | void view_request_activate(struct sway_view *view) { | 283 | void view_request_activate(struct sway_view *view) { |
284 | if (config->focus_on_window_activation == FOWA_NONE) { | ||
285 | return; | ||
286 | } | ||
287 | if (config->focus_on_window_activation == FOWA_FOCUS) { | ||
288 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
289 | seat_set_focus(seat, view->swayc); | ||
290 | return; | ||
291 | } | ||
292 | if (config->focus_on_window_activation == FOWA_URGENT) { | ||
293 | view_set_urgent(view, true); | ||
294 | return; | ||
295 | } | ||
296 | // FOWA_SMART | ||
297 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | 284 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); |
298 | if (workspace_is_visible(ws)) { | 285 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
299 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 286 | |
300 | seat_set_focus(seat, view->swayc); | 287 | switch (config->focus_on_window_activation) { |
301 | } else { | 288 | case FOWA_SMART: |
289 | if (workspace_is_visible(ws)) { | ||
290 | seat_set_focus(seat, view->swayc); | ||
291 | } else { | ||
292 | view_set_urgent(view, true); | ||
293 | } | ||
294 | break; | ||
295 | case FOWA_URGENT: | ||
302 | view_set_urgent(view, true); | 296 | view_set_urgent(view, true); |
297 | break; | ||
298 | case FOWA_FOCUS: | ||
299 | seat_set_focus(seat, view->swayc); | ||
300 | break; | ||
301 | case FOWA_NONE: | ||
302 | break; | ||
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||