about summary refs log tree commit diff
path: root/exwm-workspace.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-02-07T03·25+0800
committerChris Feng <chris.w.feng@gmail.com>2016-02-07T03·25+0800
commit15cdf8f5897183adf5426ecc280eb61626e2c980 (patch)
treec789d486a8859acdf98b4132ad7b47b71c9be7d4 /exwm-workspace.el
parente2edf81271e1a7dd148aa7386b730ae2838c2860 (diff)
Unmanage X windows on exit
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): New function
called on exit to unmanage X windows.
(exwm-workspace--init): Set `confirm-kill-emacs' to
`exwm-workspace--confirm-kill-emacs'.

* exwm-manage.el (exwm-manage--on-UnmapNotify): Ignore UnmapNotify event
generated as a result of parent being resized.
Diffstat (limited to 'exwm-workspace.el')
-rw-r--r--exwm-workspace.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el
index b166733ac6..f65c557eef 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -454,16 +454,24 @@ This functions is modified from `display-buffer-reuse-window' and
     (cancel-timer exwm-workspace--display-echo-area-timer)
     (setq exwm-workspace--display-echo-area-timer nil)))
 
+(defun exwm-workspace--confirm-kill-emacs (prompt)
+  "Confirm before exiting Emacs."
+  (when (pcase (length exwm--id-buffer-alist)
+          (0 (y-or-n-p prompt))
+          (x (yes-or-no-p (format "[EXWM] %d window%s currently alive. %s"
+                                  x (if (= x 1) "" "s") prompt))))
+    (dolist (i exwm--id-buffer-alist)
+      (exwm-manage--unmanage-window (car i) t)
+      (xcb:+request exwm--connection
+          (make-instance 'xcb:MapWindow :window (car i))))
+    (xcb:flush exwm--connection)
+    t))
+
 (defun exwm-workspace--init ()
   "Initialize workspace module."
   (cl-assert (and (< 0 exwm-workspace-number) (>= 10 exwm-workspace-number)))
   ;; Prevent unexpected exit
-  (setq confirm-kill-emacs
-        (lambda (prompt)
-          (pcase (length exwm--id-buffer-alist)
-            (0 (y-or-n-p prompt))
-            (x (yes-or-no-p (format "[EXWM] %d window%s currently alive. %s"
-                                    x (if (= x 1) "" "s") prompt))))))
+  (setq confirm-kill-emacs #'exwm-workspace--confirm-kill-emacs)
   (if (not (exwm-workspace--minibuffer-own-frame-p))
       ;; Initialize workspaces with minibuffers.
       (progn