summary refs log tree commit diff
path: root/screen.c
diff options
context:
space:
mode:
authorokan <okan>2012-07-18 21:53:22 +0000
committerokan <okan>2012-07-18 21:53:22 +0000
commit013497c79cdb17d8a40f53d5535b4ba8362f0ef5 (patch)
tree5a36abc90e45247a9fb19240ad0824e752724d74 /screen.c
parent3f956098d9e8382d27a81aedd1e77220dff4865f (diff)
downloadcwm-013497c79cdb17d8a40f53d5535b4ba8362f0ef5.tar.gz
cwm-013497c79cdb17d8a40f53d5535b4ba8362f0ef5.tar.xz
cwm-013497c79cdb17d8a40f53d5535b4ba8362f0ef5.zip
Further simplify Xinerama init and re-init on XRR events.
While testing for Xinerama during setup was done display-wide, each time
XineramaQueryScreens() is called either in start-up or due to an XRR
event, the library re-tests for the Xinerama extension anyway before
moving on; so the initial test is redundant and allows another global to
go away with one other change: always fill in sc->xinerama (and _no),
regardless of the success of malloc in XineramaQueryScreens(), and use
it to see if Xinerama dimensions exist when asked by client and/or menu
code.
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/screen.c b/screen.c
index 768b495..69a638a 100644
--- a/screen.c
+++ b/screen.c
@@ -74,21 +74,11 @@ screen_updatestackingorder(struct screen_ctx *sc)
 void
 screen_init_xinerama(struct screen_ctx *sc)
 {
-	XineramaScreenInfo	*info;
-	int			 no;
-
-	if (HasXinerama == 0 || XineramaIsActive(X_Dpy) == 0) {
-		HasXinerama = 0;
-		sc->xinerama_no = 0;
-	}
+	XineramaScreenInfo	*info = NULL;
+	int			 no = 0;
 
-	info = XineramaQueryScreens(X_Dpy, &no);
-	if (info == NULL) {
-		/* Is xinerama actually off, instead of a malloc failure? */
-		if (sc->xinerama == NULL)
-			HasXinerama = 0;
-		return;
-	}
+	if (XineramaIsActive(X_Dpy))
+		info = XineramaQueryScreens(X_Dpy, &no);
 
 	if (sc->xinerama != NULL)
 		XFree(sc->xinerama);
@@ -105,7 +95,7 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y)
 	XineramaScreenInfo	*info;
 	int			 i;
 
-	if (HasXinerama == 0)
+	if (sc->xinerama == NULL)
 		return (NULL);
 
 	for (i = 0; i < sc->xinerama_no; i++) {