summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bar.c2
-rw-r--r--client.c29
-rw-r--r--config.h2
-rw-r--r--event.c4
-rw-r--r--wm.h1
5 files changed, 23 insertions, 15 deletions
diff --git a/bar.c b/bar.c
index f3a11b8..1f12512 100644
--- a/bar.c
+++ b/bar.c
@@ -15,7 +15,7 @@ draw_bar()
15 if(stack) { 15 if(stack) {
16 brush.rect.width = textwidth(&brush.font, stack->name) + labelheight(&brush.font); 16 brush.rect.width = textwidth(&brush.font, stack->name) + labelheight(&brush.font);
17 swap((void **)&brush.fg, (void **)&brush.bg); 17 swap((void **)&brush.fg, (void **)&brush.bg);
18 draw(dpy, &brush, False, stack->name); 18 draw(dpy, &brush, True, stack->name);
19 swap((void **)&brush.fg, (void **)&brush.bg); 19 swap((void **)&brush.fg, (void **)&brush.bg);
20 brush.rect.x += brush.rect.width; 20 brush.rect.x += brush.rect.width;
21 } 21 }
diff --git a/client.c b/client.c
index b7c9455..eb3acf4 100644
--- a/client.c
+++ b/client.c
@@ -104,19 +104,21 @@ manage(Window w, XWindowAttributes *wa)
104 104
105 c = emallocz(sizeof(Client)); 105 c = emallocz(sizeof(Client));
106 c->win = w; 106 c->win = w;
107 c->x = wa->x; 107 c->tx = c->x = wa->x;
108 c->y = wa->y; 108 c->ty = c->y = wa->y;
109 c->w = wa->width; 109 c->tw = c->w = wa->width;
110 c->h = wa->height; 110 c->h = wa->height;
111 c->th = barrect.height;
111 update_size(c); 112 update_size(c);
112 XSetWindowBorderWidth(dpy, c->win, 1); 113 XSetWindowBorderWidth(dpy, c->win, 1);
114 XSetWindowBorder(dpy, c->win, brush.border);
113 XSelectInput(dpy, c->win, CLIENT_MASK); 115 XSelectInput(dpy, c->win, CLIENT_MASK);
114 XGetTransientForHint(dpy, c->win, &c->trans); 116 XGetTransientForHint(dpy, c->win, &c->trans);
115 twa.override_redirect = 1; 117 twa.override_redirect = 1;
116 twa.background_pixmap = ParentRelative; 118 twa.background_pixmap = ParentRelative;
117 twa.event_mask = ExposureMask; 119 twa.event_mask = SubstructureNotifyMask | ExposureMask;
118 120
119 c->title = XCreateWindow(dpy, root, c->x, c->y, c->w, barrect.height, 121 c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
120 0, DefaultDepth(dpy, screen), CopyFromParent, 122 0, DefaultDepth(dpy, screen), CopyFromParent,
121 DefaultVisual(dpy, screen), 123 DefaultVisual(dpy, screen),
122 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); 124 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
@@ -145,7 +147,6 @@ resize(Client *c)
145 XConfigureEvent e; 147 XConfigureEvent e;
146 148
147 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); 149 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
148 XMoveResizeWindow(dpy, c->title, c->x + c->w / 3, c->y, 2 * c->w / 3, barrect.height);
149 e.type = ConfigureNotify; 150 e.type = ConfigureNotify;
150 e.event = c->win; 151 e.event = c->win;
151 e.window = c->win; 152 e.window = c->win;
@@ -177,7 +178,6 @@ unmanage(Client *c)
177 XSetErrorHandler(dummy_error_handler); 178 XSetErrorHandler(dummy_error_handler);
178 179
179 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); 180 XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
180 XUnmapWindow(dpy, c->win);
181 XDestroyWindow(dpy, c->title); 181 XDestroyWindow(dpy, c->title);
182 182
183 for(l=&clients; *l && *l != c; l=&(*l)->next); 183 for(l=&clients; *l && *l != c; l=&(*l)->next);
@@ -210,17 +210,20 @@ getclient(Window w)
210void 210void
211draw_client(Client *c) 211draw_client(Client *c)
212{ 212{
213 if(!c)
214 return;
215 if(c == stack) 213 if(c == stack)
216 draw_bar(); 214 draw_bar();
217 215
216 c->tw = textwidth(&brush.font, c->name) + labelheight(&brush.font);
217 c->tx = c->x + c->w - c->tw + 2;
218 c->ty = c->y;
219 XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th);
220
218 brush.rect.x = brush.rect.y = 0; 221 brush.rect.x = brush.rect.y = 0;
219 brush.rect.width = 2 * c->w / 3; 222 brush.rect.width = c->tw;
220 brush.rect.height = barrect.height; 223 brush.rect.height = c->th;
221 224
222 draw(dpy, &brush, True, c->name); 225 draw(dpy, &brush, True, c->name);
223 XCopyArea(dpy, brush.drawable, c->title, brush.gc, 0, 0, 226 XCopyArea(dpy, brush.drawable, c->title, brush.gc,
224 brush.rect.width, brush.rect.height, 0, 0); 227 0, 0, c->tw, c->th, 0, 0);
225 XFlush(dpy); 228 XFlush(dpy);
226} 229}
diff --git a/config.h b/config.h
index a8e3449..6f33ed6 100644
--- a/config.h
+++ b/config.h
@@ -6,5 +6,5 @@
6#define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*" 6#define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
7#define BGCOLOR "#000000" 7#define BGCOLOR "#000000"
8#define FGCOLOR "#ffaa00" 8#define FGCOLOR "#ffaa00"
9#define BORDERCOLOR "#000000" 9#define BORDERCOLOR "#ee8800"
10#define STATUSDELAY 10 /* milliseconds */ 10#define STATUSDELAY 10 /* milliseconds */
diff --git a/event.c b/event.c
index f29038a..ba41f55 100644
--- a/event.c
+++ b/event.c
@@ -204,6 +204,10 @@ propertynotify(XEvent *e)
204 } 204 }
205 if(ev->atom == XA_WM_NAME || ev->atom == net_atom[NetWMName]) { 205 if(ev->atom == XA_WM_NAME || ev->atom == net_atom[NetWMName]) {
206 update_name(c); 206 update_name(c);
207 if(c == stack)
208 draw_bar();
209 else
210 draw_client(c);
207 } 211 }
208 } 212 }
209} 213}
diff --git a/wm.h b/wm.h
index a24b40d..fc07b5c 100644
--- a/wm.h
+++ b/wm.h
@@ -25,6 +25,7 @@ struct Client {
25 char name[256], tag[256]; 25 char name[256], tag[256];
26 int proto; 26 int proto;
27 int x, y, w, h; 27 int x, y, w, h;
28 int tx, ty, tw, th;
28 int basew, baseh, incw, inch, maxw, maxh, minw, minh; 29 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
29 long flags; 30 long flags;
30 Window win; 31 Window win;