removed client title bar 6c5dc701
Anselm R. Garbe · 2007-01-14 22:27 6 file(s) · +10 −73
client.c +4 −46
61 61
/* extern functions */
62 62
63 63
void
64 -
ban(Client *c) {
65 -
	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
66 -
	XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty);
67 -
}
68 -
69 -
void
70 64
configure(Client *c) {
71 65
	XEvent synev;
72 66
121 115
	return NULL;
122 116
}
123 117
124 -
Client *
125 -
getctitle(Window w) {
126 -
	Client *c;
127 -
128 -
	for(c = clients; c; c = c->next)
129 -
		if(c->twin == w)
130 -
			return c;
131 -
	return NULL;
132 -
}
133 -
134 118
void
135 119
killclient(Arg *arg) {
136 120
	if(!sel)
145 129
manage(Window w, XWindowAttributes *wa) {
146 130
	Client *c;
147 131
	Window trans;
148 -
	XSetWindowAttributes twa;
149 132
150 133
	c = emallocz(sizeof(Client));
151 134
	c->tags = emallocz(ntags * sizeof(Bool));
152 135
	c->win = w;
153 136
	c->border = 0;
154 -
	c->x = c->tx = wa->x;
155 -
	c->y = c->ty = wa->y;
156 -
	c->w = c->tw = wa->width;
137 +
	c->x = wa->x;
138 +
	c->y = wa->y;
139 +
	c->w = wa->width;
157 140
	c->h = wa->height;
158 -
	c->th = bh;
159 141
	updatesizehints(c);
160 142
	if(c->x + c->w + 2 * BORDERPX > sw)
161 143
		c->x = sw - c->w - 2 * BORDERPX;
169 151
	XSelectInput(dpy, c->win,
170 152
		StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
171 153
	XGetTransientForHint(dpy, c->win, &trans);
172 -
	twa.override_redirect = 1;
173 -
	twa.background_pixmap = ParentRelative;
174 -
	twa.event_mask = ExposureMask | EnterWindowMask;
175 -
	c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
176 -
			0, DefaultDepth(dpy, screen), CopyFromParent,
177 -
			DefaultVisual(dpy, screen),
178 -
			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
179 154
	grabbuttons(c, False);
180 155
	updatetitle(c);
181 156
	settags(c, getclient(trans));
182 157
	if(!c->isfloat)
183 158
		c->isfloat = trans || c->isfixed;
184 -
	resizetitle(c);
185 159
	if(clients)
186 160
		clients->prev = c;
187 161
	c->next = clients;
188 162
	c->snext = stack;
189 163
	stack = clients = c;
190 -
	ban(c);
164 +
	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
191 165
	XMapWindow(dpy, c->win);
192 -
	XMapWindow(dpy, c->twin);
193 166
	if(isvisible(c))
194 167
		focus(c);
195 168
	arrange();
228 201
		c->x = sw - c->w;
229 202
	if(c->y > sh)
230 203
		c->y = sh - c->h;
231 -
	resizetitle(c);
232 204
	wc.x = c->x;
233 205
	wc.y = c->y;
234 206
	wc.width = c->w;
243 215
}
244 216
245 217
void
246 -
resizetitle(Client *c) {
247 -
	c->tw = textw(c->name);
248 -
	if(c->tw > c->w)
249 -
		c->tw = c->w + 2 * BORDERPX;
250 -
	c->tx = c->x + c->w - c->tw + 2 * BORDERPX;
251 -
	c->ty = c->y;
252 -
	if(isvisible(c))
253 -
		XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
254 -
	else
255 -
		XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th);
256 -
}
257 -
258 -
void
259 218
updatesizehints(Client *c) {
260 219
	long msize;
261 220
	XSizeHints size;
331 290
		focus(nc);
332 291
	}
333 292
	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
334 -
	XDestroyWindow(dpy, c->twin);
335 293
	free(c->tags);
336 294
	free(c);
337 295
	XSync(dpy, False);
draw.c +0 −6
141 141
drawclient(Client *c) {
142 142
	if(c == sel && issel) {
143 143
		drawstatus();
144 -
		XUnmapWindow(dpy, c->twin);
145 144
		XSetWindowBorder(dpy, c->win, dc.sel[ColBG]);
146 145
		return;
147 146
	}
148 147
	XSetWindowBorder(dpy, c->win, dc.norm[ColBG]);
149 -
	XMapWindow(dpy, c->twin);
150 -
	dc.x = dc.y = 0;
151 -
	dc.w = c->tw;
152 -
	drawtext(c->name, dc.norm, False, False);
153 -
	XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0);
154 148
	XSync(dpy, False);
155 149
}
156 150
dwm.1 +0 −1
26 26
the top left corner.
27 27
.P
28 28
dwm draws a 1-pixel border around windows to indicate the focus state.
29 -
Unfocused windows contain a small bar in front of them displaying their title.
30 29
.SH OPTIONS
31 30
.TP
32 31
.B \-v
dwm.h +0 −5
78 78
	int proto;
79 79
	int x, y, w, h;
80 80
	int rx, ry, rw, rh; /* revert geometry */
81 -
	int tx, ty, tw, th; /* title window geometry */
82 81
	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
83 82
	long flags; 
84 83
	unsigned int border;
88 87
	Client *prev;
89 88
	Client *snext;
90 89
	Window win;
91 -
	Window twin;
92 90
};
93 91
94 92
extern const char *tags[];			/* all tags */
110 108
extern Window root, barwin;
111 109
112 110
/* client.c */
113 -
extern void ban(Client *c);			/* ban c from screen */
114 111
extern void configure(Client *c);		/* send synthetic configure event */
115 112
extern void focus(Client *c);			/* focus c, c may be NULL */
116 113
extern Client *getclient(Window w);		/* return client of w */
117 -
extern Client *getctitle(Window w);		/* return client of title window */
118 114
extern void killclient(Arg *arg);		/* kill c nicely */
119 115
extern void manage(Window w, XWindowAttributes *wa);	/* manage new client */
120 116
extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
121 -
extern void resizetitle(Client *c);		/* resizes c->twin correctly */
122 117
extern void updatesizehints(Client *c);		/* update the size hint variables of c */
123 118
extern void updatetitle(Client *c);		/* update the name of c */
124 119
extern void unmanage(Client *c);		/* destroy c */
event.c +2 −5
196 196
		if(c->isfloat) {
197 197
			resize(c, False, TopLeft);
198 198
			if(!isvisible(c))
199 -
				ban(c);
199 +
				XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
200 200
		}
201 201
		else
202 202
			arrange();
230 230
231 231
	if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
232 232
		return;
233 -
	if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c))
233 +
	if((c = getclient(ev->window)) && isvisible(c))
234 234
		focus(c);
235 235
	else if(ev->window == root) {
236 236
		issel = True;
247 247
	if(ev->count == 0) {
248 248
		if(barwin == ev->window)
249 249
			drawstatus();
250 -
		else if((c = getctitle(ev->window)))
251 -
			drawclient(c);
252 250
	}
253 251
}
254 252
331 329
		}
332 330
		if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
333 331
			updatetitle(c);
334 -
			resizetitle(c);
335 332
			drawclient(c);
336 333
		}
337 334
	}
view.c +4 −10
59 59
			resize(c, True, TopLeft);
60 60
		}
61 61
		else
62 -
			ban(c);
62 +
			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
63 63
	}
64 64
	if(!sel || !isvisible(sel)) {
65 65
		for(c = stack; c && !isvisible(c); c = c->snext);
109 109
			i++;
110 110
		}
111 111
		else
112 -
			ban(c);
113 -
112 +
			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
114 113
	if(!sel || !isvisible(sel)) {
115 114
		for(c = stack; c && !isvisible(c); c = c->snext);
116 115
		focus(c);
191 190
		drawstatus();
192 191
		return;
193 192
	}
194 -
	if(sel->isfloat || arrange == dofloat) {
193 +
	if(sel->isfloat || arrange == dofloat)
195 194
		XRaiseWindow(dpy, sel->win);
196 -
		XRaiseWindow(dpy, sel->twin);
197 -
	}
198 195
	if(arrange != dofloat) {
199 -
		if(!sel->isfloat) {
200 -
			XLowerWindow(dpy, sel->twin);
196 +
		if(!sel->isfloat)
201 197
			XLowerWindow(dpy, sel->win);
202 -
		}
203 198
		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
204 199
			if(c == sel)
205 200
				continue;
206 -
			XLowerWindow(dpy, c->twin);
207 201
			XLowerWindow(dpy, c->win);
208 202
		}
209 203
	}