2wm

dual window manager prototype (minimalist dwm with no tags, just one view)
git clone git://git.suckless.org/2wm
Log | Files | Refs | README | LICENSE

2wm.h (3847B)


      1 /* (C)opyright MMVII Anselm R. Garbe <garbeam at gmail dot com>
      2  * See LICENSE file for license details.
      3  */
      4 
      5 #include "config.h"
      6 #include <X11/Xlib.h>
      7 
      8 /* mask shorthands, used in event.c and client.c */
      9 #define BUTTONMASK		(ButtonPressMask | ButtonReleaseMask)
     10 
     11 enum { NetSupported, NetWMName, NetLast };		/* EWMH atoms */
     12 enum { WMProtocols, WMDelete, WMState, WMLast };	/* default atoms */
     13 enum { CurNormal, CurResize, CurMove, CurLast };	/* cursor */
     14 
     15 typedef union {
     16 	const char *cmd;
     17 	int i;
     18 } Arg; /* argument type */
     19 
     20 typedef struct Client Client;
     21 struct Client {
     22 	char name[256];
     23 	int x, y, w, h;
     24 	int rx, ry, rw, rh; /* revert geometry */
     25 	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
     26 	int minax, minay, maxax, maxay;
     27 	long flags; 
     28 	unsigned int border;
     29 	Bool isfixed, isfloat, ismax, view;
     30 	Client *next;
     31 	Client *prev;
     32 	Client *snext;
     33 	Window win;
     34 };
     35 
     36 extern int screen, sx, sy, sw, sh;		/* screen geometry */
     37 extern unsigned int master, nmaster;		/* master percent, number of master clients */
     38 extern unsigned int numlockmask;		/* dynamic key lock mask */
     39 extern void (*handler[LASTEvent])(XEvent *);	/* event handler */
     40 extern Atom wmatom[WMLast], netatom[NetLast];
     41 extern Bool running, selscreen, view;
     42 extern Client *clients, *sel, *stack;		/* global client list and stack */
     43 extern Cursor cursor[CurLast];
     44 extern unsigned long normcol, selcol;		/* sel/normal color */
     45 extern Display *dpy;
     46 extern Window root;
     47 
     48 /* client.c */
     49 extern void configure(Client *c);		/* send synthetic configure event */
     50 extern void detachclient(Client *c);		/* detaches c from global client list */
     51 extern void focus(Client *c);			/* focus c, c may be NULL */
     52 extern Client *getclient(Window w);		/* return client of w */
     53 extern Bool isprotodel(Client *c);		/* returns True if c->win supports wmatom[WMDelete] */
     54 extern void killclient(Arg *arg);		/* kill c nicely */
     55 extern void manage(Window w, XWindowAttributes *wa);	/* manage new client */
     56 extern void resize(Client *c, Bool sizehints);	/* resize c*/
     57 extern void updatesizehints(Client *c);		/* update the size hint variables of c */
     58 extern void updatetitle(Client *c);		/* update the name of c */
     59 extern void unmanage(Client *c);		/* destroy c */
     60 
     61 /* event.c */
     62 extern void grabkeys(void);			/* grab all keys defined in config.h */
     63 
     64 /* main.c */
     65 extern void quit(Arg *arg);			/* quit 2wm nicely */
     66 extern void sendevent(Window w, Atom a, long value);	/* send synthetic event to w */
     67 extern int xerror(Display *dsply, XErrorEvent *ee);	/* 2wm's X error handler */
     68 
     69 /* util.c */
     70 extern void *emallocz(unsigned int size);	/* allocates zero-initialized memory, exits on error */
     71 extern void eprint(const char *errstr, ...);	/* prints errstr and exits with 1 */
     72 extern void spawn(Arg *arg);			/* forks a new subprocess with to arg's cmd */
     73 
     74 /* view.c */
     75 extern void arrange(void);			/* arranges all windows tiled */
     76 extern void attach(Arg *arg);			/* attaches most recent detached client to view */
     77 extern void detach(Arg *arg);			/* detaches current client from view */
     78 extern void focusnext(Arg *arg);		/* focuses next visible client, arg is ignored  */
     79 extern void focusprev(Arg *arg);		/* focuses previous visible client, arg is ignored */
     80 extern void incnmaster(Arg *arg);		/* increments nmaster with arg's index value */
     81 extern void initrregs(void);			/* initialize regexps of rules defined in config.h */
     82 extern Bool isfloat(Client *c);			/* returns True if c is floatings */
     83 extern void resizemaster(Arg *arg);		/* resizes the master percent with arg's index value */
     84 extern void restack(void);			/* restores z layers of all clients */
     85 extern void togglefloat(Arg *arg);		/* toggles focusesd client between floating/non-floating state */
     86 extern void toggleview(Arg *arg);		/* toggles view */
     87 extern void zoom(Arg *arg);			/* zooms the focused client to master area, arg is ignored */