mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-27 14:57:59 +01:00
Also send a WM_TAKE_FOCUS when setting focus with SetInputFocus
* exwm-input.el (exwm-input--set-focus): Send an extra WM_TAKE_FOCUS event to workaround the key replay issue with Xorg 1.20 when keyboard is grabbed.
This commit is contained in:
parent
4bb2d87a8d
commit
6be729847e
1 changed files with 21 additions and 30 deletions
|
@ -158,36 +158,27 @@ This value should always be overwritten.")
|
||||||
"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)
|
||||||
(with-current-buffer (exwm--id->buffer id)
|
(with-current-buffer (exwm--id->buffer id)
|
||||||
(cond
|
(exwm-input--update-timestamp
|
||||||
((and (not exwm--hints-input)
|
(lambda (timestamp id send-input-focus)
|
||||||
(memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
|
(when send-input-focus
|
||||||
(when (= (frame-parameter nil 'exwm-id)
|
(xcb:+request exwm--connection
|
||||||
(slot-value (xcb:+request-unchecked+reply exwm--connection
|
(make-instance 'xcb:SetInputFocus
|
||||||
(make-instance 'xcb:GetInputFocus))
|
:revert-to xcb:InputFocus:Parent
|
||||||
'focus))
|
:focus id
|
||||||
(exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id)
|
:time timestamp)))
|
||||||
(exwm-input--update-timestamp
|
(let ((event (make-instance 'xcb:icccm:WM_TAKE_FOCUS
|
||||||
(lambda (timestamp id)
|
:window id
|
||||||
(let ((event (make-instance 'xcb:icccm:WM_TAKE_FOCUS
|
:time timestamp)))
|
||||||
:window id
|
(setq event (xcb:marshal event exwm--connection))
|
||||||
:time timestamp)))
|
(xcb:+request exwm--connection
|
||||||
(setq event (xcb:marshal event exwm--connection))
|
(make-instance 'xcb:icccm:SendEvent
|
||||||
(xcb:+request exwm--connection
|
:destination id
|
||||||
(make-instance 'xcb:icccm:SendEvent
|
:event event)))
|
||||||
:destination id
|
(exwm-input--set-active-window id)
|
||||||
:event event))
|
(xcb:flush exwm--connection))
|
||||||
(exwm-input--set-active-window id)
|
id
|
||||||
(xcb:flush exwm--connection)))
|
(or exwm--hints-input
|
||||||
id)))
|
(not (memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols)))))))
|
||||||
(t
|
|
||||||
(exwm--log "Focus on #x%x with SetInputFocus" id)
|
|
||||||
(xcb:+request exwm--connection
|
|
||||||
(make-instance 'xcb:SetInputFocus
|
|
||||||
:revert-to xcb:InputFocus:Parent
|
|
||||||
:focus id
|
|
||||||
:time xcb:Time:CurrentTime))
|
|
||||||
(exwm-input--set-active-window id)
|
|
||||||
(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.
|
||||||
|
|
Loading…
Reference in a new issue