diff options
| author | arg@mmvi <unknown> | 2006-09-22 07:37:56 +0200 |
|---|---|---|
| committer | arg@mmvi <unknown> | 2006-09-22 07:37:56 +0200 |
| commit | d800ec05ff63451193a0b858c114f5144534c2a1 (patch) | |
| tree | cc6261bca4c022b6a22d0a1568bf3ea3ec4c9c06 | |
| parent | reviewed client.c (diff) | |
| download | dwm-d800ec05ff63451193a0b858c114f5144534c2a1.tar.gz dwm-d800ec05ff63451193a0b858c114f5144534c2a1.zip | |
implemented the maximization as I described on the mailinglist, this feels better to me.
Diffstat (limited to '')
| -rw-r--r-- | client.c | 41 | ||||
| -rw-r--r-- | config.arg.h | 1 | ||||
| -rw-r--r-- | config.default.h | 1 | ||||
| -rw-r--r-- | dwm.h | 4 | ||||
| -rw-r--r-- | event.c | 4 | ||||
| -rw-r--r-- | main.c | 1 | ||||
| -rw-r--r-- | view.c | 23 |
7 files changed, 25 insertions, 50 deletions
| @@ -89,8 +89,6 @@ focus(Client *c) { | |||
| 89 | if(!sel) | 89 | if(!sel) |
| 90 | sel = c; | 90 | sel = c; |
| 91 | else if(sel != c) { | 91 | else if(sel != c) { |
| 92 | if(maximized) | ||
| 93 | togglemax(NULL); | ||
| 94 | old = sel; | 92 | old = sel; |
| 95 | sel = c; | 93 | sel = c; |
| 96 | if(old) { | 94 | if(old) { |
| @@ -208,6 +206,10 @@ manage(Window w, XWindowAttributes *wa) { | |||
| 208 | c->w = c->tw = wa->width; | 206 | c->w = c->tw = wa->width; |
| 209 | c->h = wa->height; | 207 | c->h = wa->height; |
| 210 | c->th = bh; | 208 | c->th = bh; |
| 209 | c->rx = sx; | ||
| 210 | c->ry = bh; | ||
| 211 | c->rw = sw; | ||
| 212 | c->rh = sh - bh; | ||
| 211 | 213 | ||
| 212 | c->border = 0; | 214 | c->border = 0; |
| 213 | updatesize(c); | 215 | updatesize(c); |
| @@ -370,41 +372,6 @@ updatetitle(Client *c) { | |||
| 370 | } | 372 | } |
| 371 | 373 | ||
| 372 | void | 374 | void |
| 373 | togglemax(Arg *arg) { | ||
| 374 | int ox, oy, ow, oh; | ||
| 375 | Client *c; | ||
| 376 | XEvent ev; | ||
| 377 | |||
| 378 | if(!sel) | ||
| 379 | return; | ||
| 380 | |||
| 381 | if((maximized = !maximized)) { | ||
| 382 | ox = sel->x; | ||
| 383 | oy = sel->y; | ||
| 384 | ow = sel->w; | ||
| 385 | oh = sel->h; | ||
| 386 | sel->x = sx; | ||
| 387 | sel->y = sy + bh; | ||
| 388 | sel->w = sw - 2; | ||
| 389 | sel->h = sh - 2 - bh; | ||
| 390 | |||
| 391 | restack(); | ||
| 392 | for(c = getnext(clients); c; c = getnext(c->next)) | ||
| 393 | if(c != sel) | ||
| 394 | ban(c); | ||
| 395 | resize(sel, arrange == dofloat, TopLeft); | ||
| 396 | |||
| 397 | sel->x = ox; | ||
| 398 | sel->y = oy; | ||
| 399 | sel->w = ow; | ||
| 400 | sel->h = oh; | ||
| 401 | } | ||
| 402 | else | ||
| 403 | arrange(NULL); | ||
| 404 | while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | ||
| 405 | } | ||
| 406 | |||
| 407 | void | ||
| 408 | unmanage(Client *c) { | 375 | unmanage(Client *c) { |
| 409 | Client *nc; | 376 | Client *nc; |
| 410 | 377 | ||
diff --git a/config.arg.h b/config.arg.h index 9bb581e..6f9aed2 100644 --- a/config.arg.h +++ b/config.arg.h | |||
| @@ -33,7 +33,6 @@ static Key key[] = { \ | |||
| 33 | { MODKEY, XK_j, focusnext, { 0 } }, \ | 33 | { MODKEY, XK_j, focusnext, { 0 } }, \ |
| 34 | { MODKEY, XK_k, focusprev, { 0 } }, \ | 34 | { MODKEY, XK_k, focusprev, { 0 } }, \ |
| 35 | { MODKEY, XK_Return, zoom, { 0 } }, \ | 35 | { MODKEY, XK_Return, zoom, { 0 } }, \ |
| 36 | { MODKEY, XK_m, togglemax, { 0 } }, \ | ||
| 37 | { MODKEY, XK_g, resizecol, { .i = 20 } }, \ | 36 | { MODKEY, XK_g, resizecol, { .i = 20 } }, \ |
| 38 | { MODKEY, XK_s, resizecol, { .i = -20 } }, \ | 37 | { MODKEY, XK_s, resizecol, { .i = -20 } }, \ |
| 39 | { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \ | 38 | { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \ |
diff --git a/config.default.h b/config.default.h index ad048ae..9c67d98 100644 --- a/config.default.h +++ b/config.default.h | |||
| @@ -28,7 +28,6 @@ static Key key[] = { \ | |||
| 28 | { MODKEY, XK_Tab, focusnext, { 0 } }, \ | 28 | { MODKEY, XK_Tab, focusnext, { 0 } }, \ |
| 29 | { MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \ | 29 | { MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \ |
| 30 | { MODKEY, XK_Return, zoom, { 0 } }, \ | 30 | { MODKEY, XK_Return, zoom, { 0 } }, \ |
| 31 | { MODKEY, XK_m, togglemax, { 0 } }, \ | ||
| 32 | { MODKEY, XK_g, resizecol, { .i = 20 } }, \ | 31 | { MODKEY, XK_g, resizecol, { .i = 20 } }, \ |
| 33 | { MODKEY, XK_s, resizecol, { .i = -20 } }, \ | 32 | { MODKEY, XK_s, resizecol, { .i = -20 } }, \ |
| 34 | { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \ | 33 | { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \ |
| @@ -78,6 +78,7 @@ struct Client { | |||
| 78 | int proto; | 78 | int proto; |
| 79 | int x, y, w, h; | 79 | int x, y, w, h; |
| 80 | int tx, ty, tw, th; /* title window geometry */ | 80 | int tx, ty, tw, th; /* title window geometry */ |
| 81 | int rx, ry, rw, rh; /* revert geometry */ | ||
| 81 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; | 82 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
| 82 | int grav; | 83 | int grav; |
| 83 | long flags; | 84 | long flags; |
| @@ -99,7 +100,7 @@ extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */ | |||
| 99 | extern void (*handler[LASTEvent])(XEvent *); /* event handler */ | 100 | extern void (*handler[LASTEvent])(XEvent *); /* event handler */ |
| 100 | extern void (*arrange)(Arg *); /* arrange function, indicates mode */ | 101 | extern void (*arrange)(Arg *); /* arrange function, indicates mode */ |
| 101 | extern Atom wmatom[WMLast], netatom[NetLast]; | 102 | extern Atom wmatom[WMLast], netatom[NetLast]; |
| 102 | extern Bool running, issel, maximized, *seltag; /* seltag is array of Bool */ | 103 | extern Bool running, issel, *seltag; /* seltag is array of Bool */ |
| 103 | extern Client *clients, *sel, *stack; /* global cleint list and stack */ | 104 | extern Client *clients, *sel, *stack; /* global cleint list and stack */ |
| 104 | extern Cursor cursor[CurLast]; | 105 | extern Cursor cursor[CurLast]; |
| 105 | extern DC dc; /* global draw context */ | 106 | extern DC dc; /* global draw context */ |
| @@ -117,7 +118,6 @@ extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ | |||
| 117 | extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/ | 118 | extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/ |
| 118 | extern void updatesize(Client *c); /* update the size structs of c */ | 119 | extern void updatesize(Client *c); /* update the size structs of c */ |
| 119 | extern void updatetitle(Client *c); /* update the name of c */ | 120 | extern void updatetitle(Client *c); /* update the name of c */ |
| 120 | extern void togglemax(Arg *arg); /* (un)maximize c */ | ||
| 121 | extern void unmanage(Client *c); /* destroy c */ | 121 | extern void unmanage(Client *c); /* destroy c */ |
| 122 | 122 | ||
| 123 | /* draw.c */ | 123 | /* draw.c */ |
| @@ -130,7 +130,7 @@ buttonpress(XEvent *e) { | |||
| 130 | } | 130 | } |
| 131 | else if((c = getclient(ev->window))) { | 131 | else if((c = getclient(ev->window))) { |
| 132 | focus(c); | 132 | focus(c); |
| 133 | if(maximized || CLEANMASK(ev->state) != MODKEY) | 133 | if(CLEANMASK(ev->state) != MODKEY) |
| 134 | return; | 134 | return; |
| 135 | if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) { | 135 | if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) { |
| 136 | restack(c); | 136 | restack(c); |
| @@ -170,7 +170,7 @@ configurerequest(XEvent *e) { | |||
| 170 | XWindowChanges wc; | 170 | XWindowChanges wc; |
| 171 | 171 | ||
| 172 | if((c = getclient(ev->window))) { | 172 | if((c = getclient(ev->window))) { |
| 173 | if((c == sel) && !c->isfloat && (arrange != dofloat) && maximized) { | 173 | if((c == sel) && !c->isfloat && (arrange != dofloat)) { |
| 174 | synconfig(c, sx, sy + bh, sw - 2, sh - 2 - bh, ev->border_width); | 174 | synconfig(c, sx, sy + bh, sw - 2, sh - 2 - bh, ev->border_width); |
| 175 | XSync(dpy, False); | 175 | XSync(dpy, False); |
| 176 | return; | 176 | return; |
| @@ -24,7 +24,6 @@ unsigned int ntags, numlockmask; | |||
| 24 | Atom wmatom[WMLast], netatom[NetLast]; | 24 | Atom wmatom[WMLast], netatom[NetLast]; |
| 25 | Bool running = True; | 25 | Bool running = True; |
| 26 | Bool issel = True; | 26 | Bool issel = True; |
| 27 | Bool maximized = False; | ||
| 28 | Client *clients = NULL; | 27 | Client *clients = NULL; |
| 29 | Client *sel = NULL; | 28 | Client *sel = NULL; |
| 30 | Client *stack = NULL; | 29 | Client *stack = NULL; |
| @@ -61,8 +61,6 @@ void | |||
| 61 | dofloat(Arg *arg) { | 61 | dofloat(Arg *arg) { |
| 62 | Client *c; | 62 | Client *c; |
| 63 | 63 | ||
| 64 | maximized = False; | ||
| 65 | |||
| 66 | for(c = clients; c; c = c->next) { | 64 | for(c = clients; c; c = c->next) { |
| 67 | if(isvisible(c)) { | 65 | if(isvisible(c)) { |
| 68 | resize(c, True, TopLeft); | 66 | resize(c, True, TopLeft); |
| @@ -82,8 +80,6 @@ dotile(Arg *arg) { | |||
| 82 | int h, i, n, w; | 80 | int h, i, n, w; |
| 83 | Client *c; | 81 | Client *c; |
| 84 | 82 | ||
| 85 | maximized = False; | ||
| 86 | |||
| 87 | w = sw - mw; | 83 | w = sw - mw; |
| 88 | for(n = 0, c = clients; c; c = c->next) | 84 | for(n = 0, c = clients; c; c = c->next) |
| 89 | if(isvisible(c) && !c->isfloat) | 85 | if(isvisible(c) && !c->isfloat) |
| @@ -190,7 +186,7 @@ resizecol(Arg *arg) { | |||
| 190 | for(n = 0, c = clients; c; c = c->next) | 186 | for(n = 0, c = clients; c; c = c->next) |
| 191 | if(isvisible(c) && !c->isfloat) | 187 | if(isvisible(c) && !c->isfloat) |
| 192 | n++; | 188 | n++; |
| 193 | if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized) | 189 | if(!sel || sel->isfloat || n < 2 || (arrange != dotile)) |
| 194 | return; | 190 | return; |
| 195 | 191 | ||
| 196 | if(sel == getnext(clients)) { | 192 | if(sel == getnext(clients)) { |
| @@ -273,13 +269,28 @@ viewall(Arg *arg) { | |||
| 273 | 269 | ||
| 274 | void | 270 | void |
| 275 | zoom(Arg *arg) { | 271 | zoom(Arg *arg) { |
| 272 | int tmp; | ||
| 276 | unsigned int n; | 273 | unsigned int n; |
| 277 | Client *c; | 274 | Client *c; |
| 275 | XEvent ev; | ||
| 276 | |||
| 277 | if(!sel) | ||
| 278 | return; | ||
| 279 | |||
| 280 | if(sel->isfloat || (arrange == dofloat)) { | ||
| 281 | tmp = sel->x; sel->x = sel->rx; sel->rx = tmp; | ||
| 282 | tmp = sel->y; sel->y = sel->ry; sel->ry = tmp; | ||
| 283 | tmp = sel->w; sel->w = sel->rw; sel->rw = tmp; | ||
| 284 | tmp = sel->h; sel->h = sel->rh; sel->rh = tmp; | ||
| 285 | resize(sel, True, TopLeft); | ||
| 286 | while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | ||
| 287 | return; | ||
| 288 | } | ||
| 278 | 289 | ||
| 279 | for(n = 0, c = clients; c; c = c->next) | 290 | for(n = 0, c = clients; c; c = c->next) |
| 280 | if(isvisible(c) && !c->isfloat) | 291 | if(isvisible(c) && !c->isfloat) |
| 281 | n++; | 292 | n++; |
| 282 | if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized) | 293 | if(n < 2 || (arrange != dotile)) |
| 283 | return; | 294 | return; |
| 284 | 295 | ||
| 285 | if((c = sel) == nexttiled(clients)) | 296 | if((c = sel) == nexttiled(clients)) |
