aewl

annotate dwm.h @ 453:f30f937f9e52

small fix
author Anselm R. Garbe <arg@10kloc.org>
date Mon, 11 Sep 2006 08:58:58 +0200
parents 026aba558fdf
children ffb462fb7903
rev   line source
garbeam@0 1 /*
garbeam@0 2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
garbeam@0 3 * See LICENSE file for license details.
garbeam@0 4 */
garbeam@0 5
arg@166 6 #include "config.h"
garbeam@32 7 #include <X11/Xlib.h>
garbeam@32 8
arg@143 9 /* mask shorthands, used in event.c and client.c */
arg@150 10 #define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
arg@150 11 #define MOUSEMASK (BUTTONMASK | PointerMotionMask)
arg@157 12 #define PROTODELWIN 1
arg@143 13
arg@452 14 enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
arg@452 15 enum { WMProtocols, WMDelete, WMLast }; /* default atoms */
arg@452 16 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
arg@452 17 enum { ColFG, ColBG, ColLast }; /* color */
arg@452 18
arg@452 19 typedef enum {
arg@452 20 TopLeft, TopRight, BotLeft, BotRight
arg@452 21 } Corner; /* window corners */
arg@452 22
arg@333 23 typedef union {
arg@189 24 const char *cmd;
garbeam@49 25 int i;
arg@452 26 } Arg; /* argument type */
arg@99 27
arg@333 28 typedef struct {
garbeam@32 29 int ascent;
garbeam@32 30 int descent;
garbeam@32 31 int height;
garbeam@84 32 XFontSet set;
garbeam@84 33 XFontStruct *xfont;
arg@333 34 } Fnt;
garbeam@32 35
arg@452 36 typedef struct {
garbeam@32 37 int x, y, w, h;
arg@353 38 unsigned long norm[ColLast];
arg@353 39 unsigned long sel[ColLast];
arg@353 40 unsigned long status[ColLast];
garbeam@84 41 Drawable drawable;
garbeam@84 42 Fnt font;
garbeam@84 43 GC gc;
arg@452 44 } DC; /* draw context */
garbeam@32 45
arg@333 46 typedef struct Client Client;
garbeam@0 47 struct Client {
garbeam@31 48 char name[256];
garbeam@13 49 int proto;
arg@115 50 int x, y, w, h;
arg@453 51 int tx, ty, tw, th; /* title window geometry */
garbeam@20 52 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
garbeam@29 53 int grav;
arg@164 54 long flags;
arg@381 55 unsigned int border, weight;
garbeam@80 56 Bool isfloat;
arg@178 57 Bool *tags;
garbeam@84 58 Client *next;
arg@127 59 Client *prev;
arg@446 60 Client *snext;
garbeam@0 61 Window win;
arg@342 62 Window twin;
garbeam@0 63 };
garbeam@0 64
arg@452 65 extern const char *tags[]; /* all tags */
arg@452 66 extern char stext[1024]; /* status text */
arg@452 67 extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
arg@452 68 extern int mw, screen, sx, sy, sw, sh; /* screen geometry, master width */
arg@452 69 extern unsigned int ntags, numlockmask; /* number of tags, and dynamic lock mask */
arg@452 70 extern void (*handler[LASTEvent])(XEvent *); /* event handler */
arg@452 71 extern void (*arrange)(Arg *); /* arrange function, indicates mode */
garbeam@84 72 extern Atom wmatom[WMLast], netatom[NetLast];
arg@452 73 extern Bool running, issel, maximized, *seltag; /* seltag is array of Bool */
arg@452 74 extern Client *clients, *sel, *stack; /* Client containers */
garbeam@84 75 extern Cursor cursor[CurLast];
arg@452 76 extern DC dc; /* draw context for everything */
garbeam@84 77 extern Display *dpy;
garbeam@84 78 extern Window root, barwin;
garbeam@3 79
garbeam@5 80 /* client.c */
arg@452 81 extern void ban(Client *c); /* ban client from screen */
arg@452 82 extern void focus(Client *c); /* focus c, c may be NULL */
arg@452 83 extern Client *getclient(Window w); /* return client of w */
arg@452 84 extern Client *getctitle(Window w); /* return client of title window */
arg@452 85 extern void gravitate(Client *c, Bool invert); /* gravitate c */
arg@452 86 extern void killclient(Arg *arg); /* kill c nicely */
arg@452 87 extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
arg@452 88 extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
arg@452 89 extern void setsize(Client *c); /* set the size structs of c */
arg@452 90 extern void settitle(Client *c); /* set the name of c */
arg@452 91 extern void togglemax(Arg *arg); /* (un)maximize c */
arg@452 92 extern void unmanage(Client *c); /* destroy c */
garbeam@13 93
garbeam@33 94 /* draw.c */
arg@452 95 extern void drawall(); /* draw all visible client titles and the bar */
arg@452 96 extern void drawstatus(); /* draw the bar */
arg@452 97 extern void drawtitle(Client *c); /* draw title of c */
arg@452 98 extern unsigned long getcolor(const char *colstr); /* return color of colstr */
arg@452 99 extern void setfont(const char *fontstr); /* set the font for DC */
arg@452 100 extern unsigned int textw(const char *text); /* return the text width of text */
garbeam@33 101
garbeam@75 102 /* event.c */
arg@452 103 extern void grabkeys(); /* grab all keys defined in config.h */
arg@452 104 extern void procevent(); /* process pending X events */
garbeam@18 105
garbeam@43 106 /* main.c */
arg@452 107 extern int getproto(Window w); /* return protocol mask of WMProtocols property of w */
arg@452 108 extern void quit(Arg *arg); /* quit dwm nicely */
arg@452 109 extern void sendevent(Window w, Atom a, long value); /* send synthetic event to w */
arg@452 110 extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
garbeam@43 111
garbeam@75 112 /* tag.c */
arg@452 113 extern void initrregs(); /* initialize regexps of rules defined in config.h */
arg@452 114 extern Client *getnext(Client *c); /* returns next visible client */
arg@452 115 extern Client *getprev(Client *c); /* returns previous visible client */
arg@452 116 extern void settags(Client *c, Client *trans); /* updates tags of c */
arg@452 117 extern void tag(Arg *arg); /* tags c accordingly to arg's index */
arg@452 118 extern void toggletag(Arg *arg); /* toggles c tags accordingly to arg's index */
garbeam@73 119
garbeam@32 120 /* util.c */
arg@452 121 extern void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */
arg@452 122 extern void eprint(const char *errstr, ...); /* prints error string and exits with return code 1 */
arg@452 123 extern void *erealloc(void *ptr, unsigned int size); /* reallocates memory, exits on error */
arg@453 124 extern void spawn(Arg *arg); /* forks a new subprocess accordingly to arg's cmd */
arg@327 125
arg@327 126 /* view.c */
arg@452 127 extern void detach(Client *c); /* detaches c from global client list */
arg@452 128 extern void dofloat(Arg *arg); /* arranges all windows in a floating way, arg is ignored */
arg@452 129 extern void dotile(Arg *arg); /* arranges all windows in a tiled way, arg is ignored */
arg@452 130 extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
arg@452 131 extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
arg@452 132 extern Bool isvisible(Client *c); /* returns True if client is visible */
arg@452 133 extern void resizecol(Arg *arg); /* resizes the master width accordingly to arg's index value */
arg@452 134 extern void restack(); /* restores z layers of all clients */
arg@452 135 extern void togglemode(Arg *arg); /* toggles global arrange mode (between dotile and dofloat) */
arg@452 136 extern void toggleview(Arg *arg); /* makes the tag accordingly to arg's index (in)visible */
arg@452 137 extern void view(Arg *arg); /* makes the tag accordingly to arg's index visible */
arg@452 138 extern void viewall(Arg *arg); /* makes all tags visible, arg is ignored */
arg@452 139 extern void zoom(Arg *arg); /* zooms the focused client to master column, arg is ignored */