dwm-meillo
changeset 34:cd30cce52b78
added logo+description
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Thu, 13 Jul 2006 09:32:22 +0200 |
parents | e90449e03167 |
children | 93c7c58a0891 |
files | Makefile README client.c config.mk draw.c dwm.1 dwm.html kb.c logo.png util.c wm.c wm.h |
diffstat | 13 files changed, 210 insertions(+), 131 deletions(-) [+] |
line diff
1.1 --- a/Makefile Thu Jul 13 01:55:54 2006 +0200 1.2 +++ b/Makefile Thu Jul 13 09:32:22 2006 +0200 1.3 @@ -1,18 +1,18 @@ 1.4 -# gridwm - grid window manager 1.5 +# dwm - dynamic window manager 1.6 # (C)opyright MMVI Anselm R. Garbe 1.7 1.8 include config.mk 1.9 1.10 SRC = client.c draw.c event.c kb.c mouse.c util.c wm.c 1.11 OBJ = ${SRC:.c=.o} 1.12 -MAN1 = gridwm.1 1.13 -BIN = gridwm 1.14 +MAN1 = dwm.1 1.15 +BIN = dwm 1.16 1.17 -all: config gridwm 1.18 +all: config dwm 1.19 @echo finished 1.20 1.21 config: 1.22 - @echo gridwm build options: 1.23 + @echo dwm build options: 1.24 @echo "LIBS = ${LIBS}" 1.25 @echo "CFLAGS = ${CFLAGS}" 1.26 @echo "LDFLAGS = ${LDFLAGS}" 1.27 @@ -24,19 +24,19 @@ 1.28 1.29 ${OBJ}: wm.h 1.30 1.31 -gridwm: ${OBJ} 1.32 +dwm: ${OBJ} 1.33 @echo LD $@ 1.34 @${CC} -o $@ ${OBJ} ${LDFLAGS} 1.35 1.36 clean: 1.37 - rm -f gridwm *.o core 1.38 + rm -f dwm *.o core 1.39 1.40 dist: clean 1.41 - mkdir -p gridwm-${VERSION} 1.42 - cp -R Makefile README LICENSE config.mk *.h *.c ${MAN} gridwm-${VERSION} 1.43 - tar -cf gridwm-${VERSION}.tar gridwm-${VERSION} 1.44 - gzip gridwm-${VERSION}.tar 1.45 - rm -rf gridwm-${VERSION} 1.46 + mkdir -p dwm-${VERSION} 1.47 + cp -R Makefile README LICENSE config.mk *.h *.c ${MAN} dwm-${VERSION} 1.48 + tar -cf dwm-${VERSION}.tar dwm-${VERSION} 1.49 + gzip dwm-${VERSION}.tar 1.50 + rm -rf dwm-${VERSION} 1.51 1.52 install: all 1.53 @mkdir -p ${DESTDIR}${PREFIX}/bin
2.1 --- a/README Thu Jul 13 01:55:54 2006 +0200 2.2 +++ b/README Thu Jul 13 09:32:22 2006 +0200 2.3 @@ -1,41 +1,40 @@ 2.4 -gridwm 2.5 +dwm 2.6 ------ 2.7 2.8 -gridwm is an extremly fast, small, and automatic X11 window manager. It 2.9 -arranges all windows in a grid. 2.10 +dwm is an extremly fast, small, and dynamic X11 window manager. 2.11 2.12 2.13 Requirements 2.14 ------------ 2.15 -In order to build gridwm you need the Xlib header files. 2.16 +In order to build dwm you need the Xlib header files. 2.17 2.18 2.19 Installation 2.20 ------------ 2.21 -Edit config.mk to match your local setup. gridwm is installed into 2.22 +Edit config.mk to match your local setup. dwm is installed into 2.23 the /usr/local namespace by default. 2.24 2.25 -Afterwards enter the following command to build and install gridwm (if 2.26 +Afterwards enter the following command to build and install dwm (if 2.27 necessary as root): 2.28 2.29 make clean install 2.30 2.31 2.32 -Running gridwm 2.33 +Running dwm 2.34 -------------- 2.35 -Add the following line to your .xinitrc to start gridwm using startx: 2.36 +Add the following line to your .xinitrc to start dwm using startx: 2.37 2.38 - exec gridwm 2.39 + exec dwm 2.40 2.41 -In order to connect gridwm to a specific display, make sure that 2.42 +In order to connect dwm to a specific display, make sure that 2.43 the DISPLAY environment variable is set correctly, e.g.: 2.44 2.45 - DISPLAY=foo.bar:1 exec gridwm 2.46 + DISPLAY=foo.bar:1 exec dwm 2.47 2.48 -This will start gridwm on display :1 of the host foo.bar. 2.49 +This will start dwm on display :1 of the host foo.bar. 2.50 2.51 2.52 Configuration 2.53 ------------- 2.54 -The configuration of gridwm is done by customizing the wm.h source file. To 2.55 +The configuration of dwm is done by customizing the wm.h source file. To 2.56 customize the key bindings edit kb.c.
3.1 --- a/client.c Thu Jul 13 01:55:54 2006 +0200 3.2 +++ b/client.c Thu Jul 13 09:32:22 2006 +0200 3.3 @@ -11,7 +11,9 @@ 3.4 3.5 #include "wm.h" 3.6 3.7 -void (*arrange)(void *aux); 3.8 +static void floating(void); 3.9 +static void tiling(void); 3.10 +static void (*arrange)(void) = tiling; 3.11 3.12 void 3.13 max(void *aux) 3.14 @@ -26,25 +28,23 @@ 3.15 discard_events(EnterWindowMask); 3.16 } 3.17 3.18 -void 3.19 -floating(void *aux) 3.20 +static void 3.21 +floating(void) 3.22 { 3.23 Client *c; 3.24 3.25 - arrange = floating; 3.26 for(c = stack; c; c = c->snext) 3.27 resize(c); 3.28 discard_events(EnterWindowMask); 3.29 } 3.30 3.31 -void 3.32 -grid(void *aux) 3.33 +static void 3.34 +tiling(void) 3.35 { 3.36 Client *c; 3.37 int n, cols, rows, gw, gh, i, j; 3.38 float rt, fd; 3.39 3.40 - arrange = grid; 3.41 if(!clients) 3.42 return; 3.43 for(n = 0, c = clients; c; c = c->next, n++); 3.44 @@ -76,6 +76,17 @@ 3.45 } 3.46 3.47 void 3.48 +toggle(void *aux) 3.49 +{ 3.50 + if(arrange == floating) 3.51 + arrange = tiling; 3.52 + else 3.53 + arrange = floating; 3.54 + arrange(); 3.55 +} 3.56 + 3.57 + 3.58 +void 3.59 sel(void *aux) 3.60 { 3.61 const char *arg = aux; 3.62 @@ -114,8 +125,8 @@ 3.63 c->tw = 0; 3.64 for(i = 0; i < TLast; i++) 3.65 if(c->tags[i]) 3.66 - c->tw += textw(&brush.font, c->tags[i]) + brush.font.height; 3.67 - c->tw += textw(&brush.font, c->name) + brush.font.height; 3.68 + c->tw += textw(&dc.font, c->tags[i]) + dc.font.height; 3.69 + c->tw += textw(&dc.font, c->name) + dc.font.height; 3.70 if(c->tw > c->w) 3.71 c->tw = c->w + 2; 3.72 c->tx = c->x + c->w - c->tw + 2; 3.73 @@ -240,7 +251,7 @@ 3.74 c->border = 1; 3.75 update_size(c); 3.76 XSetWindowBorderWidth(dpy, c->win, 1); 3.77 - XSetWindowBorder(dpy, c->win, brush.border); 3.78 + XSetWindowBorder(dpy, c->win, dc.border); 3.79 XSelectInput(dpy, c->win, 3.80 StructureNotifyMask | PropertyChangeMask | EnterWindowMask); 3.81 XGetTransientForHint(dpy, c->win, &c->trans); 3.82 @@ -266,7 +277,7 @@ 3.83 GrabModeAsync, GrabModeSync, None, None); 3.84 XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask, 3.85 GrabModeAsync, GrabModeSync, None, None); 3.86 - arrange(NULL); 3.87 + arrange(); 3.88 focus(c); 3.89 } 3.90 3.91 @@ -385,7 +396,7 @@ 3.92 XFlush(dpy); 3.93 XSetErrorHandler(error_handler); 3.94 XUngrabServer(dpy); 3.95 - arrange(NULL); 3.96 + arrange(); 3.97 if(stack) 3.98 focus(stack); 3.99 } 3.100 @@ -417,21 +428,21 @@ 3.101 if(c == stack) 3.102 return; 3.103 3.104 - brush.x = brush.y = 0; 3.105 - brush.h = c->th; 3.106 + dc.x = dc.y = 0; 3.107 + dc.h = c->th; 3.108 3.109 - brush.w = 0; 3.110 + dc.w = 0; 3.111 for(i = 0; i < TLast; i++) { 3.112 if(c->tags[i]) { 3.113 - brush.x += brush.w; 3.114 - brush.w = textw(&brush.font, c->tags[i]) + brush.font.height; 3.115 - draw(&brush, True, c->tags[i]); 3.116 + dc.x += dc.w; 3.117 + dc.w = textw(&dc.font, c->tags[i]) + dc.font.height; 3.118 + draw(True, c->tags[i]); 3.119 } 3.120 } 3.121 - brush.x += brush.w; 3.122 - brush.w = textw(&brush.font, c->name) + brush.font.height; 3.123 - draw(&brush, True, c->name); 3.124 - XCopyArea(dpy, brush.drawable, c->title, brush.gc, 3.125 + dc.x += dc.w; 3.126 + dc.w = textw(&dc.font, c->name) + dc.font.height; 3.127 + draw(True, c->name); 3.128 + XCopyArea(dpy, dc.drawable, c->title, dc.gc, 3.129 0, 0, c->tw, c->th, 0, 0); 3.130 XFlush(dpy); 3.131 }
4.1 --- a/config.mk Thu Jul 13 01:55:54 2006 +0200 4.2 +++ b/config.mk Thu Jul 13 09:32:22 2006 +0200 4.3 @@ -14,14 +14,10 @@ 4.4 LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11 4.5 4.6 # Linux/BSD 4.7 -CFLAGS = -Os -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ 4.8 +CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ 4.9 -DVERSION=\"${VERSION}\" 4.10 -LDFLAGS = ${LIBS} 4.11 -#CFLAGS += -W -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Waggregate-return -Wnested-externs -Winline -Wwrite-strings -Wundef -Wsign-compare -Wmissing-prototypes -Wredundant-decls 4.12 +LDFLAGS = -g ${LIBS} 4.13 4.14 -#CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ 4.15 -# -DVERSION=\"${VERSION}\" 4.16 -#LDFLAGS = -g ${LIBS} 4.17 4.18 # Solaris 4.19 #CFLAGS = -fast -xtarget=ultra ${INCLUDES} -DVERSION=\"${VERSION}\"
5.1 --- a/draw.c Thu Jul 13 01:55:54 2006 +0200 5.2 +++ b/draw.c Thu Jul 13 09:32:22 2006 +0200 5.3 @@ -11,39 +11,39 @@ 5.4 #include "wm.h" 5.5 5.6 static void 5.7 -drawborder(Brush *b) 5.8 +drawborder(void) 5.9 { 5.10 XPoint points[5]; 5.11 - XSetLineAttributes(dpy, b->gc, 1, LineSolid, CapButt, JoinMiter); 5.12 - XSetForeground(dpy, b->gc, b->border); 5.13 - points[0].x = b->x; 5.14 - points[0].y = b->y; 5.15 - points[1].x = b->w - 1; 5.16 + XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); 5.17 + XSetForeground(dpy, dc.gc, dc.border); 5.18 + points[0].x = dc.x; 5.19 + points[0].y = dc.y; 5.20 + points[1].x = dc.w - 1; 5.21 points[1].y = 0; 5.22 points[2].x = 0; 5.23 - points[2].y = b->h - 1; 5.24 - points[3].x = -(b->w - 1); 5.25 + points[2].y = dc.h - 1; 5.26 + points[3].x = -(dc.w - 1); 5.27 points[3].y = 0; 5.28 points[4].x = 0; 5.29 - points[4].y = -(b->h - 1); 5.30 - XDrawLines(dpy, b->drawable, b->gc, points, 5, CoordModePrevious); 5.31 + points[4].y = -(dc.h - 1); 5.32 + XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious); 5.33 } 5.34 5.35 void 5.36 -draw(Brush *b, Bool border, const char *text) 5.37 +draw(Bool border, const char *text) 5.38 { 5.39 int x, y, w, h; 5.40 unsigned int len; 5.41 static char buf[256]; 5.42 XGCValues gcv; 5.43 - XRectangle r = { b->x, b->y, b->w, b->h }; 5.44 + XRectangle r = { dc.x, dc.y, dc.w, dc.h }; 5.45 5.46 - XSetForeground(dpy, b->gc, b->bg); 5.47 - XFillRectangles(dpy, b->drawable, b->gc, &r, 1); 5.48 + XSetForeground(dpy, dc.gc, dc.bg); 5.49 + XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); 5.50 5.51 w = 0; 5.52 if(border) 5.53 - drawborder(b); 5.54 + drawborder(); 5.55 5.56 if(!text) 5.57 return; 5.58 @@ -54,33 +54,33 @@ 5.59 memcpy(buf, text, len); 5.60 buf[len] = 0; 5.61 5.62 - h = b->font.ascent + b->font.descent; 5.63 - y = b->y + (b->h / 2) - (h / 2) + b->font.ascent; 5.64 - x = b->x + (h / 2); 5.65 + h = dc.font.ascent + dc.font.descent; 5.66 + y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent; 5.67 + x = dc.x + (h / 2); 5.68 5.69 /* shorten text if necessary */ 5.70 - while(len && (w = textnw(&b->font, buf, len)) > b->w - h) 5.71 + while(len && (w = textnw(&dc.font, buf, len)) > dc.w - h) 5.72 buf[--len] = 0; 5.73 5.74 - if(w > b->w) 5.75 + if(w > dc.w) 5.76 return; /* too long */ 5.77 5.78 - gcv.foreground = b->fg; 5.79 - gcv.background = b->bg; 5.80 - if(b->font.set) { 5.81 - XChangeGC(dpy, b->gc, GCForeground | GCBackground, &gcv); 5.82 - XmbDrawImageString(dpy, b->drawable, b->font.set, b->gc, 5.83 + gcv.foreground = dc.fg; 5.84 + gcv.background = dc.bg; 5.85 + if(dc.font.set) { 5.86 + XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv); 5.87 + XmbDrawImageString(dpy, dc.drawable, dc.font.set, dc.gc, 5.88 x, y, buf, len); 5.89 } 5.90 else { 5.91 - gcv.font = b->font.xfont->fid; 5.92 - XChangeGC(dpy, b->gc, GCForeground | GCBackground | GCFont, &gcv); 5.93 - XDrawImageString(dpy, b->drawable, b->gc, x, y, buf, len); 5.94 + gcv.font = dc.font.xfont->fid; 5.95 + XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); 5.96 + XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len); 5.97 } 5.98 } 5.99 5.100 static unsigned long 5.101 -xloadcolors(Colormap cmap, const char *colstr) 5.102 +xinitcolors(Colormap cmap, const char *colstr) 5.103 { 5.104 XColor color; 5.105 XAllocNamedColor(dpy, cmap, colstr, &color, &color); 5.106 @@ -88,13 +88,12 @@ 5.107 } 5.108 5.109 void 5.110 -loadcolors(int scr, Brush *b, 5.111 - const char *bg, const char *fg, const char *border) 5.112 +initcolors(const char *bg, const char *fg, const char *border) 5.113 { 5.114 - Colormap cmap = DefaultColormap(dpy, scr); 5.115 - b->bg = xloadcolors(cmap, bg); 5.116 - b->fg = xloadcolors(cmap, fg); 5.117 - b->border = xloadcolors(cmap, border); 5.118 + Colormap cmap = DefaultColormap(dpy, screen); 5.119 + dc.bg = xinitcolors(cmap, bg); 5.120 + dc.fg = xinitcolors(cmap, fg); 5.121 + dc.border = xinitcolors(cmap, border); 5.122 } 5.123 5.124 unsigned int 5.125 @@ -121,7 +120,7 @@ 5.126 } 5.127 5.128 void 5.129 -loadfont(Fnt *font, const char *fontstr) 5.130 +initfont(Fnt *font, const char *fontstr) 5.131 { 5.132 char **missing, *def; 5.133 int i, n; 5.134 @@ -164,7 +163,7 @@ 5.135 if (!font->xfont) 5.136 font->xfont = XLoadQueryFont(dpy, "fixed"); 5.137 if (!font->xfont) 5.138 - error("error, cannot load 'fixed' font\n"); 5.139 + error("error, cannot init 'fixed' font\n"); 5.140 font->ascent = font->xfont->ascent; 5.141 font->descent = font->xfont->descent; 5.142 }
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/dwm.1 Thu Jul 13 09:32:22 2006 +0200 6.3 @@ -0,0 +1,16 @@ 6.4 +.TH GRIDWM 1 gridwm-0.0 6.5 +.SH NAME 6.6 +gridwm \- grid window manager 6.7 +.SH SYNOPSIS 6.8 +.B gridwm 6.9 +.RB [ \-v ] 6.10 +.SH DESCRIPTION 6.11 +.SS Overview 6.12 +.B gridwm 6.13 +is an automatic window manager for X11. 6.14 +.SS Options 6.15 +.TP 6.16 +.B \-v 6.17 +prints version information to stdout, then exits. 6.18 +.SH SEE ALSO 6.19 +.BR gridmenu (1)
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/dwm.html Thu Jul 13 09:32:22 2006 +0200 7.3 @@ -0,0 +1,77 @@ 7.4 +<html> 7.5 + <head> 7.6 + <title>dwm - dynamic window manager</title> 7.7 + <meta name="author" content="Anselm R. Garbe"> 7.8 + <meta name="generator" content="ed"> 7.9 + <meta name="copyright" content="(C)opyright 2006 by Anselm R. Garbe"> 7.10 + <style type="text/css"> 7.11 + body { 7.12 + color: #000000; 7.13 + font-family: sans-serif; 7.14 + } 7.15 + </style> 7.16 + </head> 7.17 + <body> 7.18 + <center> 7.19 + <img src="logo.png"/><br /> 7.20 + <h3>dynamic window manager</h3> 7.21 + <center> 7.22 + <h2>Description</h3> 7.23 + <p> 7.24 + dwm is a dynamic window manager for X11. 7.25 + </p> 7.26 + <h2>Differences to wmii</h2 7.27 + <p> 7.28 + In contrast to wmii, dwm is only a window manager, and nothing else. 7.29 + Hence, it is much smaller, faster and simpler. dwm does 7.30 + <b>not</b> include following features wmii provides: 7.31 + </p> 7.32 + <ul> 7.33 + <li>9P support</li> 7.34 + <li>status bar</li> 7.35 + <li>menu</li> 7.36 + <li>editable tagbars</li> 7.37 + <li>shell-based config/control file</li> 7.38 + <li>small tools (selection printer, mouse warper)</li> 7.39 + </ul> 7.40 + <p> 7.41 + dwm is only a single binary, it's source code is intended to never 7.42 + exceed 2000 SLOC. 7.43 + </p> 7.44 + <p> 7.45 + dwm is customized through editing its source code, that makes it 7.46 + extremely fast and secure - it does not process any input data which 7.47 + hasn't been known at compile time, except window title names. 7.48 + </p> 7.49 + <p> 7.50 + dwm is based on tagging and dynamic window management (however simpler 7.51 + than wmii or larswm). 7.52 + </p> 7.53 + <p> 7.54 + dwm don't distinguishes between layers, there is no floating or managed 7.55 + layer. Wether the clients of currently selected tag are managed or not 7.56 + managed, you can re-arrange all clients on the fly. Popup- and 7.57 + fixed-size windows are treated unmanaged. 7.58 + </p> 7.59 + <p> 7.60 + dwm uses 1-pixel borders to provide the maximum of screen real 7.61 + estate to clients. Small titlebars are only drawn in front of unfocused 7.62 + clients. 7.63 + </p> 7.64 + <p> 7.65 + garbeam <b>don't</b> wants any feedback to dwm. If you ask for support, 7.66 + feature requests or if you report bugs, they will be <b>ignored</b> 7.67 + with a high chance. dwm is only intended to fit garbeam's needs, 7.68 + however you are free to download and distribute/relicense it, with the 7.69 + conditions of the <a href="http://wmii.de/cgi-bin/hgwebdir.cgi/dwm?f=f10eb1139362;file=LICENSE;style=raw">MIT/X Consortium license</a>. 7.70 + </p> 7.71 + <h2>Development</h2> 7.72 + <p> 7.73 + dwm is actively developed in parallel to wmii. You can <a href="http://wmii.de/cgi-bin/hgwebdir.cgi/dwm">browse</a> its source code repository or get a copy using <a href="http://www.selenic.com/mercurial/">Mercurial</a> with following command: 7.74 + </p> 7.75 + <p> 7.76 + <em>hg clone http://wmii.de/cgi-bin/hgwebdir.cgi/dwm</em> 7.77 + </p> 7.78 + <p>--Anselm</p> 7.79 + </body> 7.80 +</html>
8.1 --- a/gridwm.1 Thu Jul 13 01:55:54 2006 +0200 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,16 +0,0 @@ 8.4 -.TH GRIDWM 1 gridwm-0.0 8.5 -.SH NAME 8.6 -gridwm \- grid window manager 8.7 -.SH SYNOPSIS 8.8 -.B gridwm 8.9 -.RB [ \-v ] 8.10 -.SH DESCRIPTION 8.11 -.SS Overview 8.12 -.B gridwm 8.13 -is an automatic window manager for X11. 8.14 -.SS Options 8.15 -.TP 8.16 -.B \-v 8.17 -prints version information to stdout, then exits. 8.18 -.SH SEE ALSO 8.19 -.BR gridmenu (1)
9.1 --- a/kb.c Thu Jul 13 01:55:54 2006 +0200 9.2 +++ b/kb.c Thu Jul 13 09:32:22 2006 +0200 9.3 @@ -13,13 +13,14 @@ 9.4 "aterm", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn", 9.5 "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL 9.6 }; 9.7 +const char *browse[] = { "firefox", NULL }; 9.8 9.9 static Key key[] = { 9.10 { Mod1Mask, XK_Return, (void (*)(void *))spawn, term }, 9.11 + { Mod1Mask, XK_w, (void (*)(void *))spawn, browse }, 9.12 { Mod1Mask, XK_k, sel, "prev" }, 9.13 { Mod1Mask, XK_j, sel, "next" }, 9.14 - { Mod1Mask, XK_g, grid, NULL }, 9.15 - { Mod1Mask, XK_f, floating, NULL }, 9.16 + { Mod1Mask, XK_space, toggle, NULL }, 9.17 { Mod1Mask, XK_m, max, NULL }, 9.18 { Mod1Mask | ShiftMask, XK_c, ckill, NULL }, 9.19 { Mod1Mask | ShiftMask, XK_q, quit, NULL },
10.1 Binary file logo.png has changed
11.1 --- a/util.c Thu Jul 13 01:55:54 2006 +0200 11.2 +++ b/util.c Thu Jul 13 09:32:22 2006 +0200 11.3 @@ -85,7 +85,7 @@ 11.4 close(ConnectionNumber(dpy)); 11.5 setsid(); 11.6 execvp(argv[0], argv); 11.7 - fprintf(stderr, "gridwm: execvp %s", argv[0]); 11.8 + fprintf(stderr, "dwm: execvp %s", argv[0]); 11.9 perror(" failed"); 11.10 } 11.11 exit (0);
12.1 --- a/wm.c Thu Jul 13 01:55:54 2006 +0200 12.2 +++ b/wm.c Thu Jul 13 09:32:22 2006 +0200 12.3 @@ -37,17 +37,17 @@ 12.4 int tsel = Tdev; /* default tag */ 12.5 int screen, sx, sy, sw, sh, th; 12.6 12.7 -Brush brush = {0}; 12.8 +DC dc = {0}; 12.9 Client *clients = NULL; 12.10 Client *stack = NULL; 12.11 12.12 static Bool other_wm_running; 12.13 static const char version[] = 12.14 - "gridwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; 12.15 + "dwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; 12.16 static int (*x_error_handler) (Display *, XErrorEvent *); 12.17 12.18 static void 12.19 -usage() { error("usage: gridwm [-v]\n"); } 12.20 +usage() { error("usage: dwm [-v]\n"); } 12.21 12.22 static void 12.23 scan_wins() 12.24 @@ -149,7 +149,7 @@ 12.25 || (error->request_code == X_GrabKey 12.26 && error->error_code == BadAccess)) 12.27 return 0; 12.28 - fprintf(stderr, "gridwm: fatal error: request code=%d, error code=%d\n", 12.29 + fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n", 12.30 error->request_code, error->error_code); 12.31 return x_error_handler(dpy, error); /* may call exit() */ 12.32 } 12.33 @@ -203,7 +203,7 @@ 12.34 12.35 dpy = XOpenDisplay(0); 12.36 if(!dpy) 12.37 - error("gridwm: cannot connect X server\n"); 12.38 + error("dwm: cannot connect X server\n"); 12.39 12.40 screen = DefaultScreen(dpy); 12.41 root = RootWindow(dpy, screen); 12.42 @@ -216,7 +216,7 @@ 12.43 XFlush(dpy); 12.44 12.45 if(other_wm_running) 12.46 - error("gridwm: another window manager is already running\n"); 12.47 + error("dwm: another window manager is already running\n"); 12.48 12.49 sx = sy = 0; 12.50 sw = DisplayWidth(dpy, screen); 12.51 @@ -244,20 +244,19 @@ 12.52 update_keys(); 12.53 12.54 /* style */ 12.55 - loadcolors(screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR); 12.56 - loadfont(&brush.font, FONT); 12.57 + initcolors(BGCOLOR, FGCOLOR, BORDERCOLOR); 12.58 + initfont(&dc.font, FONT); 12.59 12.60 - th = texth(&brush.font); 12.61 + th = texth(&dc.font); 12.62 12.63 - brush.drawable = XCreatePixmap(dpy, root, sw, th, DefaultDepth(dpy, screen)); 12.64 - brush.gc = XCreateGC(dpy, root, 0, 0); 12.65 + dc.drawable = XCreatePixmap(dpy, root, sw, th, DefaultDepth(dpy, screen)); 12.66 + dc.gc = XCreateGC(dpy, root, 0, 0); 12.67 12.68 wa.event_mask = SubstructureRedirectMask | EnterWindowMask \ 12.69 | LeaveWindowMask; 12.70 wa.cursor = cursor[CurNormal]; 12.71 XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); 12.72 12.73 - arrange = grid; 12.74 scan_wins(); 12.75 12.76 while(running) {
13.1 --- a/wm.h Thu Jul 13 01:55:54 2006 +0200 13.2 +++ b/wm.h Thu Jul 13 09:32:22 2006 +0200 13.3 @@ -19,7 +19,7 @@ 13.4 13.5 /********** CUSTOMIZE **********/ 13.6 13.7 -typedef struct Brush Brush; 13.8 +typedef struct DC DC; 13.9 typedef struct Client Client; 13.10 typedef struct Fnt Fnt; 13.11 typedef struct Key Key; 13.12 @@ -39,7 +39,7 @@ 13.13 int height; 13.14 }; 13.15 13.16 -struct Brush { 13.17 +struct DC { /* draw context */ 13.18 GC gc; 13.19 Drawable drawable; 13.20 int x, y, w, h; 13.21 @@ -79,12 +79,11 @@ 13.22 extern Cursor cursor[CurLast]; 13.23 extern Bool running, issel; 13.24 extern void (*handler[LASTEvent]) (XEvent *); 13.25 -extern void (*arrange)(void *aux); 13.26 13.27 extern int tsel, screen, sx, sy, sw, sh, th; 13.28 extern char stext[1024], *tags[TLast]; 13.29 13.30 -extern Brush brush; 13.31 +extern DC dc; 13.32 extern Client *clients, *stack; 13.33 13.34 /* client.c */ 13.35 @@ -102,15 +101,13 @@ 13.36 extern void ckill(void *aux); 13.37 extern void sel(void *aux); 13.38 extern void max(void *aux); 13.39 -extern void floating(void *aux); 13.40 -extern void grid(void *aux); 13.41 +extern void toggle(void *aux); 13.42 extern void gravitate(Client *c, Bool invert); 13.43 13.44 /* draw.c */ 13.45 -extern void draw(Brush *b, Bool border, const char *text); 13.46 -extern void loadcolors(int scr, Brush *b, 13.47 - const char *bg, const char *fg, const char *bo); 13.48 -extern void loadfont(Fnt *font, const char *fontstr); 13.49 +extern void draw(Bool border, const char *text); 13.50 +extern void initcolors(const char *bg, const char *fg, const char *bo); 13.51 +extern void initfont(Fnt *font, const char *fontstr); 13.52 extern unsigned int textnw(Fnt *font, char *text, unsigned int len); 13.53 extern unsigned int textw(Fnt *font, char *text); 13.54 extern unsigned int texth(Fnt *font);