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.

137 lines
3.2 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
  1. /*
  2. * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
  3. * See LICENSE file for license details.
  4. */
  5. #include "config.h"
  6. #include <X11/Xlib.h>
  7. /* mask shorthands, used in event.c and client.c */
  8. #define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
  9. #define MOUSEMASK (BUTTONMASK | PointerMotionMask)
  10. #define PROTODELWIN 1
  11. typedef union Arg Arg;
  12. typedef struct Client Client;
  13. typedef struct DC DC;
  14. typedef struct Fnt Fnt;
  15. union Arg {
  16. const char *cmd;
  17. int i;
  18. };
  19. /* atoms */
  20. enum { NetSupported, NetWMName, NetActiveWindow, NetLast };
  21. enum { WMProtocols, WMDelete, WMLast };
  22. /* cursor */
  23. enum { CurNormal, CurResize, CurMove, CurLast };
  24. /* windowcorners */
  25. typedef enum { TopLeft, TopRight, BotLeft, BotRight } Corner;
  26. struct Fnt {
  27. int ascent;
  28. int descent;
  29. int height;
  30. XFontSet set;
  31. XFontStruct *xfont;
  32. };
  33. struct DC { /* draw context */
  34. int x, y, w, h;
  35. unsigned long bg;
  36. unsigned long fg;
  37. unsigned long border;
  38. Drawable drawable;
  39. Fnt font;
  40. GC gc;
  41. };
  42. struct Client {
  43. char name[256];
  44. int proto;
  45. int x, y, w, h;
  46. int tx, ty, tw, th; /* title */
  47. int basew, baseh, incw, inch, maxw, maxh, minw, minh;
  48. int grav;
  49. long flags;
  50. unsigned int border;
  51. Bool isfloat;
  52. Bool ismax;
  53. Bool *tags;
  54. Client *next;
  55. Client *prev;
  56. Window win;
  57. Window title;
  58. };
  59. extern const char *tags[];
  60. extern char stext[1024];
  61. extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
  62. extern unsigned int ntags;
  63. extern void (*handler[LASTEvent])(XEvent *);
  64. extern void (*arrange)(Arg *);
  65. extern Atom wmatom[WMLast], netatom[NetLast];
  66. extern Bool running, issel;
  67. extern Client *clients, *sel;
  68. extern Cursor cursor[CurLast];
  69. extern DC dc;
  70. extern Display *dpy;
  71. extern Window root, barwin;
  72. /* client.c */
  73. extern void ban(Client *c);
  74. extern void focus(Client *c);
  75. extern void focusnext(Arg *arg);
  76. extern void focusprev(Arg *arg);
  77. extern Client *getclient(Window w);
  78. extern Client *getctitle(Window w);
  79. extern void gravitate(Client *c, Bool invert);
  80. extern void higher(Client *c);
  81. extern void killclient(Arg *arg);
  82. extern void lower(Client *c);
  83. extern void manage(Window w, XWindowAttributes *wa);
  84. extern void resize(Client *c, Bool sizehints, Corner sticky);
  85. extern void setsize(Client *c);
  86. extern void settitle(Client *c);
  87. extern void togglemax(Arg *arg);
  88. extern void unmanage(Client *c);
  89. extern void zoom(Arg *arg);
  90. /* draw.c */
  91. extern void drawall();
  92. extern void drawstatus();
  93. extern void drawtitle(Client *c);
  94. extern unsigned long getcolor(const char *colstr);
  95. extern void setfont(const char *fontstr);
  96. extern unsigned int textw(const char *text);
  97. /* event.c */
  98. extern void grabkeys();
  99. /* main.c */
  100. extern int getproto(Window w);
  101. extern void quit(Arg *arg);
  102. extern void sendevent(Window w, Atom a, long value);
  103. extern int xerror(Display *dsply, XErrorEvent *ee);
  104. /* tag.c */
  105. extern void appendtag(Arg *arg);
  106. extern void dofloat(Arg *arg);
  107. extern void dotile(Arg *arg);
  108. extern void initrregs();
  109. extern Client *getnext(Client *c);
  110. extern Client *getprev(Client *c);
  111. extern void replacetag(Arg *arg);
  112. extern void settags(Client *c);
  113. extern void togglemode(Arg *arg);
  114. extern void view(Arg *arg);
  115. extern void viewnext(Arg *arg);
  116. extern void viewprev(Arg *arg);
  117. /* util.c */
  118. extern void *emallocz(unsigned int size);
  119. extern void eprint(const char *errstr, ...);
  120. extern void spawn(Arg *arg);