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.

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