diff options
author | Chris Feng <chris.w.feng@gmail.com> | 2018-07-14T16·00+0800 |
---|---|---|
committer | Chris Feng <chris.w.feng@gmail.com> | 2018-07-14T16·00+0800 |
commit | f45e9b92731432cd2b01e065d9910321e3a9c9f7 (patch) | |
tree | e77c392201369635826667aed3f08e1d21db727a | |
parent | bc5f0b3ffac4d262d4b8537baae0baf72402d079 (diff) |
Fix XTerm crash on startup
* exwm-input.el (exwm-input--set-focus): Applications like XTerm crashes on receiving WM_TAKE_FOCUS so only send it to X windows accepting it.
-rw-r--r-- | exwm-input.el | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/exwm-input.el b/exwm-input.el index 80ab352109a3..57a28735031c 100644 --- a/exwm-input.el +++ b/exwm-input.el @@ -159,26 +159,28 @@ This value should always be overwritten.") (when (exwm--id->buffer id) (with-current-buffer (exwm--id->buffer id) (exwm-input--update-timestamp - (lambda (timestamp id send-input-focus) + (lambda (timestamp id send-input-focus wm-take-focus) (when send-input-focus (xcb:+request exwm--connection (make-instance 'xcb:SetInputFocus :revert-to xcb:InputFocus:Parent :focus id :time timestamp))) - (let ((event (make-instance 'xcb:icccm:WM_TAKE_FOCUS - :window id - :time timestamp))) - (setq event (xcb:marshal event exwm--connection)) - (xcb:+request exwm--connection - (make-instance 'xcb:icccm:SendEvent - :destination id - :event event))) + (when wm-take-focus + (let ((event (make-instance 'xcb:icccm:WM_TAKE_FOCUS + :window id + :time timestamp))) + (setq event (xcb:marshal event exwm--connection)) + (xcb:+request exwm--connection + (make-instance 'xcb:icccm:SendEvent + :destination id + :event event)))) (exwm-input--set-active-window id) (xcb:flush exwm--connection)) id (or exwm--hints-input - (not (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))))))) + (not (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))) + (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))))) (defun exwm-input--update-timestamp (callback &rest args) "Fetch the latest timestamp from the server and feed it to CALLBACK. |