summary refs log tree commit diff
path: root/xevents.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 /xevents.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 'xevents.c')
-rw-r--r--xevents.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/xevents.c b/xevents.c
index 274af43..dd8de77 100644
--- a/xevents.c
+++ b/xevents.c
@@ -375,6 +375,22 @@ xev_handle_shape(struct xevent *xev, XEvent *ee)
 		client_do_shape(cc);
 }
 
+void
+xev_handle_randr(struct xevent *xev, XEvent *ee)
+{
+	XRRScreenChangeNotifyEvent	*rev = (XRRScreenChangeNotifyEvent *)ee;
+	struct client_ctx		*cc;
+	struct screen_ctx		*sc;
+
+	if ((cc = client_find(rev->window)) != NULL) {
+		XRRUpdateConfiguration(ee);
+		sc = CCTOSC(cc);
+		sc->xmax = rev->width;
+		sc->ymax = rev->height;
+		screen_init_xinerama(sc);
+	}
+}
+
 /* 
  * Called when the keymap has changed.
  * Ungrab all keys, reload keymap and then regrab
@@ -525,6 +541,8 @@ xev_loop(void)
 		default:
 			if (e.type == Shape_ev)
 				xev_handle_shape(xev, &e);
+			else if (e.type == Randr_ev)
+				xev_handle_randr(xev, &e);
 			break;
 		}