about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-04-17 14:56:46 +0200
committerAnselm R. Garbe <arg@suckless.org>2007-04-17 14:56:46 +0200
commit464fc2cd18e82e6b1c169a5a7ce19f923d08d4e3 (patch)
tree6062e2c5cfc2c67c3f282580ab0621e63937b41c
parentbe8d6d40f60b45f941bd9cb6896b83ce223b6406 (diff)
downloaddwm-464fc2cd18e82e6b1c169a5a7ce19f923d08d4e3.tar.gz
changed border handling
-rw-r--r--client.c9
-rw-r--r--event.c4
-rw-r--r--layout.c16
3 files changed, 11 insertions, 18 deletions
diff --git a/client.c b/client.c
index b7fde1a..caef85c 100644
--- a/client.c
+++ b/client.c
@@ -185,13 +185,12 @@ manage(Window w, XWindowAttributes *wa) {
 	c->y = wa->y;
 	c->w = wa->width;
 	c->h = wa->height;
+	c->border = wa->border_width;
 	if(c->w == sw && c->h == sh) {
-		c->border = 0;
 		c->x = sx;
 		c->y = sy;
 	}
 	else {
-		c->border = BORDERPX;
 		if(c->x + c->w + 2 * c->border > wax + waw)
 			c->x = wax + waw - c->w - 2 * c->border;
 		if(c->y + c->h + 2 * c->border > way + wah)
@@ -205,7 +204,7 @@ manage(Window w, XWindowAttributes *wa) {
 	XSelectInput(dpy, w,
 		StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
 	grabbuttons(c, False);
-	wc.border_width = c->border;
+	wc.border_width = BORDERPX;
 	XConfigureWindow(dpy, w, CWBorderWidth, &wc);
 	XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
 	configure(c); /* propagates border_width, if size doesn't change */
@@ -270,10 +269,6 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
 	}
 	if(w <= 0 || h <= 0)
 		return;
-	if(w == sw && h == sh)
-		c->border = 0;
-	else
-		c->border = BORDERPX;
 	/* offscreen appearance fixes */
 	if(x > sw)
 		x = sw - w - 2 * c->border;
diff --git a/event.c b/event.c
index 748987e..72e9ccd 100644
--- a/event.c
+++ b/event.c
@@ -191,10 +191,8 @@ configurerequest(XEvent *e) {
 			if(isvisible(c))
 				XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
 		}
-		else {
+		else
 			configure(c);
-		}
-		c->border = BORDERPX;
 	}
 	else {
 		wc.x = ev->x;
diff --git a/layout.c b/layout.c
index 5a32fd3..6eae290 100644
--- a/layout.c
+++ b/layout.c
@@ -38,18 +38,18 @@ tile(void) {
 			ny = way;
 			if(i < nmaster) {
 				ny += i * mh;
-				nw = mw - 2 * BORDERPX;
-				nh = mh - 2 * BORDERPX;
+				nw = mw - 2 * c->border;
+				nh = mh - 2 * c->border;
 			}
 			else {  /* tile window */
 				nx += mw;
-				nw = tw - 2 * BORDERPX;
-				if(th > 2 * BORDERPX) {
+				nw = tw - 2 * c->border;
+				if(th > 2 * c->border) {
 					ny += (i - nmaster) * th;
-					nh = th - 2 * BORDERPX;
+					nh = th - 2 * c->border;
 				}
-				else /* fallback if th <= 2 * BORDERPX */
-					nh = wah - 2 * BORDERPX;
+				else /* fallback if th <= 2 * c->border */
+					nh = wah - 2 * c->border;
 			}
 			resize(c, nx, ny, nw, nh, False);
 			i++;
@@ -125,7 +125,7 @@ incmasterw(const char *arg) {
 		masterw = MASTERWIDTH;
 	else {
 		i = atoi(arg);
-		if(waw * (masterw + i) / 1000 >= waw - 2 * BORDERPX
+		if(waw * (masterw + i) / 1000 >= waw - 2 * BORDERPX 
 		|| waw * (masterw + i) / 1000 <= 2 * BORDERPX)
 			return;
 		masterw += i;
> 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411