diff -r d04ee4e2336d config.def.h
--- a/config.def.h	Wed Jun 04 11:49:46 2008 +0200
+++ b/config.def.h	Wed Jun 04 19:01:42 2008 +0200
@@ -1,35 +1,36 @@
 /* See LICENSE file for copyright and license details. */
 
 /* appearance */
-#define FONT            "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*"
+#define FONT            "-*-terminus-bold-r-normal-*-14-*-*-*-*-*-*-*"
 #define NORMBORDERCOLOR "#cccccc"
-#define NORMBGCOLOR     "#cccccc"
+#define NORMBGCOLOR     "#eeeeee"
 #define NORMFGCOLOR     "#000000"
 #define SELBORDERCOLOR  "#0066ff"
-#define SELBGCOLOR      "#0066ff"
-#define SELFGCOLOR      "#ffffff"
-unsigned int borderpx  = 1;        /* border pixel of windows */
+#define SELBGCOLOR      "#eeeeee"
+#define SELFGCOLOR      "#0066ff"
+unsigned int borderpx  = 3;        /* border pixel of windows */
 unsigned int snap      = 32;       /* snap pixel */
 Bool showbar           = True;     /* False means no bar */
 Bool topbar            = True;     /* False means bottom bar */
 
 /* tagging */
-const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "w" };
 
 Rule rules[] = {
 	/* class      instance    title       tags ref      isfloating */
 	{ "Gimp",     NULL,       NULL,       0,            True },
-	{ "Firefox",  NULL,       NULL,       1 << 8,       True },
+	{ "Firefox",  NULL,       NULL,       1 << 4,       False },
+	{ "MPlayer",  NULL,	  NULL,	      0,	    True },
 };
 
 /* layout(s) */
-double mfact           = 0.55;
+double mfact           = 0.65;
 Bool resizehints       = False;     /* False means respect size hints in tiled resizals */
 
 Layout layouts[] = {
 	/* symbol     arrange function */
 	{ "[]=",      tile }, /* first entry is default */
-	{ "><>",      NULL }, /* no layout function means floating behavior */
+	{ "< >",      NULL }, /* no layout function means floating behavior */
 };
 
 /* key definitions */
@@ -61,10 +62,34 @@
 	TAGKEYS(                        XK_2,                      (uint[]){ 1 << 1} )
 	TAGKEYS(                        XK_3,                      (uint[]){ 1 << 2} )
 	TAGKEYS(                        XK_4,                      (uint[]){ 1 << 3} )
-	TAGKEYS(                        XK_5,                      (uint[]){ 1 << 4} )
-	TAGKEYS(                        XK_6,                      (uint[]){ 1 << 5} )
-	TAGKEYS(                        XK_7,                      (uint[]){ 1 << 6} )
-	TAGKEYS(                        XK_8,                      (uint[]){ 1 << 7} )
-	TAGKEYS(                        XK_9,                      (uint[]){ 1 << 8} )
+	TAGKEYS(                        XK_w,                      (uint[]){ 1 << 4} )
 	{ MODKEY|ShiftMask,             XK_q,      quit,           NULL },
 };
+
+/* button definitions */
+/* zone can be a tag number (begining with 0), LtSymbol, StatusText, WinTitle, ClientWin or RootWin */
+#define TAGBUTTONS(TAG) \
+	{ TAG,			0,		Button1,	view,		(uint[]){1 << TAG} }, \
+	{ TAG,			0,		Button3,	toggleview,	(uint[]){1 << TAG} }, \
+	{ TAG,			MODKEY,		Button1,	tag,		(uint[]){1 << TAG} }, \
+	{ TAG,			MODKEY,		Button3,	toggletag,	(uint[]){1 << TAG} },
+
+Button buttons[] = {
+	/* zone			Event Mask	button		function	argument */
+	{ LtSymbol,		0,		Button1,	togglelayout,	NULL },
+	{ LtSymbol,		0,		Button3,	togglemax,	NULL },
+	{ WinTitle,		0,		Button1,	movemouse,	NULL },
+	{ WinTitle,		0,		Button2,	zoom,		NULL },
+	{ WinTitle,		0,		Button3,	resizemouse,	NULL },
+	{ WinTitle,		0,		Button4,	focusprev,	NULL },
+	{ WinTitle,		0,		Button5,	focusnext,	NULL },
+	{ ClientWin,		MODKEY,		Button1,	movemouse,	NULL },
+	{ ClientWin,		MODKEY,		Button2,	togglefloating,	NULL },
+	{ ClientWin,		MODKEY,		Button3,	resizemouse,	NULL },
+	{ RootWin,		Button1Mask,	Button3,	spawn,		(char *)"exec uxterm" },
+	TAGBUTTONS(0)
+	TAGBUTTONS(1)
+	TAGBUTTONS(2)
+	TAGBUTTONS(3)
+	TAGBUTTONS(4)
+};
diff -r d04ee4e2336d dwm.c
--- a/dwm.c	Wed Jun 04 11:49:46 2008 +0200
+++ b/dwm.c	Wed Jun 04 19:01:42 2008 +0200
@@ -59,6 +59,7 @@
 enum { ColBorder, ColFG, ColBG, ColLast };              /* color */
 enum { NetSupported, NetWMName, NetLast };              /* EWMH atoms */
 enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */
