mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-12 13:30:01 -05:00
opt: Reduce unnecessary layout calculations
This commit is contained in:
parent
c9843ec05a
commit
62a569d756
2 changed files with 23 additions and 44 deletions
|
|
@ -10,9 +10,8 @@ void vertical_fibonacci(Monitor *mon, int s) {
|
|||
cur_gappiv = smartgaps && mon->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappoh = smartgaps && mon->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov = smartgaps && mon->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
// Count visible clients
|
||||
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, mon) && ISTILED(c))
|
||||
n++;
|
||||
|
||||
n = mon->visible_tiling_clients;
|
||||
|
||||
if (n == 0)
|
||||
return;
|
||||
|
|
@ -130,14 +129,8 @@ void vertical_grid(Monitor *m) {
|
|||
unsigned int dy;
|
||||
unsigned int rows, cols, overrows;
|
||||
Client *c;
|
||||
n = 0;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_should_ignore_focus(c)) || ISTILED(c))) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
n = m->isoverview ? m->visible_clients : m->visible_tiling_clients;
|
||||
|
||||
if (n == 0) {
|
||||
return;
|
||||
|
|
@ -247,7 +240,8 @@ void vertical_deck(Monitor *m) {
|
|||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
|
||||
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && ISTILED(c)) n++;
|
||||
n = m->visible_tiling_clients;
|
||||
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
|
|
@ -288,10 +282,9 @@ void vertical_deck(Monitor *m) {
|
|||
}
|
||||
|
||||
void vertical_scroller(Monitor *m) {
|
||||
unsigned int i, n;
|
||||
unsigned int i, n, j;
|
||||
Client *c, *root_client = NULL;
|
||||
Client **tempClients = NULL;
|
||||
n = 0;
|
||||
struct wlr_box target_geom;
|
||||
int focus_client_index = 0;
|
||||
bool need_scroller = false;
|
||||
|
|
@ -306,11 +299,7 @@ void vertical_scroller(Monitor *m) {
|
|||
unsigned int max_client_height =
|
||||
m->w.height - 2 * scroller_structs - cur_gappiv;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (VISIBLEON(c, m) && ISTILED(c)) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
n = m->visible_tiling_clients;
|
||||
|
||||
if (n == 0) {
|
||||
return;
|
||||
|
|
@ -321,11 +310,11 @@ void vertical_scroller(Monitor *m) {
|
|||
return;
|
||||
}
|
||||
|
||||
n = 0;
|
||||
j = 0;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (VISIBLEON(c, m) && ISTILED(c)) {
|
||||
tempClients[n] = c;
|
||||
n++;
|
||||
tempClients[j] = c;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -421,7 +410,8 @@ void vertical_tile(Monitor *m) {
|
|||
unsigned int i, n = 0, w, r, ie = enablegaps, mh, mx, tx;
|
||||
Client *c;
|
||||
|
||||
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && ISTILED(c)) n++;
|
||||
n = m->visible_tiling_clients;
|
||||
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue