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
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 { WMProtocols, WMDelete, WMLast };
  33. enum { NetSupported, NetWMName, NetLast };
  34. /* cursor */
  35. enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
  36. struct Fnt {
  37. XFontStruct *xfont;
  38. XFontSet set;
  39. int ascent;
  40. int descent;
  41. int height;
  42. };
  43. struct DC { /* draw context */
  44. GC gc;
  45. Drawable drawable;
  46. int x, y, w, h;
  47. Fnt font;
  48. unsigned long bg;
  49. unsigned long fg;
  50. unsigned long border;
  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. Window win;
  64. Window title;
  65. Client *next;
  66. Client *revert;
  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 Display *dpy;
  81. extern Window root, barwin;
  82. extern Atom wmatom[WMLast], netatom[NetLast];
  83. extern Cursor cursor[CurLast];
  84. extern Bool running, issel;
  85. extern void (*handler[LASTEvent])(XEvent *);
  86. extern void (*arrange)(Arg *);
  87. extern Key key[];
  88. extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
  89. extern char *tags[TLast], stext[1024];
  90. extern DC dc;
  91. extern Client *clients, *sel;
  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 resize(Client *c, Bool inc);
  106. extern void setsize(Client *c);
  107. extern void settitle(Client *c);
  108. extern void unmanage(Client *c);
  109. extern void zoom(Arg *arg);
  110. /* draw.c */
  111. extern void drawall();
  112. extern void drawstatus();
  113. extern void drawtitle(Client *c);
  114. extern unsigned long getcolor(const char *colstr);
  115. extern void setfont(const char *fontstr);
  116. extern unsigned int textw(char *text);
  117. /* event.c */
  118. extern void grabkeys();
  119. /* main.c */
  120. extern int getproto(Window w);
  121. extern void quit(Arg *arg);
  122. extern void sendevent(Window w, Atom a, long value);
  123. extern int xerror(Display *dsply, XErrorEvent *ee);
  124. /* tag.c */
  125. extern void appendtag(Arg *arg);
  126. extern void dofloat(Arg *arg);
  127. extern void dotile(Arg *arg);
  128. extern Client *getnext(Client *c);
  129. extern void replacetag(Arg *arg);
  130. extern void settags(Client *c);
  131. extern void view(Arg *arg);
  132. /* util.c */
  133. extern void *emallocz(unsigned int size);
  134. extern void eprint(const char *errstr, ...);
  135. extern void spawn(Arg *arg);