diff options
| author | Daniel Colascione | 2018-06-11 14:58:09 -0700 |
|---|---|---|
| committer | Daniel Colascione | 2018-06-11 16:10:34 -0700 |
| commit | 2f6c682061a281dc3e397ff4727a164880e86e7b (patch) | |
| tree | f5990303d483f7d80e1aa1e80a19dc64a6325b66 /lisp/term | |
| parent | a20fe5a7e3577f9b9ad5e88006962966240d9b0c (diff) | |
| download | emacs-2f6c682061a281dc3e397ff4727a164880e86e7b.tar.gz emacs-2f6c682061a281dc3e397ff4727a164880e86e7b.zip | |
New focus management interface
focus-in-hook and focus-out-hook don't accurately reflect actual
user-visible focus states. Add a new focus interface and mark the old
one obsolete.
* doc/lispref/frames.texi (Input Focus): Document new focus
functions. Remove references to the now-obsolete focus hooks.
* lisp/frame.el (frame-focus-state): New function.
(after-focus-change-function): New variable.
(focus-in-hook, focus-out-hook): Move to lisp from C;
mark obsolete.
* lisp/term/xterm.el (xterm-translate-focus-in)
(xterm-translate-focus-out): Track tty focus in `tty-focus-state'
terminal parameter; call `after-focus-change-function'.
(xterm--suspend-tty-function): New function.
* src/frame.c (Fhandle_switch_frame): Update docstring; don't call
focus hooks.
(focus-in-hook, focus-out-hook): Remove: moved to lisp.
(syms_of_frame): Remove unread_switch_frame; add
Vunread_switch_frame.
* src/keyboard.c:
(Finternal_handle_focus_in): New function.
(make_lispy_event): Always report focus events to lisp; don't
translate them to switch events sometimes. Lisp can take care of
creating synthetic switch-frame events via
`internal-handle-focus-in'.
* src/w32term.c (x_focus_changed): Remove switch-avoidance logic:
just directly report focus changes to lisp.
* src/xterm.c (x_focus_changed): Remove switch-avoidance logic:
just directly report focus changes to lisp.
Diffstat (limited to 'lisp/term')
| -rw-r--r-- | lisp/term/xterm.el | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index b3b7a216352..ce4e18efff8 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el | |||
| @@ -115,13 +115,20 @@ Return the pasted text as a string." | |||
| 115 | ;; notifications) instead of read-event (which can't). | 115 | ;; notifications) instead of read-event (which can't). |
| 116 | 116 | ||
| 117 | (defun xterm-translate-focus-in (_prompt) | 117 | (defun xterm-translate-focus-in (_prompt) |
| 118 | (handle-focus-in) | 118 | (setf (terminal-parameter nil 'tty-focus-state) 'focused) |
| 119 | (funcall after-focus-change-function) | ||
| 119 | []) | 120 | []) |
| 120 | 121 | ||
| 121 | (defun xterm-translate-focus-out (_prompt) | 122 | (defun xterm-translate-focus-out (_prompt) |
| 122 | (handle-focus-out) | 123 | (setf (terminal-parameter nil 'tty-focus-state) 'defocused) |
| 124 | (funcall after-focus-change-function) | ||
| 123 | []) | 125 | []) |
| 124 | 126 | ||
| 127 | (defun xterm--suspend-tty-function (_tty) | ||
| 128 | ;; We can't know what happens to the tty after we're suspended | ||
| 129 | (setf (terminal-parameter nil 'tty-focus-state) nil) | ||
| 130 | (funcall after-focus-change-function)) | ||
| 131 | |||
| 125 | ;; Similarly, we want to transparently slurp the entirety of a | 132 | ;; Similarly, we want to transparently slurp the entirety of a |
| 126 | ;; bracketed paste and encapsulate it into a single event. We used to | 133 | ;; bracketed paste and encapsulate it into a single event. We used to |
| 127 | ;; just slurp up the bracketed paste content in the event handler, but | 134 | ;; just slurp up the bracketed paste content in the event handler, but |