about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-11 23:46:39 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-11 23:46:39 +0200
commit896f08d7d553f7def3877648c113cf03e6ca546a (patch)
tree0efd542885c5726948eb5eb7837ffc6355be6358
parent83d23908d3438d7f1f62533a7c8d96fc1019df55 (diff)
downloaddwm-896f08d7d553f7def3877648c113cf03e6ca546a.tar.gz
fixed several other stuff, coming closer to something useful
-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()
 	if(stack) {
 		brush.rect.width = textwidth(&brush.font, stack->name) + labelheight(&brush.font);
 		swap((void **)&brush.fg, (void **)&brush.bg);
-		draw(dpy, &brush, False, stack->name);
+		draw(dpy, &brush, True, stack->name);
 		swap((void **)&brush.fg, (void **)&brush.bg);
 		brush.rect.x += brush.rect.width;
 	}
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)
 
 	c = emallocz(sizeof(Client));
 	c->win = w;
-	c->x = wa->x;
-	c->y = wa->y;
-	c->w = wa->width;
+	c->tx = c->x = wa->x;
+	c->ty = c->y = wa->y;
+	c->tw = c->w = wa->width;
 	c->h = wa->height;
+	c->th = barrect.height;
 	update_size(c);
 	XSetWindowBorderWidth(dpy, c->win, 1);
+	XSetWindowBorder(dpy, c->win, brush.border);
 	XSelectInput(dpy, c->win, CLIENT_MASK);
 	XGetTransientForHint(dpy, c->win, &c->trans);
 	twa.override_redirect = 1;
 	twa.background_pixmap = ParentRelative;
-	twa.event_mask = ExposureMask;
+	twa.event_mask = SubstructureNotifyMask | ExposureMask;
 
-	c->title = XCreateWindow(dpy, root, c->x, c->y, c->w, barrect.height,
+	c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
 			0, DefaultDepth(dpy, screen), CopyFromParent,
 			DefaultVisual(dpy, screen),
 			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
@@ -145,7 +147,6 @@ resize(Client *c)
 	XConfigureEvent e;
 
 	XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
-	XMoveResizeWindow(dpy, c->title, c->x + c->w / 3, c->y, 2 * c->w / 3, barrect.height);
 	e.type = ConfigureNotify;
 	e.event = c->win;
 	e.window = c->win;
@@ -177,7 +178,6 @@ unmanage(Client *c)
 	XSetErrorHandler(dummy_error_handler);
 
 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
-	XUnmapWindow(dpy, c->win);
 	XDestroyWindow(dpy, c->title);
 
 	for(l=&clients; *l && *l != c; l=&(*l)->next);
@@ -210,17 +210,20 @@ getclient(Window w)
 void
 draw_client(Client *c)
 {
-	if(!c)
-		return;
 	if(c == stack)
 		draw_bar();
 
+	c->tw = textwidth(&brush.font, c->name) + labelheight(&brush.font);
+	c->tx = c->x + c->w - c->tw + 2;
+	c->ty = c->y;
+	XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th);
+
 	brush.rect.x = brush.rect.y = 0;
-	brush.rect.width = 2 * c->w / 3;
-	brush.rect.height = barrect.height;
+	brush.rect.width = c->tw;
+	brush.rect.height = c->th;
 
 	draw(dpy, &brush, True, c->name);
-	XCopyArea(dpy, brush.drawable, c->title, brush.gc, 0, 0,
-			brush.rect.width, brush.rect.height, 0, 0);
+	XCopyArea(dpy, brush.drawable, c->title, brush.gc,
+			0, 0, c->tw, c->th, 0, 0);
 	XFlush(dpy);
 }
diff --git a/config.h b/config.h
index a8e3449..6f33ed6 100644
--- a/config.h
+++ b/config.h
@@ -6,5 +6,5 @@
 #define FONT		"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
 #define BGCOLOR		"#000000"
 #define FGCOLOR		"#ffaa00"
-#define BORDERCOLOR	"#000000"
+#define BORDERCOLOR	"#ee8800"
 #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)
 		}
 		if(ev->atom == XA_WM_NAME || ev->atom == net_atom[NetWMName]) {
 			update_name(c);
+			if(c == stack)
+				draw_bar();
+			else
+				draw_client(c);
 		}
 	}
 }
diff --git a/wm.h b/wm.h
index a24b40d..fc07b5c 100644
--- a/wm.h
+++ b/wm.h
@@ -25,6 +25,7 @@ struct Client {
 	char name[256], tag[256];
 	int proto;
 	int x, y, w, h;
+	int tx, ty, tw, th;
 	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 	long flags; 
 	Window win;
v1.8.1&id=2ca2e862e616eba862ac80f5ee0003d1aa984a32'>^
f07bb12f ^


4c13e1f2 ^

f07bb12f ^



4c13e1f2 ^


f07bb12f ^











f07bb12f ^















4c13e1f2 ^




34a60763 ^
4c13e1f2 ^
34a60763 ^
4c13e1f2 ^



f07bb12f ^
62cd83ba ^
f07bb12f ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145