183 c->win = w; |
183 c->win = w; |
184 c->x = wa->x; |
184 c->x = wa->x; |
185 c->y = wa->y; |
185 c->y = wa->y; |
186 c->w = wa->width; |
186 c->w = wa->width; |
187 c->h = wa->height; |
187 c->h = wa->height; |
|
188 c->oldborder = wa->border_width; |
188 if(c->w == sw && c->h == sh) { |
189 if(c->w == sw && c->h == sh) { |
189 c->x = sx; |
190 c->x = sx; |
190 c->y = sy; |
191 c->y = sy; |
|
192 c->border = wa->border_width; |
191 } |
193 } |
192 else { |
194 else { |
193 if(c->x + c->w + 2 * c->border > wax + waw) |
195 if(c->x + c->w + 2 * c->border > wax + waw) |
194 c->x = wax + waw - c->w - 2 * c->border; |
196 c->x = wax + waw - c->w - 2 * c->border; |
195 if(c->y + c->h + 2 * c->border > way + wah) |
197 if(c->y + c->h + 2 * c->border > way + wah) |
196 c->y = way + wah - c->h - 2 * c->border; |
198 c->y = way + wah - c->h - 2 * c->border; |
197 if(c->x < wax) |
199 if(c->x < wax) |
198 c->x = wax; |
200 c->x = wax; |
199 if(c->y < way) |
201 if(c->y < way) |
200 c->y = way; |
202 c->y = way; |
201 } |
203 c->border = BORDERPX; |
|
204 } |
|
205 wc.border_width = c->border; |
|
206 XConfigureWindow(dpy, w, CWBorderWidth, &wc); |
|
207 XSetWindowBorder(dpy, w, dc.norm[ColBorder]); |
|
208 configure(c); /* propagates border_width, if size doesn't change */ |
202 updatesizehints(c); |
209 updatesizehints(c); |
203 XSelectInput(dpy, w, |
210 XSelectInput(dpy, w, |
204 StructureNotifyMask | PropertyChangeMask | EnterWindowMask); |
211 StructureNotifyMask | PropertyChangeMask | EnterWindowMask); |
205 grabbuttons(c, False); |
212 grabbuttons(c, False); |
206 c->border = wc.border_width = (c->w == sw && c->h == sh) ? wa->border_width : BORDERPX; |
|
207 XConfigureWindow(dpy, w, CWBorderWidth, &wc); |
|
208 XSetWindowBorder(dpy, w, dc.norm[ColBorder]); |
|
209 configure(c); /* propagates border_width, if size doesn't change */ |
|
210 updatetitle(c); |
213 updatetitle(c); |
211 if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success)) |
214 if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success)) |
212 for(t = clients; t && t->win != trans; t = t->next); |
215 for(t = clients; t && t->win != trans; t = t->next); |
213 settags(c, t); |
216 settags(c, t); |
214 if(!c->isfloating) |
217 if(!c->isfloating) |
376 } |
379 } |
377 |
380 |
378 void |
381 void |
379 unmanage(Client *c) { |
382 unmanage(Client *c) { |
380 Client *nc; |
383 Client *nc; |
381 |
384 XWindowChanges wc; |
|
385 |
|
386 wc.border_width = c->oldborder; |
382 /* The server grab construct avoids race conditions. */ |
387 /* The server grab construct avoids race conditions. */ |
383 XGrabServer(dpy); |
388 XGrabServer(dpy); |
384 XSetErrorHandler(xerrordummy); |
389 XSetErrorHandler(xerrordummy); |
|
390 XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */ |
385 detach(c); |
391 detach(c); |
386 detachstack(c); |
392 detachstack(c); |
387 if(sel == c) { |
393 if(sel == c) { |
388 for(nc = stack; nc && !isvisible(nc); nc = nc->snext); |
394 for(nc = stack; nc && !isvisible(nc); nc = nc->snext); |
389 focus(nc); |
395 focus(nc); |