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.

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