diff options
author | Chris Feng <chris.w.feng@gmail.com> | 2016-09-25T11·54+0800 |
---|---|---|
committer | Chris Feng <chris.w.feng@gmail.com> | 2016-09-25T11·54+0800 |
commit | 7fbd5220f2e92059ad38776a3f8c674002396870 (patch) | |
tree | b7c94fee7eb4ba843081b33c678fcbe0015f3aee | |
parent | 6be75083c2adeb54882061e82597fab4cdf2a4f4 (diff) |
Fix `exwm-manage--kill-buffer-query-function'
* exwm-manage.el (exwm-manage--kill-buffer-query-function): Check buffer-local variables for destroyed X windows; Avoid force killing clients that support WM_DELETE_WINDOW but not _NET_WM_PING; Use `y-or-n-p' instead for querying.
-rw-r--r-- | exwm-manage.el | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/exwm-manage.el b/exwm-manage.el index f1deda0759f1..42a4353dcdcb 100644 --- a/exwm-manage.el +++ b/exwm-manage.el @@ -449,14 +449,19 @@ manager is shutting down." (defun exwm-manage--kill-buffer-query-function () "Run in `kill-buffer-query-functions'." (catch 'return - (when (xcb:+request-checked+request-check exwm--connection - (make-instance 'xcb:MapWindow :window exwm--id)) + (when (or (not exwm--id) + (not exwm--container) + (xcb:+request-checked+request-check exwm--connection + (make-instance 'xcb:MapWindow + :window exwm--id))) ;; The X window is no longer alive so just close the buffer. ;; Destroy the container. ;; Hide the container to prevent flickering. - (xcb:+request exwm--connection - (make-instance 'xcb:UnmapWindow :window exwm--container)) - (xcb:flush exwm--connection) + (when exwm--container + (xcb:+request exwm--connection + (make-instance 'xcb:UnmapWindow + :window exwm--container)) + (xcb:flush exwm--connection)) (when exwm--floating-frame (let ((window (frame-parameter exwm--floating-frame 'exwm-outer-id))) (xcb:+request exwm--connection @@ -466,8 +471,10 @@ manager is shutting down." :window window :parent exwm--root :x 0 :y 0)))) - (xcb:+request exwm--connection - (make-instance 'xcb:DestroyWindow :window exwm--container)) + (when exwm--container + (xcb:+request exwm--connection + (make-instance 'xcb:DestroyWindow + :window exwm--container))) (xcb:flush exwm--connection) (throw 'return t)) (unless (memq xcb:Atom:WM_DELETE_WINDOW exwm--protocols) @@ -492,15 +499,8 @@ manager is shutting down." (xcb:flush exwm--connection) ;; (unless (memq xcb:Atom:_NET_WM_PING exwm--protocols) - ;; The window does not support _NET_WM_PING. To make sure it'll die, - ;; kill it after the time runs out. - ;; Hide the container to prevent flickering. - (xcb:+request exwm--connection - (make-instance 'xcb:UnmapWindow :window exwm--container)) - (xcb:flush exwm--connection) - (run-with-timer exwm-manage-ping-timeout nil #'exwm-manage--kill-client - id) - ;; Wait for DestroyNotify event. + ;; For X windows without _NET_WM_PING support, we'd better just + ;; wait for DestroyNotify events. (throw 'return nil)) ;; Try to determine if the X window is dead with _NET_WM_PING. (setq exwm-manage--ping-lock t) @@ -517,7 +517,7 @@ manager is shutting down." exwm--connection))) (xcb:flush exwm--connection) (with-timeout (exwm-manage-ping-timeout - (if (yes-or-no-p (format "'%s' is not responding. \ + (if (y-or-n-p (format "'%s' is not responding. \ Would you like to kill it? " (buffer-name))) (progn (exwm-manage--kill-client id) |