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.

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