dwm.c
changeset 1031 7216ff510041
parent 1030 e50c3eb0f55a
child 1032 08bc44d1f985
equal deleted inserted replaced
1030:e50c3eb0f55a 1031:7216ff510041
    47 /* macros */
    47 /* macros */
    48 #define BUTTONMASK		(ButtonPressMask | ButtonReleaseMask)
    48 #define BUTTONMASK		(ButtonPressMask | ButtonReleaseMask)
    49 #define CLEANMASK(mask)		(mask & ~(numlockmask | LockMask))
    49 #define CLEANMASK(mask)		(mask & ~(numlockmask | LockMask))
    50 #define MOUSEMASK		(BUTTONMASK | PointerMotionMask)
    50 #define MOUSEMASK		(BUTTONMASK | PointerMotionMask)
    51 
    51 
    52 /* enums */
    52 /* local typedefs */
    53 enum { BarTop, BarBot, BarOff };			/* bar position */
       
    54 enum { CurNormal, CurResize, CurMove, CurLast };	/* cursor */
       
    55 enum { ColBorder, ColFG, ColBG, ColLast };		/* color */
       
    56 enum { NetSupported, NetWMName, NetLast };		/* EWMH atoms */
       
    57 enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */
       
    58 
       
    59 /* typedefs */
       
    60 typedef struct {
       
    61 	int x, y, w, h;
       
    62 	unsigned long norm[ColLast];
       
    63 	unsigned long sel[ColLast];
       
    64 	Drawable drawable;
       
    65 	GC gc;
       
    66 	struct {
       
    67 		int ascent;
       
    68 		int descent;
       
    69 		int height;
       
    70 		XFontSet set;
       
    71 		XFontStruct *xfont;
       
    72 	} font;
       
    73 } DC; /* draw context */
       
    74 
       
    75 typedef struct {
       
    76 	unsigned long mod;
       
    77 	KeySym keysym;
       
    78 	void (*func)(const char *arg);
       
    79 	const char *arg;
       
    80 } Key;
       
    81 
       
    82 typedef struct {
       
    83 	const char *symbol;
       
    84 	void (*arrange)(void);
       
    85 } Layout;
       
    86 
       
    87 typedef struct {
    53 typedef struct {
    88 	const char *prop;
    54 	const char *prop;
    89 	const char *tags;
    55 	const char *tags;
    90 	Bool isfloating;
    56 	Bool isfloating;
    91 } Rule;
    57 } Rule;
    92 
    58 
    93 typedef struct {
    59 typedef struct {
    94 	regex_t *propregex;
    60 	regex_t *propregex;
    95 	regex_t *tagregex;
    61 	regex_t *tagregex;
    96 } Regs;
    62 } Regs;
    97 
       
    98 /* forward declarations */
       
    99 void applyrules(Client *c);
       
   100 void arrange(void);
       
   101 void attach(Client *c);
       
   102 void attachstack(Client *c);
       
   103 void ban(Client *c);
       
   104 void buttonpress(XEvent *e);
       
   105 void checkotherwm(void);
       
   106 void cleanup(void);
       
   107 void compileregs(void);
       
   108 void configure(Client *c);
       
   109 void configurenotify(XEvent *e);
       
   110 void configurerequest(XEvent *e);
       
   111 void destroynotify(XEvent *e);
       
   112 void detach(Client *c);
       
   113 void detachstack(Client *c);
       
   114 void drawbar(void);
       
   115 void drawsquare(Bool filled, Bool empty, unsigned long col[ColLast]);
       
   116 void drawtext(const char *text, unsigned long col[ColLast]);
       
   117 void *emallocz(unsigned int size);
       
   118 void enternotify(XEvent *e);
       
   119 void eprint(const char *errstr, ...);
       
   120 void expose(XEvent *e);
       
   121 void floating(void); /* default floating layout */
       
   122 void focus(Client *c);
       
   123 void focusnext(const char *arg);
       
   124 void focusprev(const char *arg);
       
   125 Client *getclient(Window w);
       
   126 unsigned long getcolor(const char *colstr);
       
   127 long getstate(Window w);
       
   128 Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
       
   129 void grabbuttons(Client *c, Bool focused);
       
   130 unsigned int idxoftag(const char *tag);
       
   131 void initfont(const char *fontstr);
       
   132 Bool isarrange(void (*func)());
       
   133 Bool isoccupied(unsigned int t);
       
   134 Bool isprotodel(Client *c);
       
   135 Bool isvisible(Client *c);
       
   136 void keypress(XEvent *e);
       
   137 void killclient(const char *arg);
       
   138 void leavenotify(XEvent *e);
       
   139 void manage(Window w, XWindowAttributes *wa);
       
   140 void mappingnotify(XEvent *e);
       
   141 void maprequest(XEvent *e);
       
   142 void movemouse(Client *c);
       
   143 Client *nexttiled(Client *c);
       
   144 void propertynotify(XEvent *e);
       
   145 void quit(const char *arg);
       
   146 void resize(Client *c, int x, int y, int w, int h, Bool sizehints);
       
   147 void resizemouse(Client *c);
       
   148 void restack(void);
       
   149 void run(void);
       
   150 void scan(void);
       
   151 void setclientstate(Client *c, long state);
       
   152 void setlayout(const char *arg);
       
   153 void setmwfact(const char *arg);
       
   154 void setup(void);
       
   155 void spawn(const char *arg);
       
   156 void tag(const char *arg);
       
   157 unsigned int textnw(const char *text, unsigned int len);
       
   158 unsigned int textw(const char *text);
       
   159 void tile(void);
       
   160 void togglebar(const char *arg);
       
   161 void togglefloating(const char *arg);
       
   162 void togglemax(const char *arg);
       
   163 void toggletag(const char *arg);
       
   164 void toggleview(const char *arg);
       
   165 void unban(Client *c);
       
   166 void unmanage(Client *c);
       
   167 void unmapnotify(XEvent *e);
       
   168 void updatebarpos(void);
       
   169 void updatesizehints(Client *c);
       
   170 void updatetitle(Client *c);
       
   171 void view(const char *arg);
       
   172 void viewprevtag(const char *arg);	/* views previous selected tags */
       
   173 int xerror(Display *dpy, XErrorEvent *ee);
       
   174 int xerrordummy(Display *dsply, XErrorEvent *ee);
       
   175 int xerrorstart(Display *dsply, XErrorEvent *ee);
       
   176 void zoom(const char *arg);
       
   177 
    63 
   178 /* variables */
    64 /* variables */
   179 char stext[256];
    65 char stext[256];
   180 double mwfact;
    66 double mwfact;
   181 int screen, sx, sy, sw, sh, wax, way, waw, wah;
    67 int screen, sx, sy, sw, sh, wax, way, waw, wah;