You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
840 B

  1. /*
  2. * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
  3. * See LICENSE file for license details.
  4. */
  5. #include "dwm.h"
  6. void
  7. draw_bar()
  8. {
  9. int i;
  10. dc.x = dc.y = 0;
  11. dc.w = bw;
  12. drawtext(NULL, False);
  13. dc.w = 0;
  14. for(i = 0; i < TLast; i++) {
  15. dc.x += dc.w;
  16. dc.w = textw(tags[i]) + dc.font.height;
  17. if(i == tsel) {
  18. swap((void **)&dc.fg, (void **)&dc.bg);
  19. drawtext(tags[i], True);
  20. swap((void **)&dc.fg, (void **)&dc.bg);
  21. }
  22. else
  23. drawtext(tags[i], True);
  24. }
  25. if(sel) {
  26. swap((void **)&dc.fg, (void **)&dc.bg);
  27. dc.x += dc.w;
  28. dc.w = textw(sel->name) + dc.font.height;
  29. drawtext(sel->name, True);
  30. swap((void **)&dc.fg, (void **)&dc.bg);
  31. }
  32. dc.w = textw(stext) + dc.font.height;
  33. dc.x = bx + bw - dc.w;
  34. drawtext(stext, False);
  35. XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
  36. XFlush(dpy);
  37. }