diff options
Diffstat (limited to 'sway/focus.c')
-rw-r--r-- | sway/focus.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sway/focus.c b/sway/focus.c index 2219ab4a..1d21ac35 100644 --- a/sway/focus.c +++ b/sway/focus.c | |||
@@ -243,3 +243,22 @@ swayc_t *get_focused_float(swayc_t *ws) { | |||
243 | } | 243 | } |
244 | return NULL; | 244 | return NULL; |
245 | } | 245 | } |
246 | |||
247 | swayc_t *get_focused_view_include_floating(swayc_t *parent) { | ||
248 | swayc_t *c = parent; | ||
249 | swayc_t *f = NULL; | ||
250 | |||
251 | while (c && c->type != C_VIEW) { | ||
252 | if (c->type == C_WORKSPACE && c->focused == NULL) { | ||
253 | return ((f = get_focused_float(c))) ? f : c; | ||
254 | } | ||
255 | |||
256 | c = c->focused; | ||
257 | } | ||
258 | |||
259 | if (c == NULL) { | ||
260 | c = swayc_active_workspace_for(parent); | ||
261 | } | ||
262 | |||
263 | return c; | ||
264 | } | ||