about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-10-29T04·22+0800
committerChris Feng <chris.w.feng@gmail.com>2015-10-29T04·22+0800
commitd9b4ba0265fc1674b1205a11e838f86bce434b13 (patch)
tree02178e9c1bfbae909e7d166e87c92ee3c94be9c0
parent51f5e35aa6a85516bcd00b3bf874f3f3261ebfdc (diff)
Avoid mapping managed X windows on MapRequest
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--on-MapRequest):
  Check managed X windows in exwm-manage--on-MapRequest instead.
-rw-r--r--exwm-manage.el18
1 files changed, 8 insertions, 10 deletions
diff --git a/exwm-manage.el b/exwm-manage.el
index 0eed8b9fd7f6..bf285ab94406 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -63,10 +63,6 @@ corresponding buffer.")
   "Manage window ID."
   (exwm--log "Try to manage #x%x" id)
   (catch 'return
-    ;; Ensure it's not managed
-    (when (assoc id exwm--id-buffer-alist)
-      (exwm--log "#x%x is already managed" id)
-      (throw 'return 'managed))
     ;; Ensure it's alive
     (when (xcb:+request-checked+request-check exwm--connection
               (make-instance 'xcb:ChangeWindowAttributes
@@ -363,12 +359,14 @@ corresponding buffer.")
   (let ((obj (make-instance 'xcb:MapRequest)))
     (xcb:unmarshal obj data)
     (with-slots (parent window) obj
-      (if (/= exwm--root parent)
-          (progn (xcb:+request exwm--connection
-                     (make-instance 'xcb:MapWindow :window window))
-                 (xcb:flush exwm--connection))
-        (exwm--log "MapRequest from #x%x" window)
-        (exwm-manage--manage-window window)))))
+      (if (assoc window exwm--id-buffer-alist)
+          (exwm--log "#x%x is already managed" id)
+        (if (/= exwm--root parent)
+            (progn (xcb:+request exwm--connection
+                       (make-instance 'xcb:MapWindow :window window))
+                   (xcb:flush exwm--connection))
+          (exwm--log "MapRequest from #x%x" window)
+          (exwm-manage--manage-window window))))))
 
 (defun exwm-manage--on-UnmapNotify (data synthetic)
   "Handle UnmapNotify event."