drawbar: Don't shadow sw global

This jarred me a bit while reading the code, since "sw" usually refers
to the global screen geometry, but in drawbar() only it refers to
text-related geometry. Renaming it makes it more obvious that these are
not related.
This commit is contained in:
bakkeby 2020-04-23 08:07:29 +02:00
parent 2d8d5a0931
commit 1bed3b0093
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
This dwm 6.2 (c4b475, 2020-04-20) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.
This dwm 6.2 (58de66, 2020-04-22) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.
For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/dwm-flexipatch/blob/master/patches.def.h):
```c

16
dwm.c
View File

@ -1414,7 +1414,7 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
int x, w, sw = 0, stw = 0, stp = 0, invert;
int x, w, tw = 0, stw = 0, stp = 0, invert;
#if ALTERNATIVE_TAGS_PATCH
int wdelta;
#endif // ALTERNATIVE_TAGS_PATCH
@ -1465,9 +1465,9 @@ drawbar(Monitor *m)
#endif // VTCOLORS_PATCH
#if STATUSCOLORS_PATCH
#if STATUSPADDING_PATCH
sw = textw_wosc(stext) + lrpad + 2;
tw = textw_wosc(stext) + lrpad + 2;
#else
sw = textw_wosc(stext) + 2;
tw = textw_wosc(stext) + 2;
#endif // STATUSPADDING_PATCH
while (1) {
if ((unsigned int)*ts > LENGTH(colors)) {
@ -1476,7 +1476,7 @@ drawbar(Monitor *m)
}
ctmp = *ts;
*ts = '\0';
drw_text(drw, m->ww - sw - stw + tx, 0, sw - tx, bh, stp, tp, 0);
drw_text(drw, m->ww - tw - stw + tx, 0, tw - tx, bh, stp, tp, 0);
tx += TEXTW(tp) -lrpad;
if (ctmp == '\0')
break;
@ -1486,11 +1486,11 @@ drawbar(Monitor *m)
}
#else // STATUSCOLORS_PATCH
#if STATUSPADDING_PATCH
sw = TEXTW(stext);
tw = TEXTW(stext);
#else
sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
#endif // STATUSPADDING_PATCH
drw_text(drw, m->ww - sw - stw, 0, sw, bh, stp, stext, 0);
drw_text(drw, m->ww - tw - stw, 0, tw, bh, stp, stext, 0);
#endif // STATUSCOLORS_PATCH
#if !STATUSALLMONS_PATCH
}
@ -1586,7 +1586,7 @@ drawbar(Monitor *m)
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
#endif // LEFTLAYOUT_PATCH
if ((w = m->ww - sw - stw - x) > bh)
if ((w = m->ww - tw - stw - x) > bh)
{
#if AWESOMEBAR_PATCH
if (n > 0) {