diff options
| author | bakkeby <[email protected]> | 2020-08-22 20:31:17 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2020-08-22 20:31:17 +0200 |
| commit | 81f44b036c733ba6494e14a5c358a62186c575be (patch) | |
| tree | 2dc3a5ccefa824df41cfad6bbbd0a0c45bd98619 /patch | |
| parent | 46ebaea58f121a33ed0d3ea07f40cfb70c9de2f9 (diff) | |
| download | dwm-flexipatch-81f44b036c733ba6494e14a5c358a62186c575be.tar.gz dwm-flexipatch-81f44b036c733ba6494e14a5c358a62186c575be.zip | |
Simplified Pango integration by settling on common function signatures.
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/bar_awesomebar.c | 4 | ||||
| -rw-r--r-- | patch/bar_fancybar.c | 4 | ||||
| -rw-r--r-- | patch/bar_flexwintitle.c | 2 | ||||
| -rw-r--r-- | patch/bar_ltsymbol.c | 4 | ||||
| -rw-r--r-- | patch/bar_status.c | 16 | ||||
| -rw-r--r-- | patch/bar_status2d.c | 18 | ||||
| -rw-r--r-- | patch/bar_statusbutton.c | 4 | ||||
| -rw-r--r-- | patch/bar_statuscmd.c | 6 | ||||
| -rw-r--r-- | patch/bar_tags.c | 8 | ||||
| -rw-r--r-- | patch/bar_wintitle.c | 15 |
10 files changed, 8 insertions, 73 deletions
diff --git a/patch/bar_awesomebar.c b/patch/bar_awesomebar.c index 00bb9e8..e3b80cc 100644 --- a/patch/bar_awesomebar.c +++ b/patch/bar_awesomebar.c @@ -44,11 +44,7 @@ draw_awesomebar(Bar *bar, BarDrawArg *a) #endif // BAR_CENTEREDWINDOWNAME_PATCH drw_setscheme(drw, scheme[scm]); - #if BAR_PANGO_PATCH drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, pad, c->name, 0, False); - #else - drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, pad, c->name, 0); - #endif // BAR_PANGO_PATCH if (c->isfloating) drawindicator(c->mon, c, 1, x, w, 0, 0, c->isfixed, floatindicatortype); x += tabw + (i < remainder ? 1 : 0); diff --git a/patch/bar_fancybar.c b/patch/bar_fancybar.c index 1e10ace..8bc5ff1 100644 --- a/patch/bar_fancybar.c +++ b/patch/bar_fancybar.c @@ -52,11 +52,7 @@ draw_fancybar(Bar *bar, BarDrawArg *a) ftw = MIN(m->sel == c ? w : mw, TEXTW(c->name)); drw_setscheme(drw, scheme[m->sel == c ? SchemeTitleSel : SchemeTitleNorm]); if (ftw > 0) /* trap special handling of 0 in drw_text */ - #if BAR_PANGO_PATCH drw_text(drw, x, 0, ftw, bh, lrpad / 2, c->name, 0, False); - #else - drw_text(drw, x, 0, ftw, bh, lrpad / 2, c->name, 0); - #endif // BAR_PANGO_PATCH if (c->isfloating) drawindicator(c->mon, c, 1, x, w, 0, 0, c->isfixed, floatindicatortype); x += ftw; diff --git a/patch/bar_flexwintitle.c b/patch/bar_flexwintitle.c index 8255fb8..22b5b3c 100644 --- a/patch/bar_flexwintitle.c +++ b/patch/bar_flexwintitle.c @@ -188,7 +188,7 @@ flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Ar pad = (w - TEXTW(c->name) + lrpad) / 2; #endif // BAR_CENTEREDWINDOWNAME_PATCH - drw_text(drw, x, 0, w, bh, pad, c->name, 0); + drw_text(drw, x, 0, w, bh, pad, c->name, 0, False); if (c->isfloating) drawindicator(m, c, 1, x + 2, w, 0, 0, 0, floatindicatortype); diff --git a/patch/bar_ltsymbol.c b/patch/bar_ltsymbol.c index 65ce2da..c600f5c 100644 --- a/patch/bar_ltsymbol.c +++ b/patch/bar_ltsymbol.c @@ -7,11 +7,7 @@ width_ltsymbol(Bar *bar, BarWidthArg *a) int draw_ltsymbol(Bar *bar, BarDrawArg *a) { - #if BAR_PANGO_PATCH return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, bar->mon->ltsymbol, 0, False); - #else - return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, bar->mon->ltsymbol, 0); - #endif // BAR_PANGO_PATCH } int diff --git a/patch/bar_status.c b/patch/bar_status.c index 0234276..756c97a 100644 --- a/patch/bar_status.c +++ b/patch/bar_status.c @@ -1,44 +1,28 @@ int width_status(Bar *bar, BarWidthArg *a) { - #if BAR_PANGO_PATCH return TEXTWM(stext); - #else - return TEXTW(stext); - #endif // BAR_PANGO_PATCH } #if BAR_EXTRASTATUS_PATCH int width_status_es(Bar *bar, BarWidthArg *a) { - #if BAR_PANGO_PATCH return TEXTWM(estext) - lrpad; - #else - return TEXTW(estext) - lrpad; - #endif // BAR_PANGO_PATCH } #endif // BAR_EXTRASTATUS_PATCH int draw_status(Bar *bar, BarDrawArg *a) { - #if BAR_PANGO_PATCH return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, stext, 0, True); - #else - return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, stext, 0); - #endif // BAR_PANGO_PATCH } #if BAR_EXTRASTATUS_PATCH int draw_status_es(Bar *bar, BarDrawArg *a) { - #if BAR_PANGO_PATCH return drw_text(drw, a->x, 0, a->w, bh, 0, estext, 0, True); - #else - return drw_text(drw, a->x, 0, a->w, bh, 0, estext, 0); - #endif // BAR_PANGO_PATCH } #endif // BAR_EXTRASTATUS_PATCH diff --git a/patch/bar_status2d.c b/patch/bar_status2d.c index 4fb1488..8122aa5 100644 --- a/patch/bar_status2d.c +++ b/patch/bar_status2d.c @@ -83,13 +83,8 @@ drawstatusbar(int x, char* stext) isCode = 1; text[i] = '\0'; - #if BAR_PANGO_PATCH w = TEXTWM(text) - lrpad; drw_text(drw, x, 0, w, bh, 0, text, 0, True); - #else - w = TEXTW(text) - lrpad; - drw_text(drw, x, 0, w, bh, 0, text, 0); - #endif // BAR_PANGO_PATCH x += w; @@ -156,13 +151,8 @@ drawstatusbar(int x, char* stext) } } if (!isCode) { - #if BAR_PANGO_PATCH w = TEXTWM(text) - lrpad; drw_text(drw, x, 0, w, bh, 0, text, 0, True); - #else - w = TEXTW(text) - lrpad; - drw_text(drw, x, 0, w, bh, 0, text, 0); - #endif // BAR_PANGO_PATCH x += w; } free(p); @@ -197,11 +187,7 @@ status2dtextlength(char* stext) if (!isCode) { isCode = 1; text[i] = '\0'; - #if BAR_PANGO_PATCH w += TEXTWM(text) - lrpad; - #else - w += TEXTW(text) - lrpad; - #endif // BAR_PANGO_PATCH text[i] = '^'; if (text[++i] == 'f') w += atoi(text + ++i); @@ -213,11 +199,7 @@ status2dtextlength(char* stext) } } if (!isCode) - #if BAR_PANGO_PATCH w += TEXTWM(text) - lrpad; - #else - w += TEXTW(text) - lrpad; - #endif // BAR_PANGO_PATCH free(p); return w; }
\ No newline at end of file diff --git a/patch/bar_statusbutton.c b/patch/bar_statusbutton.c index f5c9c9d..292b83e 100644 --- a/patch/bar_statusbutton.c +++ b/patch/bar_statusbutton.c @@ -7,11 +7,7 @@ width_stbutton(Bar *bar, BarWidthArg *a) int draw_stbutton(Bar *bar, BarDrawArg *a) { - #if BAR_PANGO_PATCH return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, buttonbar, 0, False); - #else - return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, buttonbar, 0); - #endif // BAR_PANGO_PATCH } int diff --git a/patch/bar_statuscmd.c b/patch/bar_statuscmd.c index 0cd6013..a73fbac 100644 --- a/patch/bar_statuscmd.c +++ b/patch/bar_statuscmd.c @@ -35,11 +35,9 @@ click_statuscmd_text(Arg *arg, int rel_x, char *text) text[i] = '\0'; #if BAR_STATUS2D_PATCH && !BAR_BAR_STATUSCOLORS_PATCH x += status2dtextlength(text); - #elif BAR_PANGO_PATCH - x += TEXTWM(text) - lrpad; #else - x += TEXTW(text) - lrpad; - #endif // STATUS2D_PATCH + x += TEXTWM(text) - lrpad; + #endif // BAR_STATUS2D_PATCH text[i] = ch; text += i+1; i = -1; diff --git a/patch/bar_tags.c b/patch/bar_tags.c index e84fd1a..895d244 100644 --- a/patch/bar_tags.c +++ b/patch/bar_tags.c @@ -63,14 +63,10 @@ draw_tags(Bar *bar, BarDrawArg *a) ? SchemeUrg : SchemeTagsNorm ]); - #if BAR_ALTERNATIVE_TAGS_PATCH && BAR_PANGO_PATCH + #if BAR_ALTERNATIVE_TAGS_PATCH drw_text(drw, x, 0, w, bh, wdelta + lrpad / 2, (selmon->alttag ? tagsalt[i] : tags[i]), invert, False); - #elif BAR_ALTERNATIVE_TAGS_PATCH - drw_text(drw, x, 0, w, bh, wdelta + lrpad / 2, (selmon->alttag ? tagsalt[i] : tags[i]), invert); - #elif BAR_PANGO_PATCH - drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], invert, False); #else - drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], invert); + drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], invert, False); #endif // BAR_ALTERNATIVE_TAGS_PATCH drawindicator(m, NULL, occ, x, w, i, -1, invert, tagindicatortype); x += w; diff --git a/patch/bar_wintitle.c b/patch/bar_wintitle.c index 0aded6c..c5de68f 100644 --- a/patch/bar_wintitle.c +++ b/patch/bar_wintitle.c @@ -17,6 +17,7 @@ draw_wintitle(Bar *bar, BarDrawArg *a) int x = a->x, w = a->w; #endif // BAR_TITLE_LEFT_PAD_PATCH | BAR_TITLE_RIGHT_PAD_PATCH Monitor *m = bar->mon; + int pad = lrpad / 2; if (!m->sel) { drw_setscheme(drw, scheme[SchemeTitleNorm]); @@ -29,19 +30,9 @@ draw_wintitle(Bar *bar, BarDrawArg *a) XSetErrorHandler(xerrordummy); #endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH #if BAR_CENTEREDWINDOWNAME_PATCH - int mid = (m->ww - TEXTW(m->sel->name)) / 2 - x; - #if BAR_PANGO_PATCH - drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0, False); - #else - drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0); - #endif // BAR_PANGO_PATCH - #else - #if BAR_PANGO_PATCH - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0, False); - #else - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); - #endif // BAR_PANGO_PATCH + pad = (m->ww - TEXTW(m->sel->name)) / 2 - x; #endif // BAR_CENTEREDWINDOWNAME_PATCH + drw_text(drw, x, 0, w, bh, pad, m->sel->name, 0, False); #if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH XSync(dpy, False); XSetErrorHandler(xerror); |