+enum { LtSymbol = -1, StatusText = -2, WinTitle = -3, ClientWin = -4, RootWin = -5 };
 
 /* typedefs */
 typedef unsigned int uint;
@@ -92,6 +93,14 @@
 		XFontStruct *xfont;
 	} font;
 } DC; /* draw context */
+
+typedef struct {
+	uint zone;
+	uint mask;
+	uint button;
+	void (*func)(const void *arg);
+	const void *arg;
+} Button;
 
 typedef struct {
 	uint mod;
@@ -152,12 +161,12 @@
 void manage(Window w, XWindowAttributes *wa);
 void mappingnotify(XEvent *e);
 void maprequest(XEvent *e);
-void movemouse(Client *c);
+void movemouse(const void *arg);
 Client *nexttiled(Client *c);
 void propertynotify(XEvent *e);
 void quit(const void *arg);
 void resize(Client *c, int x, int y, int w, int h, Bool sizehints);
-void resizemouse(Client *c);
+void resizemouse(const void *arg);
 void restack(void);
 void run(void);
 void scan(void);
@@ -296,49 +305,31 @@
 
 void
 buttonpress(XEvent *e) {
-	uint i, x, mask;
+	uint i, x, zone;
 	Client *c;
 	XButtonPressedEvent *ev = &e->xbutton;
 
+	zone = RootWin;
 	if(ev->window == barwin) {
 		x = 0;
-		for(i = 0; i < LENGTH(tags); i++) {
+		for(i = 0; i < LENGTH(tags) && ev->x >= x; i++)
 			x += TEXTW(tags[i]);
-			if(ev->x < x) {
-				mask = 1 << i;
-				if(ev->button == Button1) {
-					if(ev->state & MODKEY)
-						tag(&mask);
-					else
-						view(&mask);
-				}
-				else if(ev->button == Button3) {
-					if(ev->state & MODKEY)
-						toggletag(&mask);
-					else
-						toggleview(&mask);
-				}
-				return;
-			}
-		}
-		if(ev->x < x + blw) {
-			if(ev->button == Button1) 
-				togglelayout(NULL);
-			else if(ev->button == Button3) 
-				togglemax(NULL);
-		}
+		if(i < LENGTH(tags) || ev->x <= x)
+			zone = i - 1;
+		else if(ev->x < x + blw)
+			zone = LtSymbol;
+		else if(ev->x > wx + ww - TEXTW(stext))
+			zone = StatusText;
+		else
+			zone = WinTitle;
 	}
-	else if((c = getclient(ev->window))) {
-		focus(c);
-		if(CLEANMASK(ev->state) != MODKEY || (ismax && !c->isfixed))
-			return;
-		if(ev->button == Button1)
-			movemouse(c);
-		else if(ev->button == Button2)
-			togglefloating(NULL);
-		else if(ev->button == Button3 && !c->isfixed)
-			resizemouse(c);
-	}
+	else if((c = getclient(ev->window)))
+		zone = ClientWin;
+
+	for(i = 0; i < LENGTH(buttons); i++)
+		if(zone == buttons[i].zone && buttons[i].func && buttons[i].button == ev->button &&
+		   CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
+			buttons[i].func(buttons[i].arg);
 }
 
 void
@@ -969,12 +960,15 @@
 }
 
 void
-movemouse(Client *c) {
+movemouse(const void *arg) {
 	int x1, y1, ocx, ocy, di, nx, ny;
 	uint dui;
+	Client *c;
 	Window dummy;
 	XEvent ev;
 
+	if(!(c = sel))
+		return;
 	restack();
 	ocx = nx = c->x;
 	ocy = ny = c->y;
@@ -982,6 +976,11 @@
 	None, cursor[CurMove], CurrentTime) != GrabSuccess)
 		return;
 	XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
+	if(x1 < c->x || x1 > c->x + c->w || y1 < c->y || y1 > c->y + c->h) {
+		XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, 0, 0);
+		x1 = c->x + 1;
+		y1 = c->y + 1;
+	}
 	for(;;) {
 		XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
 		switch (ev.type) {
@@ -1130,11 +1129,14 @@
 }
 
 void
-resizemouse(Client *c) {
+resizemouse(const void *arg) {
 	int ocx, ocy;
 	int nw, nh;
+	Client *c;
 	XEvent ev;
 
+	if(!(c = sel))
+		return;
 	restack();
 	ocx = c->x;
 	ocy = c->y;
@@ -1374,7 +1376,7 @@
 			PropModeReplace, (unsigned char *) netatom, NetLast);
 
 	/* select for events */
-	wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
+	wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask
 			|EnterWindowMask|LeaveWindowMask|StructureNotifyMask;
 	XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
 	XSelectInput(dpy, root, wa.event_mask);
@@ -1660,7 +1662,7 @@
 void
 view(const void *arg) {
 	seltags ^= 1; /* toggle sel tagset */
-	if(arg && (*(int *)arg & TAGMASK))
+	if(arg && (*(int *)arg & TAGMASK) && (*(int *)arg & TAGMASK) != tagset[seltags ^ 1] )
 		tagset[seltags] = *(int *)arg & TAGMASK;
 	arrange();
 }
