fixed usage of sx, sy, sw, sh 9cde6570
Anselm R Garbe · 2009-06-30 20:15 1 file(s) · +13 −14
dwm.c +13 −14
124 124
	int screen_number;
125 125
	float mfact;
126 126
	int by, btx;          /* bar geometry */
127 -
	int mx, my, mw, mh;           /* screen size */
127 +
	int mx, my, mw, mh;   /* screen size */
128 128
	int wx, wy, ww, wh;   /* window area  */
129 129
	unsigned int seltags;
130 130
	unsigned int sellt;
239 239
/* variables */
240 240
static char stext[256];
241 241
static int screen;
242 -
static int sx, sy, sw, sh;   /* X display screen geometry x, y, width, height */
242 +
static int sw, sh;   /* X display screen geometry x, y, width, height */
243 243
static int bh, blw = 0;      /* bar geometry */
244 244
static int (*xerrorxlib)(Display *, XErrorEvent *);
245 245
static unsigned int numlockmask = 0;
302 302
Bool
303 303
applysizehints(Client *c, int *x, int *y, int *w, int *h) {
304 304
	Bool baseismin;
305 +
	Monitor *m = c->mon;
305 306
306 307
	/* set minimum possible */
307 308
	*w = MAX(1, *w);
308 309
	*h = MAX(1, *h);
309 310
310 -
	if(*x > sx + sw)
311 -
		*x = sw - WIDTH(c);
312 -
	if(*y > sy + sh)
313 -
		*y = sh - HEIGHT(c);
314 -
	if(*x + *w + 2 * c->bw < sx)
315 -
		*x = sx;
316 -
	if(*y + *h + 2 * c->bw < sy)
317 -
		*y = sy;
311 +
	if(*x > m->mx + m->mw)
312 +
		*x = m->mw - WIDTH(c);
313 +
	if(*y > m->my + m->mh)
314 +
		*y = m->mh - HEIGHT(c);
315 +
	if(*x + *w + 2 * c->bw < m->mx)
316 +
		*x = m->mx;
317 +
	if(*y + *h + 2 * c->bw < m->my)
318 +
		*y = m->my;
318 319
	if(*h < bh)
319 320
		*h = bh;
320 321
	if(*w < bh)
1429 1430
	screen = DefaultScreen(dpy);
1430 1431
	root = RootWindow(dpy, screen);
1431 1432
	initfont(font);
1432 -
	sx = 0;
1433 -
	sy = 0;
1434 1433
	sw = DisplayWidth(dpy, screen);
1435 1434
	sh = DisplayHeight(dpy, screen);
1436 1435
	bh = dc.h = dc.font.height + 2;
1735 1734
	/* default monitor setup */
1736 1735
	{
1737 1736
		m->screen_number = 0;
1738 -
		m->wx = sx;
1739 -
		m->my = m->wy = sy;
1737 +
		m->wx = 0;
1738 +
		m->my = m->wy = 0;
1740 1739
		m->ww = sw;
1741 1740
		m->mh = m->wh = sh;
1742 1741
	}