Xinqi Bao's Git
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
9 /* mask shorthands, used in event.c and client.c */
10 #define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
11 #define MOUSEMASK (BUTTONMASK | PointerMotionMask)
14 enum { NetSupported
, NetWMName
, NetLast
}; /* EWMH atoms */
15 enum { WMProtocols
, WMDelete
, WMLast
}; /* default atoms */
16 enum { CurNormal
, CurResize
, CurMove
, CurLast
}; /* cursor */
17 enum { ColFG
, ColBG
, ColLast
}; /* color */
20 TopLeft
, TopRight
, BotLeft
, BotRight
21 } Corner
; /* window corners */
26 } Arg
; /* argument type */
38 unsigned long norm
[ColLast
];
39 unsigned long sel
[ColLast
];
40 unsigned long status
[ColLast
];
44 } DC
; /* draw context */
46 typedef struct Client Client
;
51 int tx
, ty
, tw
, th
; /* title */
52 int basew
, baseh
, incw
, inch
, maxw
, maxh
, minw
, minh
;
55 unsigned int border
, weight
;
65 extern const char *tags
[]; /* all tags */
66 extern char stext
[1024]; /* status text */
67 extern int bx
, by
, bw
, bh
, bmw
; /* bar geometry, bar mode label width */
68 extern int mw
, screen
, sx
, sy
, sw
, sh
; /* screen geometry, master width */
69 extern unsigned int ntags
, numlockmask
; /* number of tags, and dynamic lock mask */
70 extern void (*handler
[LASTEvent
])(XEvent
*); /* event handler */
71 extern void (*arrange
)(Arg
*); /* arrange function, indicates mode */
72 extern Atom wmatom
[WMLast
], netatom
[NetLast
];
73 extern Bool running
, issel
, maximized
, *seltag
; /* seltag is array of Bool */
74 extern Client
*clients
, *sel
, *stack
; /* Client containers */
75 extern Cursor cursor
[CurLast
];
76 extern DC dc
; /* draw context for everything */
78 extern Window root
, barwin
;
81 extern void ban(Client
*c
); /* ban client from screen */
82 extern void focus(Client
*c
); /* focus c, c may be NULL */
83 extern Client
*getclient(Window w
); /* return client of w */
84 extern Client
*getctitle(Window w
); /* return client of title window */
85 extern void gravitate(Client
*c
, Bool invert
); /* gravitate c */
86 extern void killclient(Arg
*arg
); /* kill c nicely */
87 extern void manage(Window w
, XWindowAttributes
*wa
); /* manage new client */
88 extern void resize(Client
*c
, Bool sizehints
, Corner sticky
); /* resize c*/
89 extern void setsize(Client
*c
); /* set the size structs of c */
90 extern void settitle(Client
*c
); /* set the name of c */
91 extern void togglemax(Arg
*arg
); /* (un)maximize c */
92 extern void unmanage(Client
*c
); /* destroy c */
95 extern void drawall(); /* draw all visible client titles and the bar */
96 extern void drawstatus(); /* draw the bar */
97 extern void drawtitle(Client
*c
); /* draw title of c */
98 extern unsigned long getcolor(const char *colstr
); /* return color of colstr */
99 extern void setfont(const char *fontstr
); /* set the font for DC */
100 extern unsigned int textw(const char *text
); /* return the text width of text */
103 extern void grabkeys(); /* grab all keys defined in config.h */
104 extern void procevent(); /* process pending X events */
107 extern int getproto(Window w
); /* return protocol mask of WMProtocols property of w */
108 extern void quit(Arg
*arg
); /* quit dwm nicely */
109 extern void sendevent(Window w
, Atom a
, long value
); /* send synthetic event to w */
110 extern int xerror(Display
*dsply
, XErrorEvent
*ee
); /* dwm's X error handler */
113 extern void initrregs(); /* initialize regexps of rules defined in config.h */
114 extern Client
*getnext(Client
*c
); /* returns next visible client */
115 extern Client
*getprev(Client
*c
); /* returns previous visible client */
116 extern void settags(Client
*c
, Client
*trans
); /* updates tags of c */
117 extern void tag(Arg
*arg
); /* tags c accordingly to arg's index */
118 extern void toggletag(Arg
*arg
); /* toggles c tags accordingly to arg's index */
121 extern void *emallocz(unsigned int size
); /* allocates zero-initialized memory, exits on error */
122 extern void eprint(const char *errstr
, ...); /* prints error string and exits with return code 1 */
123 extern void *erealloc(void *ptr
, unsigned int size
); /* reallocates memory, exits on error */
124 extern void spawn(Arg
*arg
) /* forks a new subprocess accordingly to arg's cmd */
127 extern void detach(Client
*c
); /* detaches c from global client list */
128 extern void dofloat(Arg
*arg
); /* arranges all windows in a floating way, arg is ignored */
129 extern void dotile(Arg
*arg
); /* arranges all windows in a tiled way, arg is ignored */
130 extern void focusnext(Arg
*arg
); /* focuses next visible client, arg is ignored */
131 extern void focusprev(Arg
*arg
); /* focuses previous visible client, arg is ignored */
132 extern Bool
isvisible(Client
*c
); /* returns True if client is visible */
133 extern void resizecol(Arg
*arg
); /* resizes the master width accordingly to arg's index value */
134 extern void restack(); /* restores z layers of all clients */
135 extern void togglemode(Arg
*arg
); /* toggles global arrange mode (between dotile and dofloat) */
136 extern void toggleview(Arg
*arg
); /* makes the tag accordingly to arg's index (in)visible */
137 extern void view(Arg
*arg
); /* makes the tag accordingly to arg's index visible */
138 extern void viewall(Arg
*arg
); /* makes all tags visible, arg is ignored */
139 extern void zoom(Arg
*arg
); /* zooms the focused client to master column, arg is ignored */