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.

41 lines
977 B

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