[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm 350950a 12/14: Clean up when failing to start
From: |
Chris Feng |
Subject: |
[elpa] externals/exwm 350950a 12/14: Clean up when failing to start |
Date: |
Thu, 8 Mar 2018 12:08:08 -0500 (EST) |
branch: externals/exwm
commit 350950abfce892a1f6f6fc5023ae576801a253ca
Author: Adrián Medraño Calvo <address@hidden>
Commit: Adrián Medraño Calvo <address@hidden>
Clean up when failing to start
* exwm.el (exwm-init, exwm-exit): Clean up when failing to start.
(exwm--exit-icccm-ewmh): Stop deleting root window properties on
exit: delete function.
---
exwm.el | 73 +++++++++++++++++++++++++----------------------------------------
1 file changed, 28 insertions(+), 45 deletions(-)
diff --git a/exwm.el b/exwm.el
index 06b66c2..f2a023b 100644
--- a/exwm.el
+++ b/exwm.el
@@ -667,28 +667,6 @@
:data [0 0]))
(xcb:flush exwm--connection))
-(defun exwm--exit-icccm-ewmh ()
- "Remove ICCCM/EWMH properties."
- (dolist (p (list
- xcb:Atom:_NET_WM_NAME
- xcb:Atom:_NET_SUPPORTED
- xcb:Atom:_NET_CLIENT_LIST
- xcb:Atom:_NET_CLIENT_LIST_STACKING
- xcb:Atom:_NET_NUMBER_OF_DESKTOPS
- xcb:Atom:_NET_DESKTOP_GEOMETRY
- xcb:Atom:_NET_DESKTOP_VIEWPORT
- xcb:Atom:_NET_CURRENT_DESKTOP
- xcb:Atom:_NET_ACTIVE_WINDOW
- xcb:Atom:_NET_SUPPORTING_WM_CHECK
- ;; TODO: Keep this list synchronized with that in
- ;; `exwm--init-icccm-ewmh'.
- ))
- (xcb:+request exwm--connection
- (make-instance 'xcb:DeleteProperty
- :window exwm--root
- :property p))
- (xcb:flush exwm--connection)))
-
;;;###autoload
(defun exwm-init (&optional frame)
"Initialize EXWM."
@@ -697,25 +675,25 @@
;; The frame might not be selected if it's created by emacslicnet.
(select-frame-set-input-focus frame)
(setq frame (selected-frame)))
- (if (not (eq 'x (framep frame)))
- (exwm--log "Not running under X environment")
- (unless exwm--connection
- (exwm-enable 'undo) ;never initialize again
- (setq exwm--connection (xcb:connect))
- (set-process-query-on-exit-flag (slot-value exwm--connection 'process)
- nil) ;prevent query message on exit
- (setq exwm--root
- (slot-value (car (slot-value
- (xcb:get-setup exwm--connection) 'roots))
- 'root))
- (if (xcb:+request-checked+request-check exwm--connection
- (make-instance 'xcb:ChangeWindowAttributes
- :window exwm--root :value-mask xcb:CW:EventMask
- :event-mask xcb:EventMask:SubstructureRedirect))
- ;; Other window manager is running
- (progn (xcb:disconnect exwm--connection)
- (setq exwm--connection nil)
- (exwm--log "Other window manager detected"))
+ (when (not (eq 'x (framep frame)))
+ (user-error "Not running under X environment"))
+ (when exwm--connection
+ (user-error "EXWM already running"))
+ (condition-case err
+ (progn
+ (exwm-enable 'undo) ;never initialize again
+ (setq exwm--connection (xcb:connect))
+ (set-process-query-on-exit-flag (slot-value exwm--connection 'process)
+ nil) ;prevent query message on exit
+ (setq exwm--root
+ (slot-value (car (slot-value
+ (xcb:get-setup exwm--connection) 'roots))
+ 'root))
+ (when (xcb:+request-checked+request-check exwm--connection
+ (make-instance 'xcb:ChangeWindowAttributes
+ :window exwm--root :value-mask
xcb:CW:EventMask
+ :event-mask
xcb:EventMask:SubstructureRedirect))
+ (error "Other window manager is running"))
;; Disable some features not working well with EXWM
(setq use-dialog-box nil
confirm-kill-emacs #'exwm--confirm-kill-emacs)
@@ -734,7 +712,12 @@
(exwm-input--post-init)
;; Manage existing windows
(exwm-manage--scan)
- (run-hooks 'exwm-init-hook)))))
+ (run-hooks 'exwm-init-hook))
+ ((quit error)
+ (exwm-exit)
+ ;; Rethrow error
+ (signal (car err) (cdr err)))))
+
;;;###autoload
(defun exwm-exit ()
@@ -748,13 +731,13 @@
(exwm-workspace--exit)
(exwm-floating--exit)
(exwm-layout--exit)
- (exwm--exit-icccm-ewmh)
(xcb:+request-checked+request-check exwm--connection
(make-instance 'xcb:ChangeWindowAttributes
:window exwm--root :value-mask xcb:CW:EventMask
:event-mask xcb:EventMask:NoEvent))
- (xcb:flush exwm--connection)
- (xcb:disconnect exwm--connection)
+ (when exwm--connection
+ (xcb:flush exwm--connection)
+ (xcb:disconnect exwm--connection))
(setq exwm--connection nil))
(defun exwm-enable (&optional undo)
- [elpa] externals/exwm updated (dd0f107 -> 2f430db), Chris Feng, 2018/03/08
- [elpa] externals/exwm 4660e04 01/14: Prevent duplicate keys in frameset-filter-alist, Chris Feng, 2018/03/08
- [elpa] externals/exwm c00331a 03/14: Cleanup exwm-layout on exit, Chris Feng, 2018/03/08
- [elpa] externals/exwm d3be64e 05/14: Factor out `exwm-randr--on-ScreenChangeNotify', Chris Feng, 2018/03/08
- [elpa] externals/exwm 4f7abf4 04/14: Cleanup exwm-manage on exit, Chris Feng, 2018/03/08
- [elpa] externals/exwm a2b6cfb 08/14: * exwm.el (exwm--exit): Drop SubstructureRedirect on root window., Chris Feng, 2018/03/08
- [elpa] externals/exwm 81529c2 02/14: Cleanup exwm-input on exit, Chris Feng, 2018/03/08
- [elpa] externals/exwm ce8af83 09/14: Disconnect on `exwm--exit', Chris Feng, 2018/03/08
- [elpa] externals/exwm 350950a 12/14: Clean up when failing to start,
Chris Feng <=
- [elpa] externals/exwm a51be88 07/14: Cleanup exwm-workspace on exit, Chris Feng, 2018/03/08
- [elpa] externals/exwm cf98e3d 11/14: Name all helper windows created by EXWM, Chris Feng, 2018/03/08
- [elpa] externals/exwm 587a8ca 10/14: Add interactive commands for starting and stopping EXWM, Chris Feng, 2018/03/08
- [elpa] externals/exwm 7aae6ef 13/14: Support replacing and being replaced by other window managers, Chris Feng, 2018/03/08
- [elpa] externals/exwm 2f430db 14/14: Minor fixes, Chris Feng, 2018/03/08
- [elpa] externals/exwm 33a1a28 06/14: Dissociate frame creation and deletion handlers from the actual configuration of frames as workspaces, Chris Feng, 2018/03/08