67 struct Client { |
67 struct Client { |
68 char name[256]; |
68 char name[256]; |
69 int x, y, w, h; |
69 int x, y, w, h; |
70 int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
70 int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
71 int minax, maxax, minay, maxay; |
71 int minax, maxax, minay, maxay; |
72 long flags; |
|
73 int bw, oldbw; |
72 int bw, oldbw; |
74 Bool isbanned, isfixed, isfloating, ismoved, isurgent; |
73 Bool isbanned, isfixed, isfloating, ismoved, isurgent; |
75 uint tags; |
74 uint tags; |
76 Client *next; |
75 Client *next; |
77 Client *prev; |
76 Client *prev; |
181 void updategeom(void); |
180 void updategeom(void); |
182 void updatesizehints(Client *c); |
181 void updatesizehints(Client *c); |
183 void updatetitle(Client *c); |
182 void updatetitle(Client *c); |
184 void updatewmhints(Client *c); |
183 void updatewmhints(Client *c); |
185 void view(const void *arg); |
184 void view(const void *arg); |
186 void viewprevtag(const void *arg); |
|
187 int xerror(Display *dpy, XErrorEvent *ee); |
185 int xerror(Display *dpy, XErrorEvent *ee); |
188 int xerrordummy(Display *dpy, XErrorEvent *ee); |
186 int xerrordummy(Display *dpy, XErrorEvent *ee); |
189 int xerrorstart(Display *dpy, XErrorEvent *ee); |
187 int xerrorstart(Display *dpy, XErrorEvent *ee); |
190 void zoom(const void *arg); |
188 void zoom(const void *arg); |
191 |
189 |
417 XWindowChanges wc; |
415 XWindowChanges wc; |
418 |
416 |
419 if((c = getclient(ev->window))) { |
417 if((c = getclient(ev->window))) { |
420 if(ev->value_mask & CWBorderWidth) |
418 if(ev->value_mask & CWBorderWidth) |
421 c->bw = ev->border_width; |
419 c->bw = ev->border_width; |
422 if(c->isfixed || c->isfloating || !lt->arrange) { |
420 if(ismax && !c->isbanned && !c->isfixed) |
|
421 XMoveResizeWindow(dpy, c->win, wx, wy, ww - 2 * c->bw, wh + 2 * c->bw); |
|
422 else if(c->isfloating || !lt->arrange) { |
423 if(ev->value_mask & CWX) |
423 if(ev->value_mask & CWX) |
424 c->x = sx + ev->x; |
424 c->x = sx + ev->x; |
425 if(ev->value_mask & CWY) |
425 if(ev->value_mask & CWY) |
426 c->y = sy + ev->y; |
426 c->y = sy + ev->y; |
427 if(ev->value_mask & CWWidth) |
427 if(ev->value_mask & CWWidth) |
944 c->tags = t->tags; |
944 c->tags = t->tags; |
945 else |
945 else |
946 applyrules(c); |
946 applyrules(c); |
947 if(!c->isfloating) |
947 if(!c->isfloating) |
948 c->isfloating = (rettrans == Success) || c->isfixed; |
948 c->isfloating = (rettrans == Success) || c->isfixed; |
|
949 if(c->isfloating) |
|
950 XRaiseWindow(dpy, c->win); |
949 attach(c); |
951 attach(c); |
950 attachstack(c); |
952 attachstack(c); |
951 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); /* some windows require this */ |
953 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); /* some windows require this */ |
952 XMapWindow(dpy, c->win); |
954 XMapWindow(dpy, c->win); |
953 setclientstate(c, NormalState); |
955 setclientstate(c, NormalState); |
1599 void |
1601 void |
1600 updatesizehints(Client *c) { |
1602 updatesizehints(Client *c) { |
1601 long msize; |
1603 long msize; |
1602 XSizeHints size; |
1604 XSizeHints size; |
1603 |
1605 |
1604 if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags) |
1606 XGetWMNormalHints(dpy, c->win, &size, &msize); |
1605 size.flags = PSize; |
1607 if(size.flags & PBaseSize) { |
1606 c->flags = size.flags; |
|
1607 if(c->flags & PBaseSize) { |
|
1608 c->basew = size.base_width; |
1608 c->basew = size.base_width; |
1609 c->baseh = size.base_height; |
1609 c->baseh = size.base_height; |
1610 } |
1610 } |
1611 else if(c->flags & PMinSize) { |
1611 else if(size.flags & PMinSize) { |
1612 c->basew = size.min_width; |
1612 c->basew = size.min_width; |
1613 c->baseh = size.min_height; |
1613 c->baseh = size.min_height; |
1614 } |
1614 } |
1615 else |
1615 else |
1616 c->basew = c->baseh = 0; |
1616 c->basew = c->baseh = 0; |
1617 if(c->flags & PResizeInc) { |
1617 if(size.flags & PResizeInc) { |
1618 c->incw = size.width_inc; |
1618 c->incw = size.width_inc; |
1619 c->inch = size.height_inc; |
1619 c->inch = size.height_inc; |
1620 } |
1620 } |
1621 else |
1621 else |
1622 c->incw = c->inch = 0; |
1622 c->incw = c->inch = 0; |
1623 if(c->flags & PMaxSize) { |
1623 if(size.flags & PMaxSize) { |
1624 c->maxw = size.max_width; |
1624 c->maxw = size.max_width; |
1625 c->maxh = size.max_height; |
1625 c->maxh = size.max_height; |
1626 } |
1626 } |
1627 else |
1627 else |
1628 c->maxw = c->maxh = 0; |
1628 c->maxw = c->maxh = 0; |
1629 if(c->flags & PMinSize) { |
1629 if(size.flags & PMinSize) { |
1630 c->minw = size.min_width; |
1630 c->minw = size.min_width; |
1631 c->minh = size.min_height; |
1631 c->minh = size.min_height; |
1632 } |
1632 } |
1633 else if(c->flags & PBaseSize) { |
1633 else if(size.flags & PBaseSize) { |
1634 c->minw = size.base_width; |
1634 c->minw = size.base_width; |
1635 c->minh = size.base_height; |
1635 c->minh = size.base_height; |
1636 } |
1636 } |
1637 else |
1637 else |
1638 c->minw = c->minh = 0; |
1638 c->minw = c->minh = 0; |
1639 if(c->flags & PAspect) { |
1639 if(size.flags & PAspect) { |
1640 c->minax = size.min_aspect.x; |
1640 c->minax = size.min_aspect.x; |
1641 c->maxax = size.max_aspect.x; |
1641 c->maxax = size.max_aspect.x; |
1642 c->minay = size.min_aspect.y; |
1642 c->minay = size.min_aspect.y; |
1643 c->maxay = size.max_aspect.y; |
1643 c->maxay = size.max_aspect.y; |
1644 } |
1644 } |
1667 } |
1667 } |
1668 } |
1668 } |
1669 |
1669 |
1670 void |
1670 void |
1671 view(const void *arg) { |
1671 view(const void *arg) { |
1672 if(*(int *)arg & TAGMASK) { |
1672 seltags ^= 1; /* toggle sel tagset */ |
1673 seltags ^= 1; /* toggle sel tagset */ |
1673 if(arg && (*(int *)arg & TAGMASK)) |
1674 tagset[seltags] = *(int *)arg & TAGMASK; |
1674 tagset[seltags] = *(int *)arg & TAGMASK; |
1675 arrange(); |
|
1676 } |
|
1677 } |
|
1678 |
|
1679 void |
|
1680 viewprevtag(const void *arg) { |
|
1681 seltags ^= 1; /* toggle sel tagset */ |
|
1682 arrange(); |
1675 arrange(); |
1683 } |
1676 } |
1684 |
1677 |
1685 /* There's no way to check accesses to destroyed windows, thus those cases are |
1678 /* There's no way to check accesses to destroyed windows, thus those cases are |
1686 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs |
1679 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs |