Mercurial > aewl
comparison client.c @ 158:4e42dfc0f61f
new resize stuff (using XConfigureWindow instead of XSendEvent)
author | arg@10ksloc.org |
---|---|
date | Wed, 02 Aug 2006 10:43:21 +0200 |
parents | 93012e947eae |
children | a5eab6aaf859 |
comparison
equal
deleted
inserted
replaced
157:93012e947eae | 158:4e42dfc0f61f |
---|---|
269 void | 269 void |
270 resize(Client *c, Bool sizehints, Corner sticky) | 270 resize(Client *c, Bool sizehints, Corner sticky) |
271 { | 271 { |
272 int bottom = c->y + c->h; | 272 int bottom = c->y + c->h; |
273 int right = c->x + c->w; | 273 int right = c->x + c->w; |
274 XConfigureEvent e; | 274 XWindowChanges wc; |
275 | 275 |
276 if(sizehints) { | 276 if(sizehints) { |
277 if(c->incw) | 277 if(c->incw) |
278 c->w -= (c->w - c->basew) % c->incw; | 278 c->w -= (c->w - c->basew) % c->incw; |
279 if(c->inch) | 279 if(c->inch) |
285 if(c->maxw && c->w > c->maxw) | 285 if(c->maxw && c->w > c->maxw) |
286 c->w = c->maxw; | 286 c->w = c->maxw; |
287 if(c->maxh && c->h > c->maxh) | 287 if(c->maxh && c->h > c->maxh) |
288 c->h = c->maxh; | 288 c->h = c->maxh; |
289 } | 289 } |
290 if(c->x > sw) /* might happen on restart */ | |
291 c->x = sw - c->w; | |
292 if(c->y > sh) | |
293 c->y = sh - c->h; | |
294 if(sticky == TopRight || sticky == BotRight) | 290 if(sticky == TopRight || sticky == BotRight) |
295 c->x = right - c->w; | 291 c->x = right - c->w; |
296 if(sticky == BotLeft || sticky == BotRight) | 292 if(sticky == BotLeft || sticky == BotRight) |
297 c->y = bottom - c->h; | 293 c->y = bottom - c->h; |
298 | 294 |
299 resizetitle(c); | 295 resizetitle(c); |
300 XSetWindowBorderWidth(dpy, c->win, 1); | 296 |
301 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); | 297 if(c->tags[tsel]) |
302 | 298 wc.x = c->x; |
303 e.type = ConfigureNotify; | 299 else |
304 e.event = c->win; | 300 wc.x = c->x + 2 * sw; |
305 e.window = c->win; | 301 wc.y = c->y; |
306 e.x = c->x; | 302 wc.width = c->w; |
307 e.y = c->y; | 303 wc.height = c->h; |
308 e.width = c->w; | 304 wc.border_width = 1; |
309 e.height = c->h; | 305 XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); |
310 e.border_width = c->border; | |
311 e.above = None; | |
312 e.override_redirect = False; | |
313 XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e); | |
314 XSync(dpy, False); | 306 XSync(dpy, False); |
315 } | 307 } |
316 | 308 |
317 void | 309 void |
318 setsize(Client *c) | 310 setsize(Client *c) |