applied some necessary changes ca3e847e
Anselm R Garbe · 2008-02-20 08:09 1 file(s) · +8 −9
dwm.c +8 −9
117 117
} Regs;
118 118
119 119
typedef struct {
120 -
	int monitor;
121 120
	Window barwin;
122 121
	int sx, sy, sw, sh, wax, way, wah, waw;
123 122
	Bool *seltags;
1164 1163
movemouse(Client *c) {
1165 1164
	int x1, y1, ocx, ocy, di, nx, ny;
1166 1165
	unsigned int dui;
1166 +
	Monitor *m;
1167 1167
	Window dummy;
1168 1168
	XEvent ev;
1169 1169
1170 1170
	ocx = nx = c->x;
1171 1171
	ocy = ny = c->y;
1172 +
	m = &monitors[c->monitor];
1172 1173
	if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
1173 1174
			None, cursor[CurMove], CurrentTime) != GrabSuccess)
1174 1175
		return;
1188 1189
			XSync(dpy, False);
1189 1190
			nx = ocx + (ev.xmotion.x - x1);
1190 1191
			ny = ocy + (ev.xmotion.y - y1);
1191 -
			Monitor *m = &monitors[monitorat()];
1192 1192
			if(abs(m->wax - nx) < SNAP)
1193 1193
				nx = m->wax;
1194 1194
			else if(abs((m->wax + m->waw) - (nx + c->w + 2 * c->border)) < SNAP)
1197 1197
				ny = m->way;
1198 1198
			else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP)
1199 1199
				ny = m->way + m->wah - c->h - 2 * c->border;
1200 -
			if((monitors[selmonitor].layout->arrange != floating) && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP))
1200 +
			if((m->layout->arrange != floating) && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP))
1201 1201
				togglefloating(NULL);
1202 -
			if((monitors[selmonitor].layout->arrange == floating) || c->isfloating)
1202 +
			if((m->layout->arrange == floating) || c->isfloating)
1203 1203
				resize(c, nx, ny, c->w, c->h, False);
1204 -
			memcpy(c->tags, monitors[monitorat()].seltags, sizeof initags);
1205 1204
			break;
1206 1205
		}
1207 1206
	}
1335 1334
resizemouse(Client *c) {
1336 1335
	int ocx, ocy;
1337 1336
	int nw, nh;
1337 +
	Monitor *m;
1338 1338
	XEvent ev;
1339 1339
1340 1340
	ocx = c->x;
1341 1341
	ocy = c->y;
1342 +
	m = &monitors[c->monitor];
1342 1343
	if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
1343 1344
			None, cursor[CurResize], CurrentTime) != GrabSuccess)
1344 1345
		return;
1363 1364
				nw = 1;
1364 1365
			if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0)
1365 1366
				nh = 1;
1366 -
			if((monitors[selmonitor].layout->arrange != floating) && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP))
1367 +
			if((m->layout->arrange != floating) && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP))
1367 1368
				togglefloating(NULL);
1368 -
			if((monitors[selmonitor].layout->arrange == floating) || c->isfloating)
1369 +
			if((m->layout->arrange == floating) || c->isfloating)
1369 1370
				resize(c, c->x, c->y, nw, nh, True);
1370 1371
			break;
1371 1372
		}
1599 1600
	for(i = 0; i < mcount; i++) {
1600 1601
		/* init geometry */
1601 1602
		m = &monitors[i];
1602 -
1603 -
		m->monitor = i;
1604 1603
1605 1604
		if (mcount != 1 && isxinerama) {
1606 1605
			m->sx = info[i].x_org;