applied yiyus fgeom patch
7f70d902
2 file(s) · +41 −35
| 35 | 35 | Layout layouts[] = { |
|
| 36 | 36 | /* symbol function isfloating */ |
|
| 37 | 37 | { "[]=", tilev, False }, /* first entry is default */ |
|
| 38 | + | { "<>=", tilev, True }, |
|
| 38 | 39 | { "[]|", tileh, False }, |
|
| 39 | - | { "><>", floating, True }, |
|
| 40 | + | { "<>|", tileh, True }, |
|
| 41 | + | { "><>", NULL, True }, |
|
| 42 | + | { "[m]", monocle, False }, |
|
| 40 | 43 | { "[M]", monocle, True }, |
|
| 41 | 44 | }; |
|
| 42 | 45 |
| 68 | 68 | struct Client { |
|
| 69 | 69 | char name[256]; |
|
| 70 | 70 | int x, y, w, h; |
|
| 71 | + | int fx, fy, fw, fh; |
|
| 71 | 72 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
|
| 72 | 73 | int minax, maxax, minay, maxay; |
|
| 73 | 74 | long flags; |
|
| 144 | 145 | void enternotify(XEvent *e); |
|
| 145 | 146 | void eprint(const char *errstr, ...); |
|
| 146 | 147 | void expose(XEvent *e); |
|
| 147 | - | void floating(void); /* default floating layout */ |
|
| 148 | 148 | void focus(Client *c); |
|
| 149 | 149 | void focusin(XEvent *e); |
|
| 150 | 150 | void focusnext(const char *arg); |
|
| 286 | 286 | Client *c; |
|
| 287 | 287 | ||
| 288 | 288 | for(c = clients; c; c = c->next) |
|
| 289 | - | if(isvisible(c)) |
|
| 289 | + | if(isvisible(c)) { |
|
| 290 | 290 | unban(c); |
|
| 291 | + | if(lt->isfloating || c->isfloating) |
|
| 292 | + | resize(c, c->fx, c->fy, c->fw, c->fh, True); |
|
| 293 | + | } |
|
| 291 | 294 | else |
|
| 292 | 295 | ban(c); |
|
| 293 | 296 | ||
| 294 | 297 | focus(NULL); |
|
| 295 | - | lt->arrange(); |
|
| 298 | + | if(lt->arrange) |
|
| 299 | + | lt->arrange(); |
|
| 296 | 300 | restack(); |
|
| 297 | 301 | } |
|
| 298 | 302 | ||
| 360 | 364 | movemouse(c); |
|
| 361 | 365 | } |
|
| 362 | 366 | else if(ev->button == Button2) { |
|
| 363 | - | if((floating != lt->arrange) && c->isfloating) |
|
| 367 | + | if(!lt->isfloating && c->isfloating) |
|
| 364 | 368 | togglefloating(NULL); |
|
| 365 | 369 | else |
|
| 366 | 370 | zoom(NULL); |
|
| 670 | 674 | } |
|
| 671 | 675 | ||
| 672 | 676 | void |
|
| 673 | - | floating(void) { /* default floating layout */ |
|
| 674 | - | Client *c; |
|
| 675 | - | ||
| 676 | - | for(c = clients; c; c = c->next) |
|
| 677 | - | if(isvisible(c)) |
|
| 678 | - | resize(c, c->x, c->y, c->w, c->h, True); |
|
| 679 | - | } |
|
| 680 | - | ||
| 681 | - | void |
|
| 682 | 677 | focus(Client *c) { |
|
| 683 | 678 | if(!c || (c && !isvisible(c))) |
|
| 684 | 679 | for(c = stack; c && !isvisible(c); c = c->snext); |
|
| 993 | 988 | /* geometry */ |
|
| 994 | 989 | c->x = wa->x; |
|
| 995 | 990 | c->y = wa->y; |
|
| 996 | - | c->w = wa->width; |
|
| 997 | - | c->h = wa->height; |
|
| 991 | + | c->w = c->fw = wa->width; |
|
| 992 | + | c->h = c->fh = wa->height; |
|
| 998 | 993 | c->oldbw = wa->border_width; |
|
| 999 | 994 | if(c->w == sw && c->h == sh) { |
|
| 1000 | 995 | c->x = sx; |
|
| 1010 | 1005 | c->y = MAX(c->y, wy); |
|
| 1011 | 1006 | c->bw = BORDERPX; |
|
| 1012 | 1007 | } |
|
| 1008 | + | c->fx = c->x; |
|
| 1009 | + | c->fy = c->y; |
|
| 1013 | 1010 | ||
| 1014 | 1011 | wc.border_width = c->bw; |
|
| 1015 | 1012 | XConfigureWindow(dpy, w, CWBorderWidth, &wc); |
|
| 1105 | 1102 | ny = wy + wh - c->h - 2 * c->bw; |
|
| 1106 | 1103 | if(!c->isfloating && !lt->isfloating && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP)) |
|
| 1107 | 1104 | togglefloating(NULL); |
|
| 1108 | - | if((lt->isfloating) || c->isfloating) |
|
| 1105 | + | if(lt->isfloating || c->isfloating) { |
|
| 1106 | + | c->fx = nx; |
|
| 1107 | + | c->fy = ny; |
|
| 1109 | 1108 | resize(c, nx, ny, c->w, c->h, False); |
|
| 1109 | + | } |
|
| 1110 | 1110 | break; |
|
| 1111 | 1111 | } |
|
| 1112 | 1112 | } |
|
| 1261 | 1261 | XSync(dpy, False); |
|
| 1262 | 1262 | nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); |
|
| 1263 | 1263 | nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); |
|
| 1264 | - | if(!c->isfloating && !lt->isfloating && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) |
|
| 1264 | + | if(!c->isfloating && !lt->isfloating && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) { |
|
| 1265 | + | c->fx = c->x; |
|
| 1266 | + | c->fy = c->y; |
|
| 1265 | 1267 | togglefloating(NULL); |
|
| 1266 | - | if((lt->isfloating) || c->isfloating) |
|
| 1268 | + | } |
|
| 1269 | + | if((lt->isfloating) || c->isfloating) { |
|
| 1267 | 1270 | resize(c, c->x, c->y, nw, nh, True); |
|
| 1271 | + | c->fw = nw; |
|
| 1272 | + | c->fh = nh; |
|
| 1273 | + | } |
|
| 1268 | 1274 | break; |
|
| 1269 | 1275 | } |
|
| 1270 | 1276 | } |
|
| 1284 | 1290 | if(!lt->isfloating) { |
|
| 1285 | 1291 | wc.stack_mode = Below; |
|
| 1286 | 1292 | wc.sibling = barwin; |
|
| 1287 | - | if(!sel->isfloating) { |
|
| 1288 | - | XConfigureWindow(dpy, sel->win, CWSibling|CWStackMode, &wc); |
|
| 1289 | - | wc.sibling = sel->win; |
|
| 1290 | - | } |
|
| 1291 | - | for(c = nexttiled(clients); c; c = nexttiled(c->next)) { |
|
| 1292 | - | if(c == sel) |
|
| 1293 | - | continue; |
|
| 1294 | - | XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); |
|
| 1295 | - | wc.sibling = c->win; |
|
| 1296 | - | } |
|
| 1293 | + | for(c = stack; c; c = c->snext) |
|
| 1294 | + | if(!c->isfloating && isvisible(c)) { |
|
| 1295 | + | XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); |
|
| 1296 | + | wc.sibling = c->win; |
|
| 1297 | + | } |
|
| 1297 | 1298 | } |
|
| 1298 | 1299 | XSync(dpy, False); |
|
| 1299 | 1300 | while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
|
| 1841 | 1842 | memcpy(seltags, tmp, TAGSZ); |
|
| 1842 | 1843 | arrange(); |
|
| 1843 | 1844 | } |
|
| 1845 | + | else |
|
| 1846 | + | viewprevtag(NULL); |
|
| 1844 | 1847 | } |
|
| 1845 | 1848 | ||
| 1846 | 1849 | void |
|
| 1885 | 1888 | zoom(const char *arg) { |
|
| 1886 | 1889 | Client *c = sel; |
|
| 1887 | 1890 | ||
| 1888 | - | if(!sel || lt->isfloating || sel->isfloating) |
|
| 1889 | - | return; |
|
| 1890 | 1891 | if(c == nexttiled(clients)) |
|
| 1891 | - | if(!(c = nexttiled(c->next))) |
|
| 1892 | + | if(!c || !(c = nexttiled(c->next))) |
|
| 1892 | 1893 | return; |
|
| 1893 | - | detach(c); |
|
| 1894 | - | attach(c); |
|
| 1895 | - | focus(c); |
|
| 1894 | + | if(!lt->isfloating && !sel->isfloating) { |
|
| 1895 | + | detach(c); |
|
| 1896 | + | attach(c); |
|
| 1897 | + | focus(c); |
|
| 1898 | + | } |
|
| 1896 | 1899 | arrange(); |
|
| 1897 | 1900 | } |
|
| 1898 | 1901 | ||