diff options
| author | tslil clingman <tslil@posteo.de> | 2023-03-03 16:31:40 +0100 |
|---|---|---|
| committer | tslil clingman <tslil@posteo.de> | 2023-03-03 16:31:40 +0100 |
| commit | e7b800d81881cf95fcb822cd46acb03c1dd21856 (patch) | |
| tree | 926d47417cee877c475753c1fe59df1ece8dc847 /dwl | |
| parent | 819d795ba8472cc0c5b9f1f58fd4422d8c41ec71 (diff) | |
[dwl] fix switching between tags and remove more stuff i apparently don't use
Diffstat (limited to 'dwl')
| -rw-r--r-- | dwl/dwl.c | 79 |
1 files changed, 39 insertions, 40 deletions
@@ -185,7 +185,8 @@ struct Monitor { struct wlr_box m; /* monitor area, layout-relative */ struct wlr_box w; /* window area, layout-relative */ struct wl_list layers[4]; /* LayerSurface::link */ - const Layout *lt[2]; + const Layout *lt; + unsigned int curtag, prevtag; /* current and previous tag */ Pertag *pertag; unsigned int sellt; unsigned int tagset; @@ -415,11 +416,10 @@ static Atom netatom[NetLast]; #include "client.h" struct Pertag { - unsigned int curtag, prevtag; /* current and previous tag */ int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */ float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */ unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */ - const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */ + const Layout *ltidxs[LENGTH(tags) + 1]; /* matrix of tags and layouts indexes */ }; /* compile-time check if all tags fit into an unsigned int bit array. */ @@ -469,7 +469,7 @@ applyrules(Client *c) if (!(title = client_get_title(c))) title = broken; - if (strnlen(title, 1) == 0) title="DWL_EMPTY_TITLE"; + if (strnlen(title, 1) == 0) title = "DWL_EMPTY_TITLE"; for (r = rules; r < END(rules); r++) { if ((!r->title || strstr(title, r->title)) @@ -507,8 +507,8 @@ arrange(Monitor *m) wlr_scene_node_set_enabled(&m->fullscreen_bg->node, (c = focustop(m)) && c->isfullscreen); - if (m && m->lt[m->sellt]->arrange) - m->lt[m->sellt]->arrange(m); + if (m && m->lt->arrange) + m->lt->arrange(m); motionnotify(0); checkidleinhibitor(NULL); } @@ -942,7 +942,7 @@ createmon(struct wl_listener *listener, void *data) m->nmaster = r->nmaster; wlr_output_set_scale(wlr_output, r->scale); wlr_xcursor_manager_load(cursor_mgr, r->scale); - m->lt[0] = m->lt[1] = r->lt; + m->lt = r->lt; wlr_output_set_transform(wlr_output, r->rr); m->m.x = r->x; m->m.y = r->y; @@ -985,14 +985,14 @@ createmon(struct wl_listener *listener, void *data) wlr_scene_node_set_enabled(&m->fullscreen_bg->node, 0); m->pertag = calloc(1, sizeof(Pertag)); - m->pertag->curtag = m->pertag->prevtag = 1; + m->curtag = m->prevtag = 1; for (i = 0; i <= LENGTH(tags); i++) { m->pertag->nmasters[i] = m->nmaster; m->pertag->mfacts[i] = m->mfact; - m->pertag->ltidxs[i][0] = m->lt[0]; - m->pertag->ltidxs[i][1] = m->lt[1]; + m->pertag->ltidxs[i] = m->lt; + m->pertag->ltidxs[i] = m->lt; m->pertag->sellts[i] = m->sellt; } /* Adds this to the output layout in the order it was configured in. @@ -1365,7 +1365,7 @@ incnmaster(const Arg *arg) { if (!arg || !selmon) return; - selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0); + selmon->nmaster = selmon->pertag->nmasters[selmon->curtag] = MAX(selmon->nmaster + arg->i, 0); arrange(selmon); } @@ -1887,7 +1887,7 @@ printstatus(void) printf("%s selmon %u\n", m->wlr_output->name, m == selmon); printf("%s tags %u %u %u %u\n", m->wlr_output->name, occ, m->tagset, sel, urg); - printf("%s layout %s\n", m->wlr_output->name, m->lt[m->sellt]->symbol); + printf("%s layout %s\n", m->wlr_output->name, m->lt->symbol); } fflush(stdout); } @@ -2079,10 +2079,10 @@ setlayout(const Arg *arg) { if (!selmon) return; - if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) - selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1; + if (!arg || !arg->v || arg->v != selmon->lt) + selmon->sellt = selmon->pertag->sellts[selmon->curtag] ^= 1; if (arg && arg->v) - selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v; + selmon->lt = selmon->pertag->ltidxs[selmon->curtag] = (Layout *)arg->v; /* TODO change layout symbol? */ arrange(selmon); printstatus(); @@ -2094,12 +2094,12 @@ setmfact(const Arg *arg) { float f; - if (!arg || !selmon || !selmon->lt[selmon->sellt]->arrange) + if (!arg || !selmon || !selmon->lt->arrange) return; f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; if (f < 0.1 || f > 0.9) return; - selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f; + selmon->mfact = selmon->pertag->mfacts[selmon->curtag] = f; arrange(selmon); } @@ -2478,23 +2478,23 @@ toggleview(const Arg *arg) selmon->tagset = newtagset; if (newtagset == ~0) { - selmon->pertag->prevtag = selmon->pertag->curtag; - selmon->pertag->curtag = 0; + selmon->prevtag = selmon->curtag; + selmon->curtag = 0; } /* test if the user did not select the same tag */ - if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) { - selmon->pertag->prevtag = selmon->pertag->curtag; + if (!(newtagset & 1 << (selmon->curtag - 1))) { + selmon->prevtag = selmon->curtag; for (i = 0; !(newtagset & 1 << i); i++) ; - selmon->pertag->curtag = i + 1; + selmon->curtag = i + 1; } /* apply settings for this view */ - selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag]; - selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag]; - selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag]; - selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; - selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1]; + selmon->nmaster = selmon->pertag->nmasters[selmon->curtag]; + selmon->mfact = selmon->pertag->mfacts[selmon->curtag]; + selmon->sellt = selmon->pertag->sellts[selmon->curtag]; + selmon->lt = selmon->pertag->ltidxs[selmon->curtag]; + selmon->lt = selmon->pertag->ltidxs[selmon->curtag]; focusclient(focustop(selmon), 1); arrange(selmon); @@ -2668,26 +2668,25 @@ view(const Arg *arg) if (arg->ui & TAGMASK) { selmon->tagset = arg->ui & TAGMASK; - selmon->pertag->prevtag = selmon->pertag->curtag; + selmon->prevtag = selmon->curtag; if (arg->ui == ~0) - selmon->pertag->curtag = 0; + selmon->curtag = 0; else { for (i = 0; !(arg->ui & 1 << i); i++) ; - selmon->pertag->curtag = i + 1; + selmon->curtag = i + 1; } } else { - tmptag = selmon->pertag->prevtag; - selmon->pertag->prevtag = selmon->pertag->curtag; - selmon->pertag->curtag = tmptag; - selmon->tagset = tmptag; + tmptag = selmon->prevtag; + selmon->prevtag = selmon->curtag; + selmon->curtag = tmptag; + selmon->tagset = 1 << (tmptag - 1); } - selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag]; - selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag]; - selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag]; - selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; - selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1]; + selmon->nmaster = selmon->pertag->nmasters[selmon->curtag]; + selmon->mfact = selmon->pertag->mfacts[selmon->curtag]; + selmon->sellt = selmon->pertag->sellts[selmon->curtag]; + selmon->lt = selmon->pertag->ltidxs[selmon->curtag]; focusclient(focustop(selmon), 1); arrange(selmon); @@ -2747,7 +2746,7 @@ zoom(const Arg *arg) { Client *c, *sel = focustop(selmon); - if (!sel || !selmon || !selmon->lt[selmon->sellt]->arrange || sel->isfloating) + if (!sel || !selmon || !selmon->lt->arrange || sel->isfloating) return; /* Search for the first tiled window that is not sel, marking sel as |
