diff options
| author | Anselm R Garbe <garbeam@gmail.com> | 2008-05-17 14:17:18 +0100 |
|---|---|---|
| committer | Anselm R Garbe <garbeam@gmail.com> | 2008-05-17 14:17:18 +0100 |
| commit | a785a0d71213c2ab628778727c4354ad5bb517fb (patch) | |
| tree | e8d72e6584245d37de3c04e1e8f3f7d6e387a0f8 /dwm.c | |
| parent | removed reapply() -- unnecessary (diff) | |
| download | dwm-a785a0d71213c2ab628778727c4354ad5bb517fb.tar.gz dwm-a785a0d71213c2ab628778727c4354ad5bb517fb.zip | |
removed Layout->isfloating
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 44 |
1 files changed, 17 insertions, 27 deletions
| @@ -60,7 +60,6 @@ typedef struct Client Client; | |||
| 60 | struct Client { | 60 | struct Client { |
| 61 | char name[256]; | 61 | char name[256]; |
| 62 | int x, y, w, h; | 62 | int x, y, w, h; |
| 63 | int fx, fy, fw, fh; | ||
| 64 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; | 63 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
| 65 | int minax, maxax, minay, maxay; | 64 | int minax, maxax, minay, maxay; |
| 66 | long flags; | 65 | long flags; |
| @@ -98,7 +97,6 @@ typedef struct { | |||
| 98 | typedef struct { | 97 | typedef struct { |
| 99 | const char *symbol; | 98 | const char *symbol; |
| 100 | void (*arrange)(void); | 99 | void (*arrange)(void); |
| 101 | Bool isfloating; | ||
| 102 | } Layout; | 100 | } Layout; |
| 103 | 101 | ||
| 104 | typedef struct { | 102 | typedef struct { |
| @@ -273,8 +271,8 @@ arrange(void) { | |||
| 273 | for(c = clients; c; c = c->next) | 271 | for(c = clients; c; c = c->next) |
| 274 | if(isvisible(c, NULL)) { | 272 | if(isvisible(c, NULL)) { |
| 275 | unban(c); | 273 | unban(c); |
| 276 | if(lt->isfloating || c->isfloating) | 274 | if(!lt->arrange || c->isfloating) |
| 277 | resize(c, c->fx, c->fy, c->fw, c->fh, True); | 275 | resize(c, c->x, c->y, c->w, c->h, True); |
| 278 | } | 276 | } |
| 279 | else | 277 | else |
| 280 | ban(c); | 278 | ban(c); |
| @@ -345,7 +343,7 @@ buttonpress(XEvent *e) { | |||
| 345 | movemouse(c); | 343 | movemouse(c); |
| 346 | } | 344 | } |
| 347 | else if(ev->button == Button2) { | 345 | else if(ev->button == Button2) { |
| 348 | if(!lt->isfloating && c->isfloating) | 346 | if(lt->arrange && c->isfloating) |
| 349 | togglefloating(NULL); | 347 | togglefloating(NULL); |
| 350 | else | 348 | else |
| 351 | zoom(NULL); | 349 | zoom(NULL); |
| @@ -435,7 +433,7 @@ configurerequest(XEvent *e) { | |||
| 435 | if((c = getclient(ev->window))) { | 433 | if((c = getclient(ev->window))) { |
| 436 | if(ev->value_mask & CWBorderWidth) | 434 | if(ev->value_mask & CWBorderWidth) |
| 437 | c->bw = ev->border_width; | 435 | c->bw = ev->border_width; |
| 438 | if(c->isfixed || c->isfloating || lt->isfloating) { | 436 | if(c->isfixed || c->isfloating || !lt->arrange) { |
| 439 | if(ev->value_mask & CWX) | 437 | if(ev->value_mask & CWX) |
| 440 | c->x = sx + ev->x; | 438 | c->x = sx + ev->x; |
| 441 | if(ev->value_mask & CWY) | 439 | if(ev->value_mask & CWY) |
| @@ -968,8 +966,8 @@ manage(Window w, XWindowAttributes *wa) { | |||
| 968 | /* geometry */ | 966 | /* geometry */ |
| 969 | c->x = wa->x; | 967 | c->x = wa->x; |
| 970 | c->y = wa->y; | 968 | c->y = wa->y; |
| 971 | c->w = c->fw = wa->width; | 969 | c->w = wa->width; |
| 972 | c->h = c->fh = wa->height; | 970 | c->h = wa->height; |
| 973 | c->oldbw = wa->border_width; | 971 | c->oldbw = wa->border_width; |
| 974 | if(c->w == sw && c->h == sh) { | 972 | if(c->w == sw && c->h == sh) { |
| 975 | c->x = sx; | 973 | c->x = sx; |
| @@ -985,8 +983,6 @@ manage(Window w, XWindowAttributes *wa) { | |||
| 985 | c->y = MAX(c->y, wy); | 983 | c->y = MAX(c->y, wy); |
| 986 | c->bw = BORDERPX; | 984 | c->bw = BORDERPX; |
| 987 | } | 985 | } |
| 988 | c->fx = c->x; | ||
| 989 | c->fy = c->y; | ||
| 990 | 986 | ||
| 991 | wc.border_width = c->bw; | 987 | wc.border_width = c->bw; |
| 992 | XConfigureWindow(dpy, w, CWBorderWidth, &wc); | 988 | XConfigureWindow(dpy, w, CWBorderWidth, &wc); |
| @@ -1040,7 +1036,7 @@ monocle(void) { | |||
| 1040 | Client *c; | 1036 | Client *c; |
| 1041 | 1037 | ||
| 1042 | for(c = clients; c; c = c->next) | 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 | resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, RESIZEHINTS); | 1040 | resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, RESIZEHINTS); |
| 1045 | } | 1041 | } |
| 1046 | 1042 | ||
| @@ -1080,13 +1076,10 @@ movemouse(Client *c) { | |||
| 1080 | ny = wy; | 1076 | ny = wy; |
| 1081 | else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < SNAP) | 1077 | else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < SNAP) |
| 1082 | ny = wy + wh - c->h - 2 * c->bw; | 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 | togglefloating(NULL); | 1080 | togglefloating(NULL); |
| 1085 | if(lt->isfloating || c->isfloating) { | 1081 | if(!lt->arrange || c->isfloating) |
| 1086 | c->fx = nx; | ||
| 1087 | c->fy = ny; | ||
| 1088 | resize(c, nx, ny, c->w, c->h, False); | 1082 | resize(c, nx, ny, c->w, c->h, False); |
| 1089 | } | ||
| 1090 | break; | 1083 | break; |
| 1091 | } | 1084 | } |
| 1092 | } | 1085 | } |
| @@ -1229,16 +1222,11 @@ resizemouse(Client *c) { | |||
| 1229 | XSync(dpy, False); | 1222 | XSync(dpy, False); |
| 1230 | nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); | 1223 | nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); |
| 1231 | nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); | 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)) { | 1225 | if(!c->isfloating && lt->arrange && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) { |
| 1233 | c->fx = c->x; | ||
| 1234 | c->fy = c->y; | ||
| 1235 | togglefloating(NULL); | 1226 | togglefloating(NULL); |
| 1236 | } | 1227 | } |
| 1237 | if((lt->isfloating) || c->isfloating) { | 1228 | if(!lt->arrange || c->isfloating) |
| 1238 | resize(c, c->x, c->y, nw, nh, True); | 1229 | resize(c, c->x, c->y, nw, nh, True); |
| 1239 | c->fw = nw; | ||
| 1240 | c->fh = nh; | ||
| 1241 | } | ||
| 1242 | break; | 1230 | break; |
| 1243 | } | 1231 | } |
| 1244 | } | 1232 | } |
| @@ -1253,9 +1241,9 @@ restack(void) { | |||
| 1253 | drawbar(); | 1241 | drawbar(); |
| 1254 | if(!sel) | 1242 | if(!sel) |
| 1255 | return; | 1243 | return; |
| 1256 | if(sel->isfloating || lt->isfloating) | 1244 | if(sel->isfloating || !lt->arrange) |
| 1257 | XRaiseWindow(dpy, sel->win); | 1245 | XRaiseWindow(dpy, sel->win); |
| 1258 | if(!lt->isfloating) { | 1246 | if(lt->arrange) { |
| 1259 | wc.stack_mode = Below; | 1247 | wc.stack_mode = Below; |
| 1260 | wc.sibling = barwin; | 1248 | wc.sibling = barwin; |
| 1261 | for(c = stack; c; c = c->snext) | 1249 | for(c = stack; c; c = c->snext) |
| @@ -1363,11 +1351,12 @@ setclientstate(Client *c, long state) { | |||
| 1363 | PropModeReplace, (unsigned char *)data, 2); | 1351 | PropModeReplace, (unsigned char *)data, 2); |
| 1364 | } | 1352 | } |
| 1365 | 1353 | ||
| 1354 | /* TODO: move this into tile.c */ | ||
| 1366 | void | 1355 | void |
| 1367 | setmfact(const char *arg) { | 1356 | setmfact(const char *arg) { |
| 1368 | double d; | 1357 | double d; |
| 1369 | 1358 | ||
| 1370 | if(lt->isfloating) | 1359 | if(!lt->arrange) /* TODO: check this against the actual tile() function */ |
| 1371 | return; | 1360 | return; |
| 1372 | if(!arg) | 1361 | if(!arg) |
| 1373 | mfact = MFACT; | 1362 | mfact = MFACT; |
| @@ -1842,6 +1831,7 @@ xerrorstart(Display *dpy, XErrorEvent *ee) { | |||
| 1842 | return -1; | 1831 | return -1; |
| 1843 | } | 1832 | } |
| 1844 | 1833 | ||
| 1834 | /* TODO: move this into tile.c */ | ||
| 1845 | void | 1835 | void |
| 1846 | zoom(const char *arg) { | 1836 | zoom(const char *arg) { |
| 1847 | Client *c = sel; | 1837 | Client *c = sel; |
| @@ -1849,7 +1839,7 @@ zoom(const char *arg) { | |||
| 1849 | if(c == nexttiled(clients)) | 1839 | if(c == nexttiled(clients)) |
| 1850 | if(!c || !(c = nexttiled(c->next))) | 1840 | if(!c || !(c = nexttiled(c->next))) |
| 1851 | return; | 1841 | return; |
| 1852 | if(!lt->isfloating && !sel->isfloating) { | 1842 | if(lt->arrange && !sel->isfloating) { /* TODO: check this against tile() */ |
| 1853 | detach(c); | 1843 | detach(c); |
| 1854 | attach(c); | 1844 | attach(c); |
| 1855 | focus(c); | 1845 | focus(c); |
