diff --git a/src/layout/horizontal.h b/src/layout/horizontal.h index 92980731..24eed392 100644 --- a/src/layout/horizontal.h +++ b/src/layout/horizontal.h @@ -588,6 +588,7 @@ void grid(Monitor *m) { int32_t target_gappi = enablegaps ? config.gappih : 0; float single_width_ratio = 0.9; float single_height_ratio = 0.9; + struct wlr_box target_geom; n = m->visible_fake_tiling_clients; @@ -603,11 +604,11 @@ void grid(Monitor *m) { ISFAKETILED(c))) { cw = (m->w.width - 2 * target_gappo) * single_width_ratio; ch = (m->w.height - 2 * target_gappo) * single_height_ratio; - c->geom.x = m->w.x + (m->w.width - cw) / 2; - c->geom.y = m->w.y + (m->w.height - ch) / 2; - c->geom.width = cw; - c->geom.height = ch; - client_tile_resize(c, c->geom, 0); + target_geom.x = m->w.x + (m->w.width - cw) / 2; + target_geom.y = m->w.y + (m->w.height - ch) / 2; + target_geom.width = cw; + target_geom.height = ch; + client_tile_resize(c, target_geom, 0); return; } } @@ -651,16 +652,16 @@ void grid(Monitor *m) { cw = avail_w * (col_pers[i] / sum_col); if (i == 0) { - c->geom.x = m->w.x + target_gappo; + target_geom.x = m->w.x + target_gappo; } else if (i == 1) { // 第二个窗口的 X 坐标紧跟第一个窗口后面 float cw0 = avail_w * (col_pers[0] / sum_col); - c->geom.x = m->w.x + target_gappo + cw0 + target_gappi; + target_geom.x = m->w.x + target_gappo + cw0 + target_gappi; } - c->geom.y = m->w.y + (m->w.height - ch) / 2 + target_gappo; - c->geom.width = cw; - c->geom.height = ch; - client_tile_resize(c, c->geom, 0); + target_geom.y = m->w.y + (m->w.height - ch) / 2 + target_gappo; + target_geom.width = cw; + target_geom.height = ch; + client_tile_resize(c, target_geom, 0); i++; } } @@ -757,11 +758,11 @@ void grid(Monitor *m) { ? (m->w.y + m->w.height - target_gappo - fl_cy) : avail_h * (row_pers[r_idx] / sum_row); - c->geom.x = (int32_t)fl_cx; - c->geom.y = (int32_t)fl_cy; - c->geom.width = (int32_t)fl_cw; - c->geom.height = (int32_t)fl_ch; - client_tile_resize(c, c->geom, 0); + target_geom.x = (int32_t)fl_cx; + target_geom.y = (int32_t)fl_cy; + target_geom.width = (int32_t)fl_cw; + target_geom.height = (int32_t)fl_ch; + client_tile_resize(c, target_geom, 0); i++; } } diff --git a/src/layout/vertical.h b/src/layout/vertical.h index 523467f9..6e058dea 100644 --- a/src/layout/vertical.h +++ b/src/layout/vertical.h @@ -186,14 +186,13 @@ void vertical_grid(Monitor *m) { int32_t cw, ch; int32_t rows, cols, overrows; Client *c = NULL; - int32_t target_gappo = - enablegaps ? m->isoverview ? config.overviewgappo : config.gappov : 0; - int32_t target_gappi = - enablegaps ? m->isoverview ? config.overviewgappi : config.gappiv : 0; - float single_width_ratio = m->isoverview ? 0.7 : 0.9; - float single_height_ratio = m->isoverview ? 0.8 : 0.9; + int32_t target_gappo = enablegaps ? config.gappov : 0; + int32_t target_gappi = enablegaps ? config.gappiv : 0; + float single_width_ratio = 0.9; + float single_height_ratio = 0.9; + struct wlr_box target_geom; - n = m->isoverview ? m->visible_clients : m->visible_fake_tiling_clients; + n = m->visible_fake_tiling_clients; if (n == 0) return; @@ -202,15 +201,14 @@ void vertical_grid(Monitor *m) { if (c->mon != m) continue; if (VISIBLEON(c, m) && !c->isunglobal && - ((m->isoverview && !client_is_x11_popup(c)) || - ISFAKETILED(c))) { + (!client_is_x11_popup(c) || ISFAKETILED(c))) { ch = (m->w.height - 2 * target_gappo) * single_height_ratio; cw = (m->w.width - 2 * target_gappo) * single_width_ratio; - c->geom.x = m->w.x + (m->w.width - cw) / 2; - c->geom.y = m->w.y + (m->w.height - ch) / 2; - c->geom.width = cw; - c->geom.height = ch; - client_tile_resize(c, c->geom, 0); + target_geom.x = m->w.x + (m->w.width - cw) / 2; + target_geom.y = m->w.y + (m->w.height - ch) / 2; + target_geom.width = cw; + target_geom.height = ch; + client_tile_resize(c, target_geom, 0); return; } } @@ -224,8 +222,7 @@ void vertical_grid(Monitor *m) { if (c->mon != m) continue; if (VISIBLEON(c, m) && !c->isunglobal && - ((m->isoverview && !client_is_x11_popup(c)) || - ISFAKETILED(c))) { + (!client_is_x11_popup(c) || ISFAKETILED(c))) { if (i < 2) row_pers[i] = (c->grid_row_per > 0.0f) ? c->grid_row_per : 1.0f; @@ -242,8 +239,7 @@ void vertical_grid(Monitor *m) { if (c->mon != m) continue; if (VISIBLEON(c, m) && !c->isunglobal && - ((m->isoverview && !client_is_x11_popup(c)) || - ISFAKETILED(c))) { + (!client_is_x11_popup(c) || ISFAKETILED(c))) { c->grid_col_idx = 0; c->grid_row_idx = i; c->grid_col_per = 1.0f; @@ -252,17 +248,17 @@ void vertical_grid(Monitor *m) { // 根据分配的权重动态计算当前窗口的高度 ch = avail_h * (row_pers[i] / sum_row); - c->geom.x = m->w.x + (m->w.width - cw) / 2 + target_gappo; + target_geom.x = m->w.x + (m->w.width - cw) / 2 + target_gappo; if (i == 0) { - c->geom.y = m->w.y + target_gappo; + target_geom.y = m->w.y + target_gappo; } else if (i == 1) { // 第二个窗口的 Y 坐标紧跟第一个窗口下面 float ch0 = avail_h * (row_pers[0] / sum_row); - c->geom.y = m->w.y + target_gappo + ch0 + target_gappi; + target_geom.y = m->w.y + target_gappo + ch0 + target_gappi; } - c->geom.width = cw; - c->geom.height = ch; - client_tile_resize(c, c->geom, 0); + target_geom.width = cw; + target_geom.height = ch; + client_tile_resize(c, target_geom, 0); i++; } } @@ -287,7 +283,7 @@ void vertical_grid(Monitor *m) { if (c->mon != m) continue; if (VISIBLEON(c, m) && !c->isunglobal && - ((m->isoverview && !client_is_x11_popup(c)) || ISFAKETILED(c))) { + (!client_is_x11_popup(c) || ISFAKETILED(c))) { int32_t c_idx = i / rows; int32_t r_idx = i % rows; if (r_idx == 0) @@ -314,7 +310,7 @@ void vertical_grid(Monitor *m) { if (c->mon != m) continue; if (VISIBLEON(c, m) && !c->isunglobal && - ((m->isoverview && !client_is_x11_popup(c)) || ISFAKETILED(c))) { + (!client_is_x11_popup(c) || ISFAKETILED(c))) { int32_t c_idx = i / rows; int32_t r_idx = i % rows; @@ -352,11 +348,11 @@ void vertical_grid(Monitor *m) { ? (m->w.x + m->w.width - target_gappo - fl_cx) : avail_w * (col_pers[c_idx] / sum_col); - c->geom.x = (int32_t)fl_cx; - c->geom.y = (int32_t)fl_cy; - c->geom.width = (int32_t)fl_cw; - c->geom.height = (int32_t)fl_ch; - client_tile_resize(c, c->geom, 0); + target_geom.x = (int32_t)fl_cx; + target_geom.y = (int32_t)fl_cy; + target_geom.width = (int32_t)fl_cw; + target_geom.height = (int32_t)fl_ch; + client_tile_resize(c, target_geom, 0); i++; } }