dwm-meillo
diff client.c @ 20:4560e0882c1d
made code more readable
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Tue, 11 Jul 2006 22:49:09 +0200 |
parents | b5510d0c6d43 |
children | 3ef108a5ca0a |
line diff
1.1 --- a/client.c Tue Jul 11 21:41:49 2006 +0200 1.2 +++ b/client.c Tue Jul 11 22:49:09 2006 +0200 1.3 @@ -44,6 +44,24 @@ 1.4 } 1.5 1.6 void 1.7 +update_size(Client *c) 1.8 +{ 1.9 + XSizeHints size; 1.10 + long msize; 1.11 + if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags) 1.12 + size.flags = PSize; 1.13 + c->flags = size.flags; 1.14 + c->basew = size.base_width; 1.15 + c->baseh = size.base_height; 1.16 + c->incw = size.width_inc; 1.17 + c->inch = size.height_inc; 1.18 + c->maxw = size.max_width; 1.19 + c->maxh = size.max_height; 1.20 + c->minw = size.min_width; 1.21 + c->minh = size.min_height; 1.22 +} 1.23 + 1.24 +void 1.25 focus(Client *c) 1.26 { 1.27 Client **l; 1.28 @@ -62,31 +80,24 @@ 1.29 { 1.30 Client *c, **l; 1.31 XSetWindowAttributes twa; 1.32 - long msize; 1.33 1.34 c = emallocz(sizeof(Client)); 1.35 c->win = w; 1.36 - c->r[RFloat].x = wa->x; 1.37 - c->r[RFloat].y = wa->y; 1.38 - c->r[RFloat].width = wa->width; 1.39 - c->r[RFloat].height = wa->height; 1.40 + c->x = wa->x; 1.41 + c->y = wa->y; 1.42 + c->w = wa->width; 1.43 + c->h = wa->height; 1.44 + update_size(c); 1.45 XSetWindowBorderWidth(dpy, c->win, 1); 1.46 XSelectInput(dpy, c->win, CLIENT_MASK); 1.47 XGetTransientForHint(dpy, c->win, &c->trans); 1.48 - if(!XGetWMNormalHints(dpy, c->win, &c->size, &msize) || !c->size.flags) 1.49 - c->size.flags = PSize; 1.50 - c->fixedsize = 1.51 - (c->size.flags & PMinSize && c->size.flags & PMaxSize 1.52 - && c->size.min_width == c->size.max_width 1.53 - && c->size.min_height == c->size.max_height); 1.54 update_name(c); 1.55 twa.override_redirect = 1; 1.56 twa.background_pixmap = ParentRelative; 1.57 twa.event_mask = ExposureMask; 1.58 1.59 - c->title = XCreateWindow(dpy, root, c->r[RFloat].x, c->r[RFloat].y, 1.60 - c->r[RFloat].width, barrect.height, 0, 1.61 - DefaultDepth(dpy, screen), CopyFromParent, 1.62 + c->title = XCreateWindow(dpy, root, c->x, c->y, c->w, barrect.height, 1.63 + 0, DefaultDepth(dpy, screen), CopyFromParent, 1.64 DefaultVisual(dpy, screen), 1.65 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); 1.66 1.67 @@ -110,15 +121,14 @@ 1.68 { 1.69 XConfigureEvent e; 1.70 1.71 - XMoveResizeWindow(dpy, c->win, c->r[RFloat].x, c->r[RFloat].y, 1.72 - c->r[RFloat].width, c->r[RFloat].height); 1.73 + XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); 1.74 e.type = ConfigureNotify; 1.75 e.event = c->win; 1.76 e.window = c->win; 1.77 - e.x = c->r[RFloat].x; 1.78 - e.y = c->r[RFloat].y; 1.79 - e.width = c->r[RFloat].width; 1.80 - e.height = c->r[RFloat].height; 1.81 + e.x = c->x; 1.82 + e.y = c->y; 1.83 + e.width = c->w; 1.84 + e.height = c->h; 1.85 e.border_width = 0; 1.86 e.above = None; 1.87 e.override_redirect = False;