mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-27 13:07:59 +01:00
Set the current buffer before handling key events
There's no guarantee that the global current buffer matches the selected window's buffer. For example, the following will output "*Messages*" regardless of the actual current buffer: (progn (run-at "1 sec" nil (lambda () (with-current-buffer (get-buffer "*Messages*") (sit-for 5)))) (run-at "2 sec" nil (lambda () (message (buffer-name))))) * exwm-input.el (exwm-input--on-KeyPress): Set the current buffer to selected window's current buffer.
This commit is contained in:
parent
1e9be0de38
commit
f14bd2a110
1 changed files with 13 additions and 12 deletions
|
@ -441,6 +441,7 @@ ARGS are additional arguments to CALLBACK."
|
|||
|
||||
(defun exwm-input--on-KeyPress (data _synthetic)
|
||||
"Handle KeyPress event."
|
||||
(with-current-buffer (window-buffer (selected-window))
|
||||
(let ((obj (make-instance 'xcb:KeyPress)))
|
||||
(xcb:unmarshal obj data)
|
||||
(exwm--log "major-mode=%s buffer=%s"
|
||||
|
@ -452,7 +453,7 @@ ARGS are additional arguments to CALLBACK."
|
|||
(char-mode
|
||||
(exwm-input--on-KeyPress-char-mode obj data)))
|
||||
(exwm-input--on-KeyPress-char-mode obj)))
|
||||
(run-hooks 'exwm-input--event-hook))
|
||||
(run-hooks 'exwm-input--event-hook)))
|
||||
|
||||
(defun exwm-input--on-CreateNotify (data _synthetic)
|
||||
"Handle CreateNotify events."
|
||||
|
|
Loading…
Reference in a new issue