simplified Mod-m 5f19423c
Anselm R. Garbe · 2007-12-09 13:39 3 file(s) · +12 −38
config.def.h +1 −1
46 46
	{ MODKEY,			XK_k,		focusprev,	NULL },
47 47
	{ MODKEY,			XK_h,		setmwfact,	"-0.05" },
48 48
	{ MODKEY,			XK_l,		setmwfact,	"+0.05" },
49 -
	{ MODKEY,			XK_m,		togglemax,	NULL },
49 +
	{ MODKEY,			XK_m,		maximize,	NULL },
50 50
	{ MODKEY,			XK_r,		reapply,	NULL },
51 51
	{ MODKEY,			XK_Return,	zoom,		NULL },
52 52
	{ MODKEY,			XK_Tab,		viewprevtag,	NULL },
dwm.1 +1 −1
78 78
Increases the master area width about 5% (tiled layout only).
79 79
.TP
80 80
.B Mod1\-m
81 -
Toggles maximization of current window.
81 +
Maximizes current window (floating layout/window only).
82 82
.TP
83 83
.B Mod1\-r
84 84
Re-applies tagging rules to all windows.
dwm.c +10 −36
61 61
struct Client {
62 62
	char name[256];
63 63
	int x, y, w, h;
64 -
	int rx, ry, rw, rh; /* revert geometry */
65 64
	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
66 65
	int minax, maxax, minay, maxay;
67 66
	long flags;
68 67
	unsigned int border, oldborder;
69 -
	Bool isbanned, isfixed, ismax, isfloating, wasfloating;
68 +
	Bool isbanned, isfixed, isfloating;
70 69
	Bool *tags;
71 70
	Client *next;
72 71
	Client *prev;
157 156
void manage(Window w, XWindowAttributes *wa);
158 157
void mappingnotify(XEvent *e);
159 158
void maprequest(XEvent *e);
159 +
void maximize(const char *arg);
160 160
void movemouse(Client *c);
161 161
Client *nexttiled(Client *c);
162 162
void propertynotify(XEvent *e);
178 178
void tile(void);
179 179
void togglebar(const char *arg);
180 180
void togglefloating(const char *arg);
181 -
void togglemax(const char *arg);
182 181
void toggletag(const char *arg);
183 182
void toggleview(const char *arg);
184 183
void unban(Client *c);
466 465
	XWindowChanges wc;
467 466
468 467
	if((c = getclient(ev->window))) {
469 -
		c->ismax = False;
470 468
		if(ev->value_mask & CWBorderWidth)
471 469
			c->border = ev->border_width;
472 470
		if(c->isfixed || c->isfloating || (floating == layout->arrange)) {
563 561
		dc.x = x;
564 562
		if(sel) {
565 563
			drawtext(sel->name, dc.sel);
566 -
			drawsquare(sel->ismax, sel->isfloating, dc.sel);
564 +
			drawsquare(False, sel->isfloating, dc.sel);
567 565
		}
568 566
		else
569 567
			drawtext(NULL, dc.norm);
1079 1077
}
1080 1078
1081 1079
void
1080 +
maximize(const char *arg) {
1081 +
	if(!sel || (!sel->isfloating && layout->arrange != floating))
1082 +
		return;
1083 +
	resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
1084 +
}
1085 +
1086 +
void
1082 1087
movemouse(Client *c) {
1083 1088
	int x1, y1, ocx, ocy, di, nx, ny;
1084 1089
	unsigned int dui;
1090 1095
	if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
1091 1096
			None, cursor[CurMove], CurrentTime) != GrabSuccess)
1092 1097
		return;
1093 -
	c->ismax = False;
1094 1098
	XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
1095 1099
	for(;;) {
1096 1100
		XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask, &ev);
1248 1252
	if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
1249 1253
			None, cursor[CurResize], CurrentTime) != GrabSuccess)
1250 1254
		return;
1251 -
	c->ismax = False;
1252 1255
	XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h + c->border - 1);
1253 1256
	for(;;) {
1254 1257
		XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask , &ev);
1609 1612
	ny = way;
1610 1613
	nw = 0; /* gcc stupidity requires this */
1611 1614
	for(i = 0, c = mc = nexttiled(clients); c; c = nexttiled(c->next), i++) {
1612 -
		c->ismax = False;
1613 1615
		if(i == 0) { /* master */
1614 1616
			nw = mw - 2 * c->border;
1615 1617
			nh = wah - 2 * c->border;
1652 1654
	if(sel->isfloating)
1653 1655
		resize(sel, sel->x, sel->y, sel->w, sel->h, True);
1654 1656
	arrange();
1655 -
}
1656 -
1657 -
void
1658 -
togglemax(const char *arg) {
1659 -
	XEvent ev;
1660 -
1661 -
	if(!sel || sel->isfixed)
1662 -
		return;
1663 -
	if((sel->ismax = !sel->ismax)) {
1664 -
		if((layout->arrange == floating) || sel->isfloating)
1665 -
			sel->wasfloating = True;
1666 -
		else {
1667 -
			togglefloating(NULL);
1668 -
			sel->wasfloating = False;
1669 -
		}
1670 -
		sel->rx = sel->x;
1671 -
		sel->ry = sel->y;
1672 -
		sel->rw = sel->w;
1673 -
		sel->rh = sel->h;
1674 -
		resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
1675 -
	}
1676 -
	else {
1677 -
		resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
1678 -
		if(!sel->wasfloating)
1679 -
			togglefloating(NULL);
1680 -
	}
1681 -
	drawbar();
1682 -
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
1683 1657
}
1684 1658
1685 1659
void