From b3cea4d3886458a42f74490d604fe3586035f70b Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Fri, 12 Jan 2007 13:06:15 +0100 Subject: [PATCH 01/16] nah the last change feels bad --- config.arg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.arg.h b/config.arg.h index 581da1e..180395a 100644 --- a/config.arg.h +++ b/config.arg.h @@ -33,8 +33,8 @@ static Key key[] = { \ "-sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"')\" && exec $exe" } }, \ { MODKEY, XK_j, focusnext, { 0 } }, \ { MODKEY, XK_k, focusprev, { 0 } }, \ - { MODKEY, XK_l, incnmaster, { .i = 1 } }, \ - { MODKEY, XK_h, incnmaster, { .i = -1 } }, \ + { MODKEY, XK_i, incnmaster, { .i = 1 } }, \ + { MODKEY, XK_d, incnmaster, { .i = -1 } }, \ { MODKEY, XK_Return, zoom, { 0 } }, \ { MODKEY, XK_g, resizemaster, { .i = 15 } }, \ { MODKEY, XK_s, resizemaster, { .i = -15 } }, \ -- 2.20.1 From ae0b4fdd92bc787f14ee21f1dd5c2ced06c6a36f Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Fri, 12 Jan 2007 21:56:01 +0100 Subject: [PATCH 02/16] added missing space --- draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/draw.c b/draw.c index fe73867..ba99ee0 100644 --- a/draw.c +++ b/draw.c @@ -149,7 +149,7 @@ drawclient(Client *c) { XMapWindow(dpy, c->twin); dc.x = dc.y = 0; dc.w = c->tw; - drawtext(c->name, dc.norm, False,False); + drawtext(c->name, dc.norm, False, False); XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0); XSync(dpy, False); } -- 2.20.1 From 6c5dc7017cff322b6402b3849c07529f5ab916fe Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Sun, 14 Jan 2007 22:27:29 +0100 Subject: [PATCH 03/16] removed client title bar --- client.c | 50 ++++---------------------------------------------- draw.c | 6 ------ dwm.1 | 1 - dwm.h | 5 ----- event.c | 7 ++----- view.c | 14 ++++---------- 6 files changed, 10 insertions(+), 73 deletions(-) diff --git a/client.c b/client.c index 8110263..af13797 100644 --- a/client.c +++ b/client.c @@ -60,12 +60,6 @@ xerrordummy(Display *dsply, XErrorEvent *ee) { /* extern functions */ -void -ban(Client *c) { - XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); - XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty); -} - void configure(Client *c) { XEvent synev; @@ -121,16 +115,6 @@ getclient(Window w) { return NULL; } -Client * -getctitle(Window w) { - Client *c; - - for(c = clients; c; c = c->next) - if(c->twin == w) - return c; - return NULL; -} - void killclient(Arg *arg) { if(!sel) @@ -145,17 +129,15 @@ void manage(Window w, XWindowAttributes *wa) { Client *c; Window trans; - XSetWindowAttributes twa; c = emallocz(sizeof(Client)); c->tags = emallocz(ntags * sizeof(Bool)); c->win = w; c->border = 0; - c->x = c->tx = wa->x; - c->y = c->ty = wa->y; - c->w = c->tw = wa->width; + c->x = wa->x; + c->y = wa->y; + c->w = wa->width; c->h = wa->height; - c->th = bh; updatesizehints(c); if(c->x + c->w + 2 * BORDERPX > sw) c->x = sw - c->w - 2 * BORDERPX; @@ -169,27 +151,18 @@ manage(Window w, XWindowAttributes *wa) { XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | EnterWindowMask); XGetTransientForHint(dpy, c->win, &trans); - twa.override_redirect = 1; - twa.background_pixmap = ParentRelative; - twa.event_mask = ExposureMask | EnterWindowMask; - c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, - 0, DefaultDepth(dpy, screen), CopyFromParent, - DefaultVisual(dpy, screen), - CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); grabbuttons(c, False); updatetitle(c); settags(c, getclient(trans)); if(!c->isfloat) c->isfloat = trans || c->isfixed; - resizetitle(c); if(clients) clients->prev = c; c->next = clients; c->snext = stack; stack = clients = c; - ban(c); + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); XMapWindow(dpy, c->win); - XMapWindow(dpy, c->twin); if(isvisible(c)) focus(c); arrange(); @@ -228,7 +201,6 @@ resize(Client *c, Bool sizehints, Corner sticky) { c->x = sw - c->w; if(c->y > sh) c->y = sh - c->h; - resizetitle(c); wc.x = c->x; wc.y = c->y; wc.width = c->w; @@ -242,19 +214,6 @@ resize(Client *c, Bool sizehints, Corner sticky) { XSync(dpy, False); } -void -resizetitle(Client *c) { - c->tw = textw(c->name); - if(c->tw > c->w) - c->tw = c->w + 2 * BORDERPX; - c->tx = c->x + c->w - c->tw + 2 * BORDERPX; - c->ty = c->y; - if(isvisible(c)) - XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); - else - XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th); -} - void updatesizehints(Client *c) { long msize; @@ -331,7 +290,6 @@ unmanage(Client *c) { focus(nc); } XUngrabButton(dpy, AnyButton, AnyModifier, c->win); - XDestroyWindow(dpy, c->twin); free(c->tags); free(c); XSync(dpy, False); diff --git a/draw.c b/draw.c index ba99ee0..0ee362c 100644 --- a/draw.c +++ b/draw.c @@ -141,16 +141,10 @@ void drawclient(Client *c) { if(c == sel && issel) { drawstatus(); - XUnmapWindow(dpy, c->twin); XSetWindowBorder(dpy, c->win, dc.sel[ColBG]); return; } XSetWindowBorder(dpy, c->win, dc.norm[ColBG]); - XMapWindow(dpy, c->twin); - dc.x = dc.y = 0; - dc.w = c->tw; - drawtext(c->name, dc.norm, False, False); - XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0); XSync(dpy, False); } diff --git a/dwm.1 b/dwm.1 index e7a5a44..5783e07 100644 --- a/dwm.1 +++ b/dwm.1 @@ -26,7 +26,6 @@ which are applied to one or more windows are indicated with an empty square in the top left corner. .P dwm draws a 1-pixel border around windows to indicate the focus state. -Unfocused windows contain a small bar in front of them displaying their title. .SH OPTIONS .TP .B \-v diff --git a/dwm.h b/dwm.h index 6a26e07..0cdfad2 100644 --- a/dwm.h +++ b/dwm.h @@ -78,7 +78,6 @@ struct Client { int proto; int x, y, w, h; int rx, ry, rw, rh; /* revert geometry */ - int tx, ty, tw, th; /* title window geometry */ int basew, baseh, incw, inch, maxw, maxh, minw, minh; long flags; unsigned int border; @@ -88,7 +87,6 @@ struct Client { Client *prev; Client *snext; Window win; - Window twin; }; extern const char *tags[]; /* all tags */ @@ -110,15 +108,12 @@ extern Display *dpy; extern Window root, barwin; /* client.c */ -extern void ban(Client *c); /* ban c from screen */ extern void configure(Client *c); /* send synthetic configure event */ extern void focus(Client *c); /* focus c, c may be NULL */ extern Client *getclient(Window w); /* return client of w */ -extern Client *getctitle(Window w); /* return client of title window */ extern void killclient(Arg *arg); /* kill c nicely */ extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/ -extern void resizetitle(Client *c); /* resizes c->twin correctly */ extern void updatesizehints(Client *c); /* update the size hint variables of c */ extern void updatetitle(Client *c); /* update the name of c */ extern void unmanage(Client *c); /* destroy c */ diff --git a/event.c b/event.c index 2deef14..a9d2fbb 100644 --- a/event.c +++ b/event.c @@ -196,7 +196,7 @@ configurerequest(XEvent *e) { if(c->isfloat) { resize(c, False, TopLeft); if(!isvisible(c)) - ban(c); + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); } else arrange(); @@ -230,7 +230,7 @@ enternotify(XEvent *e) { if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) return; - if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c)) + if((c = getclient(ev->window)) && isvisible(c)) focus(c); else if(ev->window == root) { issel = True; @@ -247,8 +247,6 @@ expose(XEvent *e) { if(ev->count == 0) { if(barwin == ev->window) drawstatus(); - else if((c = getctitle(ev->window))) - drawclient(c); } } @@ -331,7 +329,6 @@ propertynotify(XEvent *e) { } if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { updatetitle(c); - resizetitle(c); drawclient(c); } } diff --git a/view.c b/view.c index 4e2ffb3..b8dd79a 100644 --- a/view.c +++ b/view.c @@ -59,7 +59,7 @@ dofloat(void) { resize(c, True, TopLeft); } else - ban(c); + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); } if(!sel || !isvisible(sel)) { for(c = stack; c && !isvisible(c); c = c->snext); @@ -109,8 +109,7 @@ dotile(void) { i++; } else - ban(c); - + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); if(!sel || !isvisible(sel)) { for(c = stack; c && !isvisible(c); c = c->snext); focus(c); @@ -191,19 +190,14 @@ restack(void) { drawstatus(); return; } - if(sel->isfloat || arrange == dofloat) { + if(sel->isfloat || arrange == dofloat) XRaiseWindow(dpy, sel->win); - XRaiseWindow(dpy, sel->twin); - } if(arrange != dofloat) { - if(!sel->isfloat) { - XLowerWindow(dpy, sel->twin); + if(!sel->isfloat) XLowerWindow(dpy, sel->win); - } for(c = nexttiled(clients); c; c = nexttiled(c->next)) { if(c == sel) continue; - XLowerWindow(dpy, c->twin); XLowerWindow(dpy, c->win); } } -- 2.20.1 From ceea528eff5ccd1bbd11696209fdc60a5383cc41 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Sun, 14 Jan 2007 22:32:26 +0100 Subject: [PATCH 04/16] removed mode label stuff --- config.arg.h | 2 +- config.default.h | 2 +- draw.c | 2 +- dwm.h | 4 +--- main.c | 4 ++-- view.c | 8 -------- 6 files changed, 6 insertions(+), 16 deletions(-) diff --git a/config.arg.h b/config.arg.h index 180395a..92f01b7 100644 --- a/config.arg.h +++ b/config.arg.h @@ -7,7 +7,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; #define DEFMODE dotile /* dofloat */ #define FLOATSYMBOL "><>" -#define TILESYMBOL "[%u]=" /* %u is replaced with nmaster */ +#define TILESYMBOL "[]=" #define FONT "-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*" #define NORMBGCOLOR "#222" diff --git a/config.default.h b/config.default.h index 73dc489..afd8e85 100644 --- a/config.default.h +++ b/config.default.h @@ -7,7 +7,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; #define DEFMODE dotile /* dofloat */ #define FLOATSYMBOL "><>" -#define TILESYMBOL "[%u]=" /* %u is replaced with nmaster */ +#define TILESYMBOL "[]=" #define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*" #define NORMBGCOLOR "#333366" diff --git a/draw.c b/draw.c index 0ee362c..8e3962c 100644 --- a/draw.c +++ b/draw.c @@ -120,7 +120,7 @@ drawstatus(void) { dc.x += dc.w; } dc.w = bmw; - drawtext(mtext, dc.status, False, False); + drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False, False); x = dc.x + dc.w; dc.w = textw(stext); dc.x = bw - dc.w; diff --git a/dwm.h b/dwm.h index 0cdfad2..1a95078 100644 --- a/dwm.h +++ b/dwm.h @@ -90,8 +90,7 @@ struct Client { }; extern const char *tags[]; /* all tags */ -extern char stext[1024]; /* status text */ -extern char mtext[32]; /* mode text */ +extern char stext[256]; /* status text */ extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */ extern int screen, sx, sy, sw, sh; /* screen geometry */ extern int wax, way, wah, waw; /* windowarea geometry */ @@ -163,6 +162,5 @@ extern void restack(void); /* restores z layers of all clients */ extern void togglefloat(Arg *arg); /* toggles focusesd client between floating/non-floating state */ extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */ extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */ -extern void updatemodetext(void); /* updates mtext */ extern void view(Arg *arg); /* views the tag with arg's index */ extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */ diff --git a/main.c b/main.c index 067f383..645b2e4 100644 --- a/main.c +++ b/main.c @@ -17,7 +17,7 @@ /* extern */ -char stext[1024], mtext[32]; +char stext[256]; Bool *seltag; int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh, wax, way, waw, wah; unsigned int master, nmaster, ntags, numlockmask; @@ -134,7 +134,7 @@ setup(void) { sh = DisplayHeight(dpy, screen); master = MASTER; nmaster = NMASTER; - updatemodetext(); + bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : textw(FLOATSYMBOL); /* bar */ bx = sx; by = sy; diff --git a/view.c b/view.c index b8dd79a..935525f 100644 --- a/view.c +++ b/view.c @@ -152,7 +152,6 @@ incnmaster(Arg *arg) { if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh)) return; nmaster += arg->i; - updatemodetext(); if(sel) arrange(); else @@ -217,7 +216,6 @@ togglefloat(Arg *arg) { void togglemode(Arg *arg) { arrange = (arrange == dofloat) ? dotile : dofloat; - updatemodetext(); if(sel) arrange(); else @@ -235,12 +233,6 @@ toggleview(Arg *arg) { arrange(); } -void -updatemodetext() { - snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster); - bmw = textw(mtext); -} - void view(Arg *arg) { unsigned int i; -- 2.20.1 From 0045ad87dfb32f35fc17b5b8942049cfe84d623c Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Sun, 14 Jan 2007 22:37:34 +0100 Subject: [PATCH 05/16] implemented new color scheme accordingly to Sanders proposal --- config.arg.h | 4 ++-- config.default.h | 4 ++-- draw.c | 8 ++++---- dwm.h | 3 +-- main.c | 4 ++-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/config.arg.h b/config.arg.h index 92f01b7..e65b989 100644 --- a/config.arg.h +++ b/config.arg.h @@ -10,12 +10,12 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; #define TILESYMBOL "[]=" #define FONT "-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*" +#define NORMBORDERCOLOR "#333" #define NORMBGCOLOR "#222" #define NORMFGCOLOR "#ccc" +#define SELBORDERCOLOR "#9cf" #define SELBGCOLOR "#444" #define SELFGCOLOR "#fff" -#define STATUSBGCOLOR "#333" -#define STATUSFGCOLOR "#9cf" #define MASTER 600 /* per thousand */ #define MODKEY Mod1Mask diff --git a/config.default.h b/config.default.h index afd8e85..98135b0 100644 --- a/config.default.h +++ b/config.default.h @@ -10,12 +10,12 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; #define TILESYMBOL "[]=" #define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*" +#define NORMBORDERCOLOR "#dddddd" #define NORMBGCOLOR "#333366" #define NORMFGCOLOR "#cccccc" +#define SELBORDERCOLOR "#222222" #define SELBGCOLOR "#666699" #define SELFGCOLOR "#eeeeee" -#define STATUSBGCOLOR "#dddddd" -#define STATUSFGCOLOR "#222222" #define MASTER 600 /* per thousand */ #define MODKEY Mod1Mask diff --git a/draw.c b/draw.c index 8e3962c..19604f3 100644 --- a/draw.c +++ b/draw.c @@ -120,7 +120,7 @@ drawstatus(void) { dc.x += dc.w; } dc.w = bmw; - drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False, False); + drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.norm, False, False); x = dc.x + dc.w; dc.w = textw(stext); dc.x = bw - dc.w; @@ -128,7 +128,7 @@ drawstatus(void) { dc.x = x; dc.w = bw - x; } - drawtext(stext, dc.status, False, False); + drawtext(stext, dc.norm, False, False); if((dc.w = dc.x - x) > bh) { dc.x = x; drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm, False, False); @@ -141,10 +141,10 @@ void drawclient(Client *c) { if(c == sel && issel) { drawstatus(); - XSetWindowBorder(dpy, c->win, dc.sel[ColBG]); + XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); return; } - XSetWindowBorder(dpy, c->win, dc.norm[ColBG]); + XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]); XSync(dpy, False); } diff --git a/dwm.h b/dwm.h index 1a95078..3789373 100644 --- a/dwm.h +++ b/dwm.h @@ -43,7 +43,7 @@ enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ enum { WMProtocols, WMDelete, WMLast }; /* default atoms */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { ColFG, ColBG, ColLast }; /* color */ +enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ typedef enum { TopLeft, TopRight, BotLeft, BotRight @@ -66,7 +66,6 @@ typedef struct { int x, y, w, h; unsigned long norm[ColLast]; unsigned long sel[ColLast]; - unsigned long status[ColLast]; Drawable drawable; Fnt font; GC gc; diff --git a/main.c b/main.c index 645b2e4..ed055c2 100644 --- a/main.c +++ b/main.c @@ -121,12 +121,12 @@ setup(void) { seltag = emallocz(sizeof(Bool) * ntags); seltag[0] = True; /* style */ + dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR); dc.norm[ColBG] = getcolor(NORMBGCOLOR); dc.norm[ColFG] = getcolor(NORMFGCOLOR); + dc.sel[ColBorder] = getcolor(SELBORDERCOLOR); dc.sel[ColBG] = getcolor(SELBGCOLOR); dc.sel[ColFG] = getcolor(SELFGCOLOR); - dc.status[ColBG] = getcolor(STATUSBGCOLOR); - dc.status[ColFG] = getcolor(STATUSFGCOLOR); setfont(FONT); /* geometry */ sx = sy = 0; -- 2.20.1 From f8181f64e2ba4fca4e85036c48cf90a2151794fc Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Mon, 15 Jan 2007 12:04:25 +0100 Subject: [PATCH 06/16] removed drawclient and drawall (they performed useless operations/consumed useless cpu cycles) --- client.c | 5 +++-- draw.c | 20 -------------------- dwm.h | 2 -- event.c | 8 +++----- view.c | 1 - 5 files changed, 6 insertions(+), 30 deletions(-) diff --git a/client.c b/client.c index af13797..b122427 100644 --- a/client.c +++ b/client.c @@ -90,7 +90,7 @@ focus(Client *c) { sel = c; if(old) { grabbuttons(old, False); - drawclient(old); + XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]); } } if(c) { @@ -98,11 +98,12 @@ focus(Client *c) { c->snext = stack; stack = c; grabbuttons(c, True); - drawclient(c); + XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); } else XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + drawstatus(); } Client * diff --git a/draw.c b/draw.c index 19604f3..fe2951c 100644 --- a/draw.c +++ b/draw.c @@ -97,15 +97,6 @@ drawtext(const char *text, unsigned long col[ColLast], Bool filledsquare, Bool e /* extern */ -void -drawall(void) { - Client *c; - - for(c = clients; c; c = getnext(c->next)) - drawclient(c); - drawstatus(); -} - void drawstatus(void) { int i, x; @@ -137,17 +128,6 @@ drawstatus(void) { XSync(dpy, False); } -void -drawclient(Client *c) { - if(c == sel && issel) { - drawstatus(); - XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); - return; - } - XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]); - XSync(dpy, False); -} - unsigned long getcolor(const char *colstr) { Colormap cmap = DefaultColormap(dpy, screen); diff --git a/dwm.h b/dwm.h index 3789373..03f8c1f 100644 --- a/dwm.h +++ b/dwm.h @@ -117,9 +117,7 @@ extern void updatetitle(Client *c); /* update the name of c */ extern void unmanage(Client *c); /* destroy c */ /* draw.c */ -extern void drawall(void); /* draw all visible client titles and the bar */ extern void drawstatus(void); /* draw the bar */ -extern void drawclient(Client *c); /* draw title and set border of c */ extern unsigned long getcolor(const char *colstr); /* return color of colstr */ extern void setfont(const char *fontstr); /* set the font for DC */ extern unsigned int textw(const char *text); /* return the width of text in px*/ diff --git a/event.c b/event.c index a9d2fbb..a809511 100644 --- a/event.c +++ b/event.c @@ -235,7 +235,6 @@ enternotify(XEvent *e) { else if(ev->window == root) { issel = True; XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); - drawall(); } } @@ -272,10 +271,8 @@ static void leavenotify(XEvent *e) { XCrossingEvent *ev = &e->xcrossing; - if((ev->window == root) && !ev->same_screen) { + if((ev->window == root) && !ev->same_screen) issel = False; - drawall(); - } } static void @@ -329,7 +326,8 @@ propertynotify(XEvent *e) { } if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { updatetitle(c); - drawclient(c); + if(c == sel) + drawstatus(); } } } diff --git a/view.c b/view.c index 935525f..bc1f4e2 100644 --- a/view.c +++ b/view.c @@ -200,7 +200,6 @@ restack(void) { XLowerWindow(dpy, c->win); } } - drawall(); XSync(dpy, False); while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); } -- 2.20.1 From 72faa1919e34ffeebb1ca35ae8c2c24b700dcf66 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Mon, 15 Jan 2007 12:07:18 +0100 Subject: [PATCH 07/16] changed restack, to fix undrawed tag indicators --- view.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/view.c b/view.c index bc1f4e2..fd07fc5 100644 --- a/view.c +++ b/view.c @@ -185,10 +185,9 @@ restack(void) { Client *c; XEvent ev; - if(!sel) { - drawstatus(); + drawstatus(); + if(!sel) return; - } if(sel->isfloat || arrange == dofloat) XRaiseWindow(dpy, sel->win); if(arrange != dofloat) { -- 2.20.1 From 3b18f17d4d4f2d7502f52346cbd158b7120fd835 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Mon, 15 Jan 2007 19:01:57 +0100 Subject: [PATCH 08/16] Jukka, thanks for being faster than me! --- event.c | 1 - 1 file changed, 1 deletion(-) diff --git a/event.c b/event.c index a809511..75c3fa0 100644 --- a/event.c +++ b/event.c @@ -240,7 +240,6 @@ enternotify(XEvent *e) { static void expose(XEvent *e) { - Client *c; XExposeEvent *ev = &e->xexpose; if(ev->count == 0) { -- 2.20.1 From 3059c9c5070d225c1f6692ed127ed61ea4c9607b Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Tue, 16 Jan 2007 11:12:34 +0100 Subject: [PATCH 09/16] applied sanders patch of my config --- config.arg.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config.arg.h b/config.arg.h index e65b989..2eca76c 100644 --- a/config.arg.h +++ b/config.arg.h @@ -24,7 +24,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; #define KEYS \ static Key key[] = { \ - /* modifier key function argument */ \ + /* modifier key function argument */ \ { MODKEY|ShiftMask, XK_Return, spawn, \ { .cmd = "exec uxterm -bg '#222' -fg '#eee' -cr '#eee' +sb -fn '"FONT"'" } }, \ { MODKEY, XK_p, spawn, \ @@ -33,11 +33,11 @@ static Key key[] = { \ "-sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"')\" && exec $exe" } }, \ { MODKEY, XK_j, focusnext, { 0 } }, \ { MODKEY, XK_k, focusprev, { 0 } }, \ - { MODKEY, XK_i, incnmaster, { .i = 1 } }, \ - { MODKEY, XK_d, incnmaster, { .i = -1 } }, \ { MODKEY, XK_Return, zoom, { 0 } }, \ { MODKEY, XK_g, resizemaster, { .i = 15 } }, \ { MODKEY, XK_s, resizemaster, { .i = -15 } }, \ + { MODKEY, XK_i, incnmaster, { .i = 1 } }, \ + { MODKEY, XK_d, incnmaster, { .i = -1 } }, \ { MODKEY|ShiftMask, XK_0, tag, { .i = -1 } }, \ { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \ { MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \ -- 2.20.1 From fbd310972db317fb32fdce292b86403cc5b696b8 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Tue, 16 Jan 2007 11:25:10 +0100 Subject: [PATCH 10/16] applied new default colors --- config.default.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config.default.h b/config.default.h index 98135b0..e8df621 100644 --- a/config.default.h +++ b/config.default.h @@ -11,11 +11,11 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; #define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*" #define NORMBORDERCOLOR "#dddddd" -#define NORMBGCOLOR "#333366" -#define NORMFGCOLOR "#cccccc" -#define SELBORDERCOLOR "#222222" -#define SELBGCOLOR "#666699" -#define SELFGCOLOR "#eeeeee" +#define NORMBGCOLOR "#eeeeee" +#define NORMFGCOLOR "#222222" +#define SELBORDERCOLOR "#ff0000" +#define SELBGCOLOR "#006699" +#define SELFGCOLOR "#ffffff" #define MASTER 600 /* per thousand */ #define MODKEY Mod1Mask -- 2.20.1 From 6a5b41203e45d565b58b1e39e86f0e290cabdc20 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Tue, 16 Jan 2007 11:26:15 +0100 Subject: [PATCH 11/16] removed firefox rule from default.h --- config.default.h | 1 - 1 file changed, 1 deletion(-) diff --git a/config.default.h b/config.default.h index e8df621..fd7f2a9 100644 --- a/config.default.h +++ b/config.default.h @@ -82,6 +82,5 @@ static Key key[] = { \ #define RULES \ static Rule rule[] = { \ /* class:instance:title regex tags regex isfloat */ \ - { "Firefox.*", "2", False }, \ { "Gimp.*", NULL, True }, \ }; -- 2.20.1 From 1d63030665674496930612ef9a272afb6b75c174 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Tue, 16 Jan 2007 11:28:17 +0100 Subject: [PATCH 12/16] s/444/555/g - enlightened selected background --- config.arg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.arg.h b/config.arg.h index 2eca76c..cb4e3eb 100644 --- a/config.arg.h +++ b/config.arg.h @@ -14,7 +14,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; #define NORMBGCOLOR "#222" #define NORMFGCOLOR "#ccc" #define SELBORDERCOLOR "#9cf" -#define SELBGCOLOR "#444" +#define SELBGCOLOR "#555" #define SELFGCOLOR "#fff" #define MASTER 600 /* per thousand */ -- 2.20.1 From 3c35b90dd3e79e42b115f850dee077eda9816363 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Tue, 16 Jan 2007 11:33:42 +0100 Subject: [PATCH 13/16] removed unnecessary bx, by, bw variables --- draw.c | 6 +++--- dwm.h | 2 +- main.c | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/draw.c b/draw.c index fe2951c..178770b 100644 --- a/draw.c +++ b/draw.c @@ -114,17 +114,17 @@ drawstatus(void) { drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.norm, False, False); x = dc.x + dc.w; dc.w = textw(stext); - dc.x = bw - dc.w; + dc.x = sw - dc.w; if(dc.x < x) { dc.x = x; - dc.w = bw - x; + dc.w = sw - x; } drawtext(stext, dc.norm, False, False); if((dc.w = dc.x - x) > bh) { dc.x = x; drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm, False, False); } - XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); + XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0); XSync(dpy, False); } diff --git a/dwm.h b/dwm.h index 03f8c1f..171cb80 100644 --- a/dwm.h +++ b/dwm.h @@ -90,7 +90,7 @@ struct Client { extern const char *tags[]; /* all tags */ extern char stext[256]; /* status text */ -extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */ +extern int bh, bmw; /* bar height, bar mode label width */ extern int screen, sx, sy, sw, sh; /* screen geometry */ extern int wax, way, wah, waw; /* windowarea geometry */ extern unsigned int master, nmaster; /* master percent, number of master clients */ diff --git a/main.c b/main.c index ed055c2..5818838 100644 --- a/main.c +++ b/main.c @@ -19,7 +19,7 @@ char stext[256]; Bool *seltag; -int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh, wax, way, waw, wah; +int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah; unsigned int master, nmaster, ntags, numlockmask; Atom wmatom[WMLast], netatom[NetLast]; Bool running = True; @@ -136,14 +136,11 @@ setup(void) { nmaster = NMASTER; bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : textw(FLOATSYMBOL); /* bar */ - bx = sx; - by = sy; - bw = sw; dc.h = bh = dc.font.height + 2; wa.override_redirect = 1; wa.background_pixmap = ParentRelative; wa.event_mask = ButtonPressMask | ExposureMask; - barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen), + barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); XDefineCursor(dpy, barwin, cursor[CurNormal]); -- 2.20.1 From 9715ba82aa4d256a43b3a166c88f3409b873eb32 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Tue, 16 Jan 2007 11:35:56 +0100 Subject: [PATCH 14/16] removed erealloc (not used) --- dwm.h | 1 - util.c | 9 --------- 2 files changed, 10 deletions(-) diff --git a/dwm.h b/dwm.h index 171cb80..781940a 100644 --- a/dwm.h +++ b/dwm.h @@ -143,7 +143,6 @@ extern void toggletag(Arg *arg); /* toggles c tags with arg's index */ /* util.c */ extern void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */ extern void eprint(const char *errstr, ...); /* prints errstr and exits with 1 */ -extern void *erealloc(void *ptr, unsigned int size); /* reallocates memory, exits on error */ extern void spawn(Arg *arg); /* forks a new subprocess with to arg's cmd */ /* view.c */ diff --git a/util.c b/util.c index 7d7cb1a..8b36a3f 100644 --- a/util.c +++ b/util.c @@ -29,15 +29,6 @@ eprint(const char *errstr, ...) { exit(EXIT_FAILURE); } -void * -erealloc(void *ptr, unsigned int size) { - void *res = realloc(ptr, size); - - if(!res) - eprint("fatal: could not malloc() %u bytes\n", size); - return res; -} - void spawn(Arg *arg) { static char *shell = NULL; -- 2.20.1 From 936e11fd5465819555604f924f8afaae702e426e Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Tue, 16 Jan 2007 11:41:56 +0100 Subject: [PATCH 15/16] Added tag 3.1 for changeset e1c8bef05e6e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 996f599..4770e28 100644 --- a/.hgtags +++ b/.hgtags @@ -30,3 +30,4 @@ c7f84f23ec5aef29988dcdc4ec22a7352ee8f58e 2.5.1 107719a9ce3bd0c79f9f1f626596eb338a276561 2.8 3a5910fac3ccb522a98aeeba7af7008530b25092 2.9 76b58d21ea98257c05565a3b9c850b9b26a32968 3.0 +e1c8bef05e6e48df4f26471ea0712aa43ab9d949 3.1 -- 2.20.1 From caf5a162716ebdcca0ba7dda1e7335697f3b9208 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Wed, 17 Jan 2007 12:36:29 +0100 Subject: [PATCH 16/16] moved BORDERPX to config.*.h --- config.arg.h | 1 + config.default.h | 1 + config.mk | 2 +- dwm.1 | 2 +- dwm.h | 1 - 5 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.arg.h b/config.arg.h index cb4e3eb..2458fe4 100644 --- a/config.arg.h +++ b/config.arg.h @@ -8,6 +8,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; #define DEFMODE dotile /* dofloat */ #define FLOATSYMBOL "><>" #define TILESYMBOL "[]=" +#define BORDERPX 1 #define FONT "-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*" #define NORMBORDERCOLOR "#333" diff --git a/config.default.h b/config.default.h index fd7f2a9..42b867b 100644 --- a/config.default.h +++ b/config.default.h @@ -8,6 +8,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; #define DEFMODE dotile /* dofloat */ #define FLOATSYMBOL "><>" #define TILESYMBOL "[]=" +#define BORDERPX 1 #define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*" #define NORMBORDERCOLOR "#dddddd" diff --git a/config.mk b/config.mk index 16a7a23..b3b1019 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ # dwm version -VERSION = 3.1 +VERSION = 3.2 # Customize below to fit your system diff --git a/dwm.1 b/dwm.1 index 5783e07..581683f 100644 --- a/dwm.1 +++ b/dwm.1 @@ -25,7 +25,7 @@ window are indicated with a filled square in the top left corner. The tags which are applied to one or more windows are indicated with an empty square in the top left corner. .P -dwm draws a 1-pixel border around windows to indicate the focus state. +dwm draws a small border around windows to indicate the focus state. .SH OPTIONS .TP .B \-v diff --git a/dwm.h b/dwm.h index 781940a..6aa009b 100644 --- a/dwm.h +++ b/dwm.h @@ -37,7 +37,6 @@ /* mask shorthands, used in event.c and client.c */ #define BUTTONMASK (ButtonPressMask | ButtonReleaseMask) /* other stuff used in different places */ -#define BORDERPX 1 #define PROTODELWIN 1 enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ -- 2.20.1