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.

158 lines
3.4 KiB

19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
  1. /*
  2. * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
  3. * See LICENSE file for license details.
  4. */
  5. #include <X11/Xlib.h>
  6. /********** CUSTOMIZE **********/
  7. #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
  8. #define BGCOLOR "#0a2c2d"
  9. #define FGCOLOR "#ddeeee"
  10. #define BORDERCOLOR "#176164"
  11. /*
  12. #define BGCOLOR "#666699"
  13. #define FGCOLOR "#eeeeee"
  14. #define BORDERCOLOR "#9999CC"
  15. */
  16. #define MASTERW 52 /* percent */
  17. #define WM_PROTOCOL_DELWIN 1
  18. /* tags */
  19. enum { Tscratch, Tdev, Twww, Twork, TLast };
  20. /********** CUSTOMIZE **********/
  21. typedef union Arg Arg;
  22. typedef struct DC DC;
  23. typedef struct Client Client;
  24. typedef struct Fnt Fnt;
  25. typedef struct Key Key;
  26. typedef struct Rule Rule;
  27. union Arg {
  28. const char **argv;
  29. int i;
  30. };
  31. /* atoms */
  32. enum { NetSupported, NetWMName, NetLast };
  33. enum { WMProtocols, WMDelete, WMLast };
  34. /* cursor */
  35. enum { CurNormal, CurResize, CurMove, CurLast };
  36. struct Fnt {
  37. int ascent;
  38. int descent;
  39. int height;
  40. XFontSet set;
  41. XFontStruct *xfont;
  42. };
  43. struct DC { /* draw context */
  44. int x, y, w, h;
  45. unsigned long bg;
  46. unsigned long fg;
  47. unsigned long border;
  48. Drawable drawable;
  49. Fnt font;
  50. GC gc;
  51. };
  52. struct Client {
  53. char name[256];
  54. char *tags[TLast];
  55. int proto;
  56. int x, y, w, h;
  57. int tx, ty, tw, th;
  58. int basew, baseh, incw, inch, maxw, maxh, minw, minh;
  59. int grav;
  60. unsigned int border;
  61. long flags;
  62. Bool isfloat;
  63. Client *next;
  64. Client *revert;
  65. Window win;
  66. Window title;
  67. };
  68. struct Rule {
  69. const char *class;
  70. const char *instance;
  71. char *tags[TLast];
  72. Bool isfloat;
  73. };
  74. struct Key {
  75. unsigned long mod;
  76. KeySym keysym;
  77. void (*func)(Arg *arg);
  78. Arg arg;
  79. };
  80. extern char *tags[TLast], stext[1024];
  81. extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
  82. extern void (*handler[LASTEvent])(XEvent *);
  83. extern void (*arrange)(Arg *);
  84. extern Atom wmatom[WMLast], netatom[NetLast];
  85. extern Bool running, issel;
  86. extern Client *clients, *sel;
  87. extern Cursor cursor[CurLast];
  88. extern DC dc;
  89. extern Display *dpy;
  90. extern Key key[];
  91. extern Window root, barwin;
  92. /* client.c */
  93. extern void ban(Client *c);
  94. extern void focus(Client *c);
  95. extern void focusnext(Arg *arg);
  96. extern void focusprev(Arg *arg);
  97. extern Client *getclient(Window w);
  98. extern Client *getctitle(Window w);
  99. extern void gravitate(Client *c, Bool invert);
  100. extern void higher(Client *c);
  101. extern void killclient(Arg *arg);
  102. extern void lower(Client *c);
  103. extern void manage(Window w, XWindowAttributes *wa);
  104. extern void maximize(Arg *arg);
  105. extern void pop(Client *c);
  106. extern void resize(Client *c, Bool inc);
  107. extern void setsize(Client *c);
  108. extern void settitle(Client *c);
  109. extern void unmanage(Client *c);
  110. extern void zoom(Arg *arg);
  111. /* draw.c */
  112. extern void drawall();
  113. extern void drawstatus();
  114. extern void drawtitle(Client *c);
  115. extern unsigned long getcolor(const char *colstr);
  116. extern void setfont(const char *fontstr);
  117. extern unsigned int textw(char *text);
  118. /* event.c */
  119. extern void grabkeys();
  120. /* main.c */
  121. extern int getproto(Window w);
  122. extern void quit(Arg *arg);
  123. extern void sendevent(Window w, Atom a, long value);
  124. extern int xerror(Display *dsply, XErrorEvent *ee);
  125. /* tag.c */
  126. extern void appendtag(Arg *arg);
  127. extern void dofloat(Arg *arg);
  128. extern void dotile(Arg *arg);
  129. extern Client *getnext(Client *c, unsigned int t);
  130. extern void heretag(Arg *arg);
  131. extern void replacetag(Arg *arg);
  132. extern void settags(Client *c);
  133. extern void view(Arg *arg);
  134. /* util.c */
  135. extern void *emallocz(unsigned int size);
  136. extern void eprint(const char *errstr, ...);
  137. extern void spawn(Arg *arg);