diff options
| author | Martin Rudalics | 2008-09-13 08:28:04 +0000 |
|---|---|---|
| committer | Martin Rudalics | 2008-09-13 08:28:04 +0000 |
| commit | b0c7121cabe1cc5f4df12c3acd4354d4a5c5f042 (patch) | |
| tree | 52cbccf460bd3be9b1e75a771072a8f3293f8aea | |
| parent | da643190850a27485d88dd59a19ca6eaf881ef7b (diff) | |
| download | emacs-b0c7121cabe1cc5f4df12c3acd4354d4a5c5f042.tar.gz emacs-b0c7121cabe1cc5f4df12c3acd4354d4a5c5f042.zip | |
(select-frame-set-input-focus): With focus follows
mouse move mouse cursor to right window.
| -rw-r--r-- | lisp/frame.el | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lisp/frame.el b/lisp/frame.el index 5454ac8f58c..8acafa9c690 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -842,13 +842,23 @@ the user during startup." | |||
| 842 | 842 | ||
| 843 | (defun select-frame-set-input-focus (frame) | 843 | (defun select-frame-set-input-focus (frame) |
| 844 | "Select FRAME, raise it, and set input focus, if possible." | 844 | "Select FRAME, raise it, and set input focus, if possible." |
| 845 | (select-frame frame) | 845 | (select-frame frame) |
| 846 | (raise-frame frame) | 846 | (raise-frame frame) |
| 847 | ;; Ensure, if possible, that frame gets input focus. | 847 | ;; Ensure, if possible, that frame gets input focus. |
| 848 | (when (memq (window-system frame) '(x w32 ns)) | 848 | (when (memq (window-system frame) '(x w32 ns)) |
| 849 | (x-focus-frame frame)) | 849 | (x-focus-frame frame)) |
| 850 | (when focus-follows-mouse | 850 | (when focus-follows-mouse |
| 851 | (set-mouse-position (selected-frame) (1- (frame-width)) 0))) | 851 | ;; When the mouse cursor is not in FRAME's selected window move it |
| 852 | ;; there to avoid that some other window gets selected when focus | ||
| 853 | ;; follows mouse. | ||
| 854 | (condition-case nil | ||
| 855 | (let ((window (frame-selected-window frame)) | ||
| 856 | (coordinates (cdr-safe (mouse-position)))) | ||
| 857 | (unless (and (car-safe coordinates) | ||
| 858 | (coordinates-in-window-p coordinates window)) | ||
| 859 | (let ((edges (window-inside-edges (frame-selected-window frame)))) | ||
| 860 | (set-mouse-position frame (nth 2 edges) (nth 1 edges))))) | ||
| 861 | (error nil)))) | ||
| 852 | 862 | ||
| 853 | (defun other-frame (arg) | 863 | (defun other-frame (arg) |
| 854 | "Select the ARGth different visible frame on current display, and raise it. | 864 | "Select the ARGth different visible frame on current display, and raise it. |