aewl
changeset 342:a1901753deef
updated man page
author | Anselm R. Garbe <arg@10kloc.org> |
---|---|
date | Wed, 23 Aug 2006 18:50:46 +0200 |
parents | e4dad4635250 |
children | 336d3a2c3f80 |
files | client.c config.arg.h draw.c dwm.1 dwm.h tag.c view.c |
diffstat | 7 files changed, 68 insertions(+), 73 deletions(-) [+] |
line diff
1.1 --- a/client.c Wed Aug 23 14:40:44 2006 +0200 1.2 +++ b/client.c Wed Aug 23 18:50:46 2006 +0200 1.3 @@ -28,19 +28,15 @@ 1.4 { 1.5 int i; 1.6 1.7 - c->tw = 0; 1.8 - for(i = 0; i < ntags; i++) 1.9 - if(c->tags[i]) 1.10 - c->tw += textw(tags[i]); 1.11 - c->tw += textw(c->name); 1.12 + c->tw = textw(c->name); 1.13 if(c->tw > c->w) 1.14 c->tw = c->w + 2; 1.15 c->tx = c->x + c->w - c->tw + 2; 1.16 c->ty = c->y; 1.17 if(isvisible(c)) 1.18 - XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th); 1.19 + XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); 1.20 else 1.21 - XMoveResizeWindow(dpy, c->title, c->tx + 2 * sw, c->ty, c->tw, c->th); 1.22 + XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th); 1.23 1.24 } 1.25 1.26 @@ -65,7 +61,7 @@ 1.27 ban(Client *c) 1.28 { 1.29 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); 1.30 - XMoveWindow(dpy, c->title, c->tx + 2 * sw, c->ty); 1.31 + XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty); 1.32 } 1.33 1.34 void 1.35 @@ -106,7 +102,7 @@ 1.36 Client *c; 1.37 1.38 for(c = clients; c; c = c->next) 1.39 - if(c->title == w) 1.40 + if(c->twin == w) 1.41 return c; 1.42 return NULL; 1.43 } 1.44 @@ -214,7 +210,7 @@ 1.45 twa.background_pixmap = ParentRelative; 1.46 twa.event_mask = ExposureMask | EnterWindowMask; 1.47 1.48 - c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, 1.49 + c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, 1.50 0, DefaultDepth(dpy, screen), CopyFromParent, 1.51 DefaultVisual(dpy, screen), 1.52 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); 1.53 @@ -242,7 +238,7 @@ 1.54 sel = c; 1.55 arrange(NULL); 1.56 XMapWindow(dpy, c->win); 1.57 - XMapWindow(dpy, c->title); 1.58 + XMapWindow(dpy, c->twin); 1.59 if(isvisible(c)) 1.60 focus(c); 1.61 } 1.62 @@ -329,7 +325,7 @@ 1.63 settitle(Client *c) 1.64 { 1.65 char **list = NULL; 1.66 - int n; 1.67 + int i, n; 1.68 XTextProperty name; 1.69 1.70 name.nitems = 0; 1.71 @@ -392,7 +388,7 @@ 1.72 XSetErrorHandler(xerrordummy); 1.73 1.74 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); 1.75 - XDestroyWindow(dpy, c->title); 1.76 + XDestroyWindow(dpy, c->twin); 1.77 1.78 if(c->prev) 1.79 c->prev->next = c->next;
2.1 --- a/config.arg.h Wed Aug 23 14:40:44 2006 +0200 2.2 +++ b/config.arg.h Wed Aug 23 18:50:46 2006 +0200 2.3 @@ -7,8 +7,7 @@ 2.4 const char *tags[] = { "work", "net", "fnord", NULL }; 2.5 2.6 #define DEFMODE dotile /* dofloat */ 2.7 -#define TFONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" 2.8 -#define FONT "-*-snap-*-*-*-*-*-*-*-*-*-*-*-*" 2.9 +#define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" 2.10 #define BGCOLOR "#0d121d" 2.11 #define FGCOLOR "#eeeeee" 2.12 #define BORDERCOLOR "#3f484d" 2.13 @@ -19,7 +18,7 @@ 2.14 static Key key[] = { \ 2.15 /* modifier key function arguments */ \ 2.16 { MODKEY|ShiftMask, XK_Return, spawn, \ 2.17 - { .cmd = "exec uxterm +sb -bg black -fg '#eeeeee' -fn '"TFONT"'" } }, \ 2.18 + { .cmd = "exec uxterm +sb -bg black -fg '#eeeeee' -fn '"FONT"'" } }, \ 2.19 { MODKEY, XK_p, spawn, \ 2.20 { .cmd = "exec `ls -lL /usr/bin /usr/X11R6/bin /usr/local/bin 2>/dev/null | " \ 2.21 "awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort -u | dmenu`" } }, \
3.1 --- a/draw.c Wed Aug 23 14:40:44 2006 +0200 3.2 +++ b/draw.c Wed Aug 23 18:50:46 2006 +0200 3.3 @@ -22,19 +22,9 @@ 3.4 } 3.5 3.6 static void 3.7 -drawtext(const char *text, Bool invert) 3.8 +drawborder() 3.9 { 3.10 - int x, y, w, h; 3.11 - static char buf[256]; 3.12 - unsigned int len, olen; 3.13 - XGCValues gcv; 3.14 XPoint points[5]; 3.15 - XRectangle r = { dc.x, dc.y, dc.w, dc.h }; 3.16 - 3.17 - XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); 3.18 - XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); 3.19 - XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); 3.20 - XSetForeground(dpy, dc.gc, dc.border); 3.21 points[0].x = dc.x; 3.22 points[0].y = dc.y; 3.23 points[1].x = dc.w - 1; 3.24 @@ -46,6 +36,23 @@ 3.25 points[4].x = 0; 3.26 points[4].y = -(dc.h - 1); 3.27 XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious); 3.28 +} 3.29 + 3.30 +static void 3.31 +drawtext(const char *text, Bool invert, Bool highlight) 3.32 +{ 3.33 + int x, y, w, h; 3.34 + static char buf[256]; 3.35 + unsigned int len, olen; 3.36 + DC tmp; 3.37 + XGCValues gcv; 3.38 + XRectangle r = { dc.x, dc.y, dc.w, dc.h }; 3.39 + 3.40 + XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); 3.41 + XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); 3.42 + XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); 3.43 + XSetForeground(dpy, dc.gc, dc.border); 3.44 + drawborder(); 3.45 3.46 if(!text) 3.47 return; 3.48 @@ -75,18 +82,25 @@ 3.49 3.50 if(w > dc.w) 3.51 return; /* too long */ 3.52 - 3.53 gcv.foreground = invert ? dc.bg : dc.fg; 3.54 gcv.background = invert ? dc.fg : dc.bg; 3.55 if(dc.font.set) { 3.56 XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv); 3.57 - XmbDrawImageString(dpy, dc.drawable, dc.font.set, dc.gc, 3.58 - x, y, buf, len); 3.59 + XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len); 3.60 } 3.61 else { 3.62 gcv.font = dc.font.xfont->fid; 3.63 XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); 3.64 - XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len); 3.65 + XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); 3.66 + } 3.67 + if(highlight) { 3.68 + tmp = dc; 3.69 + dc.x += 2; 3.70 + dc.y += 2; 3.71 + dc.w -= 4; 3.72 + dc.h -= 4; 3.73 + drawborder(); 3.74 + dc = tmp; 3.75 } 3.76 } 3.77 3.78 @@ -110,36 +124,29 @@ 3.79 3.80 dc.x = dc.y = 0; 3.81 dc.w = bw; 3.82 - drawtext(NULL, !istile); 3.83 + drawtext(NULL, !istile, False); 3.84 3.85 dc.w = 0; 3.86 for(i = 0; i < ntags; i++) { 3.87 dc.x += dc.w; 3.88 dc.w = textw(tags[i]); 3.89 if(istile) 3.90 - drawtext(tags[i], seltag[i]); 3.91 + drawtext(tags[i], seltag[i], sel && sel->tags[i]); 3.92 else 3.93 - drawtext(tags[i], !seltag[i]); 3.94 + drawtext(tags[i], !seltag[i], sel && sel->tags[i]); 3.95 } 3.96 x = dc.x + dc.w; 3.97 dc.w = textw(stext); 3.98 dc.x = bx + bw - dc.w; 3.99 - drawtext(stext, !istile); 3.100 + if(dc.x < x) { 3.101 + dc.x = x; 3.102 + dc.w = bw - x; 3.103 + } 3.104 + drawtext(stext, !istile, False); 3.105 3.106 - if(sel) { 3.107 - for(i = 0; i < ntags; i++) 3.108 - if(sel->tags[i]) { 3.109 - dc.w = textw(tags[i]); 3.110 - dc.x -= dc.w; 3.111 - if(dc.x < x) 3.112 - break; 3.113 - drawtext(tags[i], istile); 3.114 - } 3.115 - if(dc.x > x && (dc.x - x) > bh) { 3.116 - dc.w = dc.x - x; 3.117 - dc.x = x; 3.118 - drawtext(sel->name, istile); 3.119 - } 3.120 + if(sel && ((dc.w = dc.x - x) > bh)) { 3.121 + dc.x = x; 3.122 + drawtext(sel->name, istile, False); 3.123 } 3.124 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); 3.125 XSync(dpy, False); 3.126 @@ -153,26 +160,17 @@ 3.127 3.128 if(c == sel && issel) { 3.129 drawstatus(); 3.130 - XUnmapWindow(dpy, c->title); 3.131 + XUnmapWindow(dpy, c->twin); 3.132 XSetWindowBorder(dpy, c->win, dc.fg); 3.133 return; 3.134 } 3.135 3.136 XSetWindowBorder(dpy, c->win, dc.bg); 3.137 - XMapWindow(dpy, c->title); 3.138 - 3.139 - dc.y = dc.w = 0; 3.140 - dc.x = c->tw; 3.141 - for(i = 0; i < ntags; i++) 3.142 - if(c->tags[i]) { 3.143 - dc.w = textw(tags[i]); 3.144 - dc.x -= dc.w; 3.145 - drawtext(tags[i], !istile); 3.146 - } 3.147 - dc.w = dc.x; 3.148 - dc.x = 0; 3.149 - drawtext(c->name, !istile); 3.150 - XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0); 3.151 + XMapWindow(dpy, c->twin); 3.152 + dc.x = dc.y = 0; 3.153 + dc.w = c->tw; 3.154 + drawtext(c->name, !istile, False); 3.155 + XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0); 3.156 XSync(dpy, False); 3.157 } 3.158
4.1 --- a/dwm.1 Wed Aug 23 14:40:44 2006 +0200 4.2 +++ b/dwm.1 Wed Aug 23 18:50:46 2006 +0200 4.3 @@ -21,12 +21,12 @@ 4.4 tag. 4.5 .P 4.6 .B dwm 4.7 -contains a small status bar which displays all available tags, the title and the 4.8 -tags of the focused window, and the text read from standard input. 4.9 +contains a small status bar which displays all available tags, the title 4.10 +of the focused window, and the text read from standard input. The tags of the 4.11 +focused window are highlighted. 4.12 .P 4.13 .B dwm draws a 1-pixel border around windows to indicate the focus state. 4.14 -Unfocused windows contain a small bar in front of them displaying their title 4.15 -and tags. 4.16 +Unfocused windows contain a small bar in front of them displaying their title. 4.17 .SH OPTIONS 4.18 .TP 4.19 .B \-v
5.1 --- a/dwm.h Wed Aug 23 14:40:44 2006 +0200 5.2 +++ b/dwm.h Wed Aug 23 18:50:46 2006 +0200 5.3 @@ -60,7 +60,7 @@ 5.4 Client *next; 5.5 Client *prev; 5.6 Window win; 5.7 - Window title; 5.8 + Window twin; 5.9 }; 5.10 5.11 extern const char *tags[];
6.1 --- a/tag.c Wed Aug 23 14:40:44 2006 +0200 6.2 +++ b/tag.c Wed Aug 23 18:50:46 2006 +0200 6.3 @@ -141,4 +141,6 @@ 6.4 settitle(sel); 6.5 if(!isvisible(sel)) 6.6 arrange(NULL); 6.7 + else 6.8 + drawstatus(); 6.9 }
7.1 --- a/view.c Wed Aug 23 14:40:44 2006 +0200 7.2 +++ b/view.c Wed Aug 23 18:50:46 2006 +0200 7.3 @@ -168,21 +168,21 @@ 7.4 fi = 0; 7.5 mi = 2 * f; 7.6 if(sel->isfloat || arrange == dofloat) { 7.7 - wins[fi++] = sel->title; 7.8 + wins[fi++] = sel->twin; 7.9 wins[fi++] = sel->win; 7.10 } 7.11 else { 7.12 - wins[mi++] = sel->title; 7.13 + wins[mi++] = sel->twin; 7.14 wins[mi++] = sel->win; 7.15 } 7.16 for(c = clients; c; c = c->next) 7.17 if(isvisible(c) && c != sel) { 7.18 if(c->isfloat || arrange == dofloat) { 7.19 - wins[fi++] = c->title; 7.20 + wins[fi++] = c->twin; 7.21 wins[fi++] = c->win; 7.22 } 7.23 else { 7.24 - wins[mi++] = c->title; 7.25 + wins[mi++] = c->twin; 7.26 wins[mi++] = c->win; 7.27 } 7.28 }