diff --git a/meson.build b/meson.build index 82670f0a..fa5409b1 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('mango', ['c'], - version : '0.14.3', + version : '0.14.4', ) subdir('protocols') diff --git a/src/layout/arrange.h b/src/layout/arrange.h index 23b9d080..f1c97f3a 100644 --- a/src/layout/arrange.h +++ b/src/layout/arrange.h @@ -1223,6 +1223,10 @@ arrange(Monitor *m, bool want_animation, bool from_view) { if (!m->wlr_output->enabled) return; + if (!m->sel) { + m->sel = focustop(m); + } + pre_caculate_before_arrange(m, want_animation, from_view, false); if (m->isoverview) { diff --git a/src/layout/dwindle.h b/src/layout/dwindle.h index 74e79477..9562b5d8 100644 --- a/src/layout/dwindle.h +++ b/src/layout/dwindle.h @@ -565,6 +565,7 @@ void dwindle(Monitor *m) { break; } + // 清理树中已不存在的客户端 { DwindleNode *leaves[512]; int32_t lc = 0; @@ -602,9 +603,14 @@ void dwindle(Monitor *m) { } } + // 获得焦点客户端,若为空则用第一个可见平铺客户端兜底 Client *focused = focustop(m); if (focused && !dwindle_find_leaf(*root, focused)) focused = m->sel; + + if (!focused && count > 0) + focused = vis[0]; + for (int32_t i = 0; i < count; i++) { if (!dwindle_find_leaf(*root, vis[i])) dwindle_insert_with_config(root, vis[i], focused, ratio);