diff options
| author | tslil clingman <tslil@posteo.de> | 2023-12-01 18:04:04 +0100 |
|---|---|---|
| committer | tslil clingman <tslil@posteo.de> | 2023-12-01 18:12:10 +0100 |
| commit | 119f17396c60900eaf7534f8106d4ce6ca0362e5 (patch) | |
| tree | 3d2074b5f295e8168312494381ab23eccc0ca1ec /dwl/pertag.patch | |
| parent | 9bc372625e1fdafa50d44dcb9a8070ecdfc01b38 (diff) | |
[dwl] track only patches against upstream
Diffstat (limited to 'dwl/pertag.patch')
| -rw-r--r-- | dwl/pertag.patch | 113 |
1 files changed, 59 insertions, 54 deletions
diff --git a/dwl/pertag.patch b/dwl/pertag.patch index d762efa..a0c66d8 100644 --- a/dwl/pertag.patch +++ b/dwl/pertag.patch @@ -1,17 +1,17 @@ -From d8415ff1f2a8bd347cfcae334815eac1589ee069 Mon Sep 17 00:00:00 2001 -From: Guido Cella <guido@guidocella.xyz> -Date: Sun, 20 Mar 2022 21:22:13 +0100 -Subject: [PATCH] Port pertag +From 8750e1255f6c8b799165186cd6cfdfa7af3ee56d Mon Sep 17 00:00:00 2001 +From: mortezadadgar <mortezadadgar97@gmail.com> +Date: Sat, 26 Aug 2023 20:37:22 +0330 +Subject: [PATCH] Applied pertag --- - dwl.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 73 insertions(+), 5 deletions(-) + dwl.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 70 insertions(+), 5 deletions(-) diff --git a/dwl.c b/dwl.c -index b4fa1efe..8f0bb0df 100644 +index 4ff5c37f7..6c104bbb0 100644 --- a/dwl.c +++ b/dwl.c -@@ -88,6 +88,7 @@ typedef struct { +@@ -94,6 +94,7 @@ typedef struct { const Arg arg; } Button; @@ -19,37 +19,45 @@ index b4fa1efe..8f0bb0df 100644 typedef struct Monitor Monitor; typedef struct { /* Must keep these three elements in this order */ -@@ -177,6 +178,7 @@ struct Monitor { - struct wlr_box w; /* window area, layout-relative */ +@@ -185,6 +186,7 @@ struct Monitor { + struct wlr_box w; /* window area, layout-relative */ struct wl_list layers[4]; /* LayerSurface::link */ const Layout *lt[2]; + Pertag *pertag; unsigned int seltags; unsigned int sellt; - unsigned int tagset[2]; -@@ -377,6 +379,14 @@ static Atom netatom[NetLast]; + uint32_t tagset[2]; +@@ -413,6 +415,14 @@ static Atom netatom[NetLast]; /* attempt to encapsulate suck into one file */ #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 */ ++ int nmasters[TAGCOUNT + 1]; /* number of windows in master area */ ++ float mfacts[TAGCOUNT + 1]; /* mfacts per tag */ ++ unsigned int sellts[TAGCOUNT + 1]; /* selected layouts */ ++ const Layout *ltidxs[TAGCOUNT + 1][2]; /* matrix of tags and layouts indexes */ +}; + - /* compile-time check if all tags fit into an unsigned int bit array. */ - struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; + /* function implementations */ + void + applybounds(Client *c, struct wlr_box *bbox) +@@ -703,6 +713,7 @@ cleanupmon(struct wl_listener *listener, void *data) + wlr_scene_output_destroy(m->scene_output); + wlr_scene_node_destroy(&m->fullscreen_bg->node); -@@ -974,6 +984,18 @@ createmon(struct wl_listener *listener, void *data) ++ free(m->pertag); + closemon(m); + free(m); + } +@@ -944,6 +955,18 @@ createmon(struct wl_listener *listener, void *data) wl_list_insert(&mons, &m->link); printstatus(); + m->pertag = calloc(1, sizeof(Pertag)); + m->pertag->curtag = m->pertag->prevtag = 1; + -+ for (i = 0; i <= LENGTH(tags); i++) { ++ for (i = 0; i <= TAGCOUNT; i++) { + m->pertag->nmasters[i] = m->nmaster; + m->pertag->mfacts[i] = m->mfact; + @@ -58,10 +66,10 @@ index b4fa1efe..8f0bb0df 100644 + m->pertag->sellts[i] = m->sellt; + } + - /* Adds this to the output layout in the order it was configured in. + /* The xdg-protocol specifies: * - * The output layout utility automatically adds a wl_output global to the -@@ -1283,7 +1305,7 @@ incnmaster(const Arg *arg) + * If the fullscreened surface is not opaque, the compositor must make +@@ -1355,7 +1378,7 @@ incnmaster(const Arg *arg) { if (!arg || !selmon) return; @@ -70,7 +78,7 @@ index b4fa1efe..8f0bb0df 100644 arrange(selmon); } -@@ -1973,9 +1995,9 @@ setlayout(const Arg *arg) +@@ -2060,9 +2083,9 @@ setlayout(const Arg *arg) if (!selmon) return; if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) @@ -79,10 +87,10 @@ index b4fa1efe..8f0bb0df 100644 if (arg && arg->v) - selmon->lt[selmon->sellt] = (Layout *)arg->v; + selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v; - /* TODO change layout symbol? */ + strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol)); arrange(selmon); printstatus(); -@@ -1992,7 +2014,7 @@ setmfact(const Arg *arg) +@@ -2079,7 +2102,7 @@ setmfact(const Arg *arg) f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; if (f < 0.1 || f > 0.9) return; @@ -91,38 +99,38 @@ index b4fa1efe..8f0bb0df 100644 arrange(selmon); } -@@ -2348,9 +2370,30 @@ void +@@ -2423,10 +2446,30 @@ void toggleview(const Arg *arg) { - unsigned int newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0; + uint32_t newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0; + size_t i; - if (newtagset) { - selmon->tagset[selmon->seltags] = newtagset; -+ -+ if (newtagset == ~0) { -+ selmon->pertag->prevtag = selmon->pertag->curtag; -+ selmon->pertag->curtag = 0; -+ } + if (!newtagset) + return; + ++ if (newtagset == ~0) { ++ selmon->pertag->prevtag = selmon->pertag->curtag; ++ selmon->pertag->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; -+ for (i = 0; !(newtagset & 1 << i); i++) ; -+ selmon->pertag->curtag = i + 1; -+ } ++ /* test if the user did not select the same tag */ ++ if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) { ++ selmon->pertag->prevtag = selmon->pertag->curtag; ++ for (i = 0; !(newtagset & 1 << i); i++) ; ++ selmon->pertag->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]; ++ /* 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]; + - focusclient(focustop(selmon), 1); - arrange(selmon); - } -@@ -2468,11 +2511,36 @@ urgent(struct wl_listener *listener, void *data) + selmon->tagset[selmon->seltags] = newtagset; + focusclient(focustop(selmon), 1); + arrange(selmon); +@@ -2596,11 +2639,33 @@ urgent(struct wl_listener *listener, void *data) void view(const Arg *arg) { @@ -130,9 +138,6 @@ index b4fa1efe..8f0bb0df 100644 + if (!selmon || (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) return; -+ -+ if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) -+ selmon->seltags ^= 1; /* toggle sel tagset */ - if (arg->ui & TAGMASK) + if (arg->ui & TAGMASK) { |
