Only check input focus for globally active model

* exwm-input.el (exwm-input--set-focus): Partly revert 810b471.
This commit is contained in:
Chris Feng 2016-08-14 12:24:40 +08:00
parent 108b3949c2
commit fe653ba244

View file

@ -61,15 +61,14 @@
(defun exwm-input--set-focus (id) (defun exwm-input--set-focus (id)
"Set input focus to window ID in a proper way." "Set input focus to window ID in a proper way."
(when (exwm--id->buffer id) (when (exwm--id->buffer id)
(let ((focus (slot-value (xcb:+request-unchecked+reply exwm--connection
(make-instance 'xcb:GetInputFocus))
'focus)))
(unless (= focus id)
(with-current-buffer (exwm--id->buffer id) (with-current-buffer (exwm--id->buffer id)
(cond (cond
((and (not exwm--hints-input) ((and (not exwm--hints-input)
(memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols)) (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
(when (= focus (frame-parameter nil 'exwm-id)) (when (= (frame-parameter nil 'exwm-id)
(slot-value (xcb:+request-unchecked+reply exwm--connection
(make-instance 'xcb:GetInputFocus))
'focus))
(exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id) (exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id)
(exwm-input--update-timestamp (exwm-input--update-timestamp
(lambda (timestamp id) (lambda (timestamp id)
@ -92,7 +91,7 @@
:focus id :focus id
:time xcb:Time:CurrentTime)) :time xcb:Time:CurrentTime))
(exwm-input--set-active-window id) (exwm-input--set-active-window id)
(xcb:flush exwm--connection)))))))) (xcb:flush exwm--connection))))))
(defun exwm-input--update-timestamp (callback &rest args) (defun exwm-input--update-timestamp (callback &rest args)
"Fetch the latest timestamp from the server and feed it to CALLBACK. "Fetch the latest timestamp from the server and feed it to CALLBACK.