diff options
| author | bakkeby <[email protected]> | 2020-07-15 08:57:30 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2020-07-15 08:57:30 +0200 |
| commit | 903b32ac8b4a69b37981874f23b15a9f65f2a20d (patch) | |
| tree | b7aff3bdd522721a03cbfdaea8adf15fefd90463 /patch/bar_wintitle.c | |
| parent | 1584a32063cd252ec726dd18747c5f91f12f8be9 (diff) | |
| download | dwm-flexipatch-903b32ac8b4a69b37981874f23b15a9f65f2a20d.tar.gz dwm-flexipatch-903b32ac8b4a69b37981874f23b15a9f65f2a20d.zip | |
Major refactoring in preparation for bar modules
Diffstat (limited to 'patch/bar_wintitle.c')
| -rw-r--r-- | patch/bar_wintitle.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/patch/bar_wintitle.c b/patch/bar_wintitle.c new file mode 100644 index 0000000..e937723 --- /dev/null +++ b/patch/bar_wintitle.c @@ -0,0 +1,89 @@ +int +width_wintitle(Monitor *m, int max_width) +{ + return max_width; +} + +int +draw_wintitle(Monitor *m, int x, int w) +{ + #if !BAR_ACTIVETAGINDICATORBAR_PATCH && !BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH + #if BAR_PANGO_PATCH + int boxs = drw->font->h / 9; + #else + int boxs = drw->fonts->h / 9; + #endif // BAR_PANGO_PATCH + #endif // BAR_ACTIVETAGINDICATORBAR_PATCH | BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH + #if BAR_PANGO_PATCH + int boxw = drw->font->h / 6 + 2; + #else + int boxw = drw->fonts->h / 6 + 2; + #endif // BAR_PANGO_PATCH + + if (m->sel) { + #if BAR_VTCOLORS_PATCH + drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]); + #elif BAR_TITLECOLOR_PATCH + drw_setscheme(drw, scheme[m == selmon ? SchemeTitle : SchemeNorm]); + #else + drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); + #endif // BAR_VTCOLORS_PATCH / BAR_TITLECOLOR_PATCH + #if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH + 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_PADDING_PATCH && BAR_PANGO_PATCH + drw_text(drw, x, 0, w - 2*sp, bh, mid, m->sel->name, 0, False); + #elif BAR_PADDING_PATCH + drw_text(drw, x, 0, w - 2*sp, bh, mid, m->sel->name, 0); + #elif 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_PADDING_PATCH + #else + #if BAR_PADDING_PATCH && BAR_PANGO_PATCH + drw_text(drw, x, 0, w - 2*sp, bh, lrpad / 2, m->sel->name, 0, False); + #elif BAR_PADDING_PATCH + drw_text(drw, x, 0, w - 2*sp, bh, lrpad / 2, m->sel->name, 0); + #elif 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_PADDING_PATCH + #endif // BAR_CENTEREDWINDOWNAME_PATCH + #if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH + XSync(dpy, False); + XSetErrorHandler(xerror); + #endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH + if (m->sel->isfloating) + #if BAR_ACTIVETAGINDICATORBAR_PATCH + drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw, m->sel->isfixed, 0); + #elif BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH + drw_rect(drw, x + boxw, bh - boxw/2, w - ( 2 * boxw + 1), boxw/2, + #else + drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); + #endif // BAR_ACTIVETAGINDICATORBAR_PATCH + } else { + #if BAR_VTCOLORS_PATCH + drw_setscheme(drw, scheme[SchemeTitleNorm]); + #else + drw_setscheme(drw, scheme[SchemeNorm]); + #endif // BAR_VTCOLORS_PATCH + #if BAR_PADDING_PATCH + drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1); + #else + drw_rect(drw, x, 0, w, bh, 1, 1); + #endif // BAR_PADDING_PATCH + } + return x + w; +} + +int +click_wintitle(Monitor *m, Arg *arg, int rel_x, int rel_y, int rel_w, int rel_h) +{ + return ClkWinTitle; +} + + |
