summary refs log tree commit diff
path: root/screen.c
diff options
context:
space:
mode:
authoroga <oga>2008-09-29 23:16:46 +0000
committeroga <oga>2008-09-29 23:16:46 +0000
commita0739c6cd4df1890751e2527c899756d7a49b6c5 (patch)
treed0c2dd86406ecbf00616857c3b351da224e31345 /screen.c
parente2610449d11d3b5100aad319e8fa70c370b734bf (diff)
downloadcwm-a0739c6cd4df1890751e2527c899756d7a49b6c5.tar.gz
cwm-a0739c6cd4df1890751e2527c899756d7a49b6c5.tar.xz
cwm-a0739c6cd4df1890751e2527c899756d7a49b6c5.zip
Xinerama and XRandR dual head support for cwm(1). Now we detect the xrandr
reconfiguration events and change our sizes depending on that. We also detect
the xinerama screens for maximize, vertmaximize and initial window placement.

This could be improved by automatically resizing maximized windows when
the screen resolution changes and by moving windows that would be hidden
into visible space. Said changes will come shortly.

Tested by many. matthieu@ didn't oppose.
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/screen.c b/screen.c
index c03003d..70ee0db 100644
--- a/screen.c
+++ b/screen.c
@@ -67,3 +67,28 @@ screen_updatestackingorder(void)
 
 	XFree(wins);
 }
+
+void
+screen_init_xinerama(struct screen_ctx *sc)
+{
+	XineramaScreenInfo *info;
+	int no, fake;
+
+	if (HasXinerama == 0 || XineramaIsActive(X_Dpy) == 0) {
+		HasXinerama = 0;
+		sc->xinerama_no = 0;
+	}
+		
+	info = XineramaQueryScreens(X_Dpy, &no);
+	if (info == NULL) {
+		/*is xinerama is actually off, instead of a malloc failure? */
+		if (sc->xinerama == NULL)
+			HasXinerama = NULL;
+		return;
+	}
+
+	if (sc->xinerama != NULL)
+		XFree(sc->xinerama);
+	sc->xinerama = info;
+	sc->xinerama_no = no;
+}