about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-05-19 15:05:46 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-05-19 15:05:46 +0100
commitf22d047d4139ef889e95aabd0103e11357193e5a (patch)
tree2dbb4fd896339ff199b06095eaf524bf3dba9b1d
parent4a5c8d84dbf410b8b9aa4dc81954568f10ca104f (diff)
downloaddwm-f22d047d4139ef889e95aabd0103e11357193e5a.tar.gz
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
-rw-r--r--config.mk11
-rw-r--r--dwm.13
-rw-r--r--dwm.c39
3 files changed, 37 insertions, 16 deletions
diff --git a/config.mk b/config.mk
index b18ad33..e9c956e 100644
--- a/config.mk
+++ b/config.mk
@@ -10,14 +10,19 @@ MANPREFIX = ${PREFIX}/share/man
 X11INC = /usr/X11R6/include
 X11LIB = /usr/X11R6/lib
 
+# Xinerama, uncomment if you don't want it
+XINERAMALIBS = -L${X11LIB} -lXinerama
+XINERAMAFLAGS = -DXINERAMA
+
 # includes and libs
 INCS = -I. -I/usr/include -I${X11INC}
-LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
+LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${XINERAMALIBS}
 
 # flags
-CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
+CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
+CFLAGS = -Os ${INCS} ${CPPFLAGS}
 LDFLAGS = -s ${LIBS}
-#CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
+#CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} ${CPPFLAGS}
 #LDFLAGS = -g ${LIBS}
 
 # Solaris
diff --git a/dwm.1 b/dwm.1
index 3b8bf1d..66e89ee 100644
--- a/dwm.1
+++ b/dwm.1
@@ -57,6 +57,9 @@ click on a tag label adds/removes that tag to/from the focused window.
 Start
 .BR xterm.
 .TP
+.B Mod1\-b
+Toggles bar on and off.
+.TP
 .B Mod1\-space
 Toggles between layouts.
 .TP
diff --git a/dwm.c b/dwm.c
index 504b78b..4a8c2a9 100644
--- a/dwm.c
+++ b/dwm.c
@@ -39,6 +39,9 @@
 #include <X11/Xlib.h>
 #include <X11/Xproto.h>
 #include <X11/Xutil.h>
+#ifdef XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
 
 /* macros */
 #define MAX(a, b)       ((a) > (b) ? (a) : (b))
@@ -1579,22 +1582,32 @@ updatebar(void) {
 
 void
 updategeom(void) {
-	unsigned int i;
-
-#ifdef CUSTOMGEOM /* define your own if you are Xinerama user */
-	CUSTOMGEOM
-#else
-	/* bar geometry*/
-	bx = 0;
-	by = showbar ? (topbar ? 0 : sh - bh) : -bh;
-	bw = sw;
+	int i;
+#ifdef XINERAMA
+	XineramaScreenInfo *info = NULL;
 
 	/* window area geometry */
-	wx = sx;
-	wy = showbar && topbar ? sy + bh : sy;
-	ww = sw;
-	wh = showbar ? sh - bh : sh;
+	if(XineramaIsActive(dpy)) {
+		info = XineramaQueryScreens(dpy, &i);
+		wx = info[0].x_org;
+		wy = showbar && topbar ? info[0].y_org + info[0].height + bh : info[0].y_org;
+		ww = info[0].width;
+		wh = showbar ? info[0].height - bh : info[0].height;
+		XFree(info);
+	}
+	else
 #endif
+	{
+		wx = sx;
+		wy = showbar && topbar ? sy + bh : sy;
+		ww = sw;
+		wh = showbar ? sh - bh : sh;
+	}
+
+	/* bar geometry*/
+	bx = wx;
+	by = showbar ? (topbar ? 0 : wy + wh) : -bh;
+	bw = ww;
 
 	/* update layout geometries */
 	for(i = 0; i < LENGTH(layouts); i++)
ref='#n296'>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 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426