removed Layout->isfloating
a785a0d7
2 file(s) · +21 −31
| 24 | 24 | #define SNAP 32 /* snap pixel */ |
|
| 25 | 25 | ||
| 26 | 26 | Layout layouts[] = { |
|
| 27 | - | /* symbol function isfloating */ |
|
| 28 | - | { "[]=", tilev, False }, /* first entry is default */ |
|
| 29 | - | { "><>", NULL, True }, |
|
| 30 | - | { "<M>", monocle, True }, |
|
| 27 | + | /* symbol function */ |
|
| 28 | + | { "[]=", tilev }, /* first entry is default */ |
|
| 29 | + | { "><>", NULL }, /* no layout function means floating behavior */ |
|
| 30 | + | { "<M>", monocle }, /* TODO: remove this */ |
|
| 31 | 31 | }; |
|
| 32 | 32 | ||
| 33 | 33 | /* key definitions */ |
| 60 | 60 | struct Client { |
|
| 61 | 61 | char name[256]; |
|
| 62 | 62 | int x, y, w, h; |
|
| 63 | - | int fx, fy, fw, fh; |
|
| 64 | 63 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
|
| 65 | 64 | int minax, maxax, minay, maxay; |
|
| 66 | 65 | long flags; |
|
| 98 | 97 | typedef struct { |
|
| 99 | 98 | const char *symbol; |
|
| 100 | 99 | void (*arrange)(void); |
|
| 101 | - | Bool isfloating; |
|
| 102 | 100 | } Layout; |
|
| 103 | 101 | ||
| 104 | 102 | typedef struct { |
|
| 273 | 271 | for(c = clients; c; c = c->next) |
|
| 274 | 272 | if(isvisible(c, NULL)) { |
|
| 275 | 273 | unban(c); |
|
| 276 | - | if(lt->isfloating || c->isfloating) |
|
| 277 | - | resize(c, c->fx, c->fy, c->fw, c->fh, True); |
|
| 274 | + | if(!lt->arrange || c->isfloating) |
|
| 275 | + | resize(c, c->x, c->y, c->w, c->h, True); |
|
| 278 | 276 | } |
|
| 279 | 277 | else |
|
| 280 | 278 | ban(c); |
|
| 345 | 343 | movemouse(c); |
|
| 346 | 344 | } |
|
| 347 | 345 | else if(ev->button == Button2) { |
|
| 348 | - | if(!lt->isfloating && c->isfloating) |
|
| 346 | + | if(lt->arrange && c->isfloating) |
|
| 349 | 347 | togglefloating(NULL); |
|
| 350 | 348 | else |
|
| 351 | 349 | zoom(NULL); |
|
| 435 | 433 | if((c = getclient(ev->window))) { |
|
| 436 | 434 | if(ev->value_mask & CWBorderWidth) |
|
| 437 | 435 | c->bw = ev->border_width; |
|
| 438 | - | if(c->isfixed || c->isfloating || lt->isfloating) { |
|
| 436 | + | if(c->isfixed || c->isfloating || !lt->arrange) { |
|
| 439 | 437 | if(ev->value_mask & CWX) |
|
| 440 | 438 | c->x = sx + ev->x; |
|
| 441 | 439 | if(ev->value_mask & CWY) |
|
| 968 | 966 | /* geometry */ |
|
| 969 | 967 | c->x = wa->x; |
|
| 970 | 968 | c->y = wa->y; |
|
| 971 | - | c->w = c->fw = wa->width; |
|
| 972 | - | c->h = c->fh = wa->height; |
|
| 969 | + | c->w = wa->width; |
|
| 970 | + | c->h = wa->height; |
|
| 973 | 971 | c->oldbw = wa->border_width; |
|
| 974 | 972 | if(c->w == sw && c->h == sh) { |
|
| 975 | 973 | c->x = sx; |
|
| 985 | 983 | c->y = MAX(c->y, wy); |
|
| 986 | 984 | c->bw = BORDERPX; |
|
| 987 | 985 | } |
|
| 988 | - | c->fx = c->x; |
|
| 989 | - | c->fy = c->y; |
|
| 990 | 986 | ||
| 991 | 987 | wc.border_width = c->bw; |
|
| 992 | 988 | XConfigureWindow(dpy, w, CWBorderWidth, &wc); |
|
| 1040 | 1036 | Client *c; |
|
| 1041 | 1037 | ||
| 1042 | 1038 | for(c = clients; c; c = c->next) |
|
| 1043 | - | if((lt->isfloating || !c->isfloating) && isvisible(c, NULL)) |
|
| 1039 | + | if(!c->isfloating && isvisible(c, NULL)) |
|
| 1044 | 1040 | resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, RESIZEHINTS); |
|
| 1045 | 1041 | } |
|
| 1046 | 1042 | ||
| 1080 | 1076 | ny = wy; |
|
| 1081 | 1077 | else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < SNAP) |
|
| 1082 | 1078 | ny = wy + wh - c->h - 2 * c->bw; |
|
| 1083 | - | if(!c->isfloating && !lt->isfloating && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP)) |
|
| 1079 | + | if(!c->isfloating && lt->arrange && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP)) |
|
| 1084 | 1080 | togglefloating(NULL); |
|
| 1085 | - | if(lt->isfloating || c->isfloating) { |
|
| 1086 | - | c->fx = nx; |
|
| 1087 | - | c->fy = ny; |
|
| 1081 | + | if(!lt->arrange || c->isfloating) |
|
| 1088 | 1082 | resize(c, nx, ny, c->w, c->h, False); |
|
| 1089 | - | } |
|
| 1090 | 1083 | break; |
|
| 1091 | 1084 | } |
|
| 1092 | 1085 | } |
|
| 1229 | 1222 | XSync(dpy, False); |
|
| 1230 | 1223 | nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); |
|
| 1231 | 1224 | nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); |
|
| 1232 | - | if(!c->isfloating && !lt->isfloating && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) { |
|
| 1233 | - | c->fx = c->x; |
|
| 1234 | - | c->fy = c->y; |
|
| 1225 | + | if(!c->isfloating && lt->arrange && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) { |
|
| 1235 | 1226 | togglefloating(NULL); |
|
| 1236 | 1227 | } |
|
| 1237 | - | if((lt->isfloating) || c->isfloating) { |
|
| 1228 | + | if(!lt->arrange || c->isfloating) |
|
| 1238 | 1229 | resize(c, c->x, c->y, nw, nh, True); |
|
| 1239 | - | c->fw = nw; |
|
| 1240 | - | c->fh = nh; |
|
| 1241 | - | } |
|
| 1242 | 1230 | break; |
|
| 1243 | 1231 | } |
|
| 1244 | 1232 | } |
|
| 1253 | 1241 | drawbar(); |
|
| 1254 | 1242 | if(!sel) |
|
| 1255 | 1243 | return; |
|
| 1256 | - | if(sel->isfloating || lt->isfloating) |
|
| 1244 | + | if(sel->isfloating || !lt->arrange) |
|
| 1257 | 1245 | XRaiseWindow(dpy, sel->win); |
|
| 1258 | - | if(!lt->isfloating) { |
|
| 1246 | + | if(lt->arrange) { |
|
| 1259 | 1247 | wc.stack_mode = Below; |
|
| 1260 | 1248 | wc.sibling = barwin; |
|
| 1261 | 1249 | for(c = stack; c; c = c->snext) |
|
| 1363 | 1351 | PropModeReplace, (unsigned char *)data, 2); |
|
| 1364 | 1352 | } |
|
| 1365 | 1353 | ||
| 1354 | + | /* TODO: move this into tile.c */ |
|
| 1366 | 1355 | void |
|
| 1367 | 1356 | setmfact(const char *arg) { |
|
| 1368 | 1357 | double d; |
|
| 1369 | 1358 | ||
| 1370 | - | if(lt->isfloating) |
|
| 1359 | + | if(!lt->arrange) /* TODO: check this against the actual tile() function */ |
|
| 1371 | 1360 | return; |
|
| 1372 | 1361 | if(!arg) |
|
| 1373 | 1362 | mfact = MFACT; |
|
| 1842 | 1831 | return -1; |
|
| 1843 | 1832 | } |
|
| 1844 | 1833 | ||
| 1834 | + | /* TODO: move this into tile.c */ |
|
| 1845 | 1835 | void |
|
| 1846 | 1836 | zoom(const char *arg) { |
|
| 1847 | 1837 | Client *c = sel; |
|
| 1849 | 1839 | if(c == nexttiled(clients)) |
|
| 1850 | 1840 | if(!c || !(c = nexttiled(c->next))) |
|
| 1851 | 1841 | return; |
|
| 1852 | - | if(!lt->isfloating && !sel->isfloating) { |
|
| 1842 | + | if(lt->arrange && !sel->isfloating) { /* TODO: check this against tile() */ |
|
| 1853 | 1843 | detach(c); |
|
| 1854 | 1844 | attach(c); |
|
| 1855 | 1845 | focus(c); |
|