X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=scrotwm.c;h=0863b6240f178a5ca34e6c614e06d54b4d2cf3a7;hb=32edf2c5ac6cbd7b967dd9448228b0fd36f30702;hp=835c1d413664ae1378ed0fb981e3acbc256e4dfa;hpb=bbb499e87a8c905214478e1badd67465701fc5cb;p=spectrwm.git diff --git a/scrotwm.c b/scrotwm.c index 835c1d4..0863b62 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -650,7 +650,6 @@ bar_update(void) if (bar_enabled == 0) return; - if (bar_extra && bar_extra_running) { /* ignore short reads; it'll correct itself */ while ((b = fgetln(stdin, &len)) != NULL) @@ -705,16 +704,13 @@ bar_toggle(struct swm_region *r, union arg *args) XMapRaised(display, tmpr->bar_window); } bar_enabled = !bar_enabled; - XSync(display, False); for (i = 0; i < sc; i++) for (j = 0; j < SWM_WS_MAX; j++) screens[i].ws[j].restack = 1; stack(); /* must be after stack */ - for (i = 0; i < sc; i++) - TAILQ_FOREACH(tmpr, &screens[i].rl, entry) - bar_update(); + bar_update(); } void @@ -1410,8 +1406,9 @@ stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip) XWindowChanges wc; struct swm_geometry win_g, r_g = *g; struct ws_win *win, *winfocus; - int i, j, s, w_inc, h_inc, w_base, h_base, stacks; - int hrh, extra, h_slice, last_h = 0; + int i, j, s, stacks; + int w_inc = 1, h_inc, w_base = 1, h_base; + int hrh, extra = 0, h_slice, last_h = 0; int split, colno, winno, mwin, msize, mscale; int remain, missing, v_slice;; unsigned int mask; @@ -1426,7 +1423,13 @@ stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip) ws->focus = TAILQ_FIRST(&ws->winlist); winfocus = cur_focus ? cur_focus : ws->focus; - win = TAILQ_FIRST(&ws->winlist); + TAILQ_FOREACH(win, &ws->winlist, entry) + if (win->transient == 0 && win->floating == 0) + break; + + if (win == NULL) + goto notiles; + if (rot) { w_inc = win->sh.width_inc; w_base = win->sh.base_width; @@ -1460,14 +1463,8 @@ stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip) /* adjust for window's requested size increment */ remain = (win_g.w - w_base) % w_inc; missing = w_inc - remain; - - if (missing <= extra || j == 0) { - extra -= missing; - win_g.w += missing; - } else { - win_g.w -= remain; - extra += remain; - } + win_g.w -= remain; + extra += remain; } msize = win_g.w; @@ -1558,6 +1555,7 @@ stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip) j++; } + notiles: /* now, stack all the floaters and transients */ TAILQ_FOREACH(win, &ws->winlist, entry) { if (win->transient == 0 && win->floating == 0) @@ -2651,7 +2649,6 @@ new_region(struct swm_screen *s, int x, int y, int w, int h) r->ws = ws; ws->r = r; TAILQ_INSERT_TAIL(&s->rl, r, entry); - bar_setup(r); } void @@ -2841,10 +2838,11 @@ int main(int argc, char *argv[]) { struct passwd *pwd; + struct swm_region *r; char conf[PATH_MAX], *cfile = NULL; struct stat sb; XEvent e; - int xfd; + int xfd, i; fd_set rd; start_argv = argv; @@ -2881,7 +2879,11 @@ main(int argc, char *argv[]) } if (cfile) conf_load(cfile); - bar_refresh(); + + /* setup all bars */ + for (i = 0; i < ScreenCount(display); i++) + TAILQ_FOREACH(r, &screens[i].rl, entry) + bar_setup(r); /* ws[0].focus = TAILQ_FIRST(&ws[0].winlist); */