about summary refs log tree commit diff stats
path: root/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'event.c')
-rw-r--r--event.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/event.c b/event.c
index ad4e271..949812f 100644
--- a/event.c
+++ b/event.c
@@ -225,6 +225,19 @@ configurenotify(XEvent *e) {
 }
 
 static void
+createnotify(XEvent *e) {
+	static XWindowAttributes wa;
+	XCreateWindowEvent *ev = &e->xcreatewindow;
+
+	if(!XGetWindowAttributes(dpy, ev->window, &wa))
+		return;
+	if(wa.override_redirect)
+		return;
+	if(!getclient(ev->window) && (wa.map_state == IsViewable))
+		manage(ev->window, &wa);
+}
+
+static void
 destroynotify(XEvent *e) {
 	Client *c;
 	XDestroyWindowEvent *ev = &e->xdestroywindow;
@@ -350,6 +363,7 @@ void (*handler[LASTEvent]) (XEvent *) = {
 	[ButtonPress] = buttonpress,
 	[ConfigureRequest] = configurerequest,
 	[ConfigureNotify] = configurenotify,
+	[CreateNotify] = createnotify,
 	[DestroyNotify] = destroynotify,
 	[EnterNotify] = enternotify,
 	[LeaveNotify] = leavenotify,