diff options
| author | Martin Rudalics | 2007-10-06 10:19:45 +0000 |
|---|---|---|
| committer | Martin Rudalics | 2007-10-06 10:19:45 +0000 |
| commit | 1398509c21ea8ab4ec8be1a445355c0b281dd04e (patch) | |
| tree | 2b208764363a1703b3d9fe0f0bae6f53ac7d75c2 | |
| parent | 9bcf0f44a1bf2f691f338e5fc2d7c3ac3349e379 (diff) | |
| download | emacs-1398509c21ea8ab4ec8be1a445355c0b281dd04e.tar.gz emacs-1398509c21ea8ab4ec8be1a445355c0b281dd04e.zip | |
(mouse-autoselect-window-cancel): Don't cancel for
select-window or select-frame events.
(handle-select-window): When autoselecting window set input
focus. Restructure.
| -rw-r--r-- | admin/FOR-RELEASE | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/window.el | 67 |
3 files changed, 48 insertions, 34 deletions
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index dbc11ebdbf8..7a26797ac87 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE | |||
| @@ -72,11 +72,6 @@ Stephen Berman <Stephen.Berman@gmx.net> has compiled a list of KDE | |||
| 72 | builds where the behavior can be observed, compare: | 72 | builds where the behavior can be observed, compare: |
| 73 | http://lists.gnu.org/archive/html/emacs-devel/2007-09/msg00446.html | 73 | http://lists.gnu.org/archive/html/emacs-devel/2007-09/msg00446.html |
| 74 | 74 | ||
| 75 | ** mouse-autoselect-window with click-to-focus window managers | ||
| 76 | Report by Drew Adams <drew.adams@oracle.com> on emacs-devel from | ||
| 77 | 2007-09-05. | ||
| 78 | http://lists.gnu.org/archive/html/emacs-devel/2007-09/msg00298.html | ||
| 79 | |||
| 80 | ** GNU NT-Emacs crashes with longlines-mode and outline-mode | 75 | ** GNU NT-Emacs crashes with longlines-mode and outline-mode |
| 81 | Reported by Rainer Thiel <r.thiel@uni-jena.de> on emacs-pretest-bug | 76 | Reported by Rainer Thiel <r.thiel@uni-jena.de> on emacs-pretest-bug |
| 82 | from 2007-09-22. | 77 | from 2007-09-22. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 976caa10356..80d5f3f7e43 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2007-10-06 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * window.el (mouse-autoselect-window-cancel): Don't cancel for | ||
| 4 | select-window or select-frame events. | ||
| 5 | (handle-select-window): When autoselecting window set input | ||
| 6 | focus. Restructure. | ||
| 7 | |||
| 8 | * frame.el (focus-follows-mouse): Moved to frame.c. | ||
| 9 | * cus-start.el (all): Add focus-follows-mouse. | ||
| 10 | |||
| 1 | 2007-10-05 Chris Moore <dooglus@gmail.com> | 11 | 2007-10-05 Chris Moore <dooglus@gmail.com> |
| 2 | 12 | ||
| 3 | * server.el (server-kill-new-buffers): Doc fix. | 13 | * server.el (server-kill-new-buffers): Doc fix. |
diff --git a/lisp/window.el b/lisp/window.el index 7a64588c076..dd402750de4 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -805,10 +805,13 @@ scrollbar interaction\) and `select' \(the next invocation of | |||
| 805 | "Cancel delayed window autoselection. | 805 | "Cancel delayed window autoselection. |
| 806 | Optional argument FORCE means cancel unconditionally." | 806 | Optional argument FORCE means cancel unconditionally." |
| 807 | (unless (and (not force) | 807 | (unless (and (not force) |
| 808 | ;; Don't cancel while the user drags a scroll bar. | 808 | ;; Don't cancel for select-window or select-frame events |
| 809 | (eq this-command 'scroll-bar-toolkit-scroll) | 809 | ;; or when the user drags a scroll bar. |
| 810 | (memq (nth 4 (event-end last-input-event)) | 810 | (or (memq this-command |
| 811 | '(handle end-scroll))) | 811 | '(handle-select-window handle-switch-frame)) |
| 812 | (and (eq this-command 'scroll-bar-toolkit-scroll) | ||
| 813 | (memq (nth 4 (event-end last-input-event)) | ||
| 814 | '(handle end-scroll))))) | ||
| 812 | (setq mouse-autoselect-window-state nil) | 815 | (setq mouse-autoselect-window-state nil) |
| 813 | (when (timerp mouse-autoselect-window-timer) | 816 | (when (timerp mouse-autoselect-window-timer) |
| 814 | (cancel-timer mouse-autoselect-window-timer)) | 817 | (cancel-timer mouse-autoselect-window-timer)) |
| @@ -896,33 +899,39 @@ active. This function is run by `mouse-autoselect-window-timer'." | |||
| 896 | "Handle select-window events." | 899 | "Handle select-window events." |
| 897 | (interactive "e") | 900 | (interactive "e") |
| 898 | (let ((window (posn-window (event-start event)))) | 901 | (let ((window (posn-window (event-start event)))) |
| 899 | (when (and (window-live-p window) | 902 | (unless (or (not (window-live-p window)) |
| 900 | ;; Don't switch if we're currently in the minibuffer. | 903 | ;; Don't switch if we're currently in the minibuffer. |
| 901 | ;; This tries to work around problems where the minibuffer gets | 904 | ;; This tries to work around problems where the |
| 902 | ;; unselected unexpectedly, and where you then have to move | 905 | ;; minibuffer gets unselected unexpectedly, and where |
| 903 | ;; your mouse all the way down to the minibuffer to select it. | 906 | ;; you then have to move your mouse all the way down to |
| 904 | (not (window-minibuffer-p (selected-window))) | 907 | ;; the minibuffer to select it. |
| 905 | ;; Don't switch to a minibuffer window unless it's active. | 908 | (window-minibuffer-p (selected-window)) |
| 906 | (or (not (window-minibuffer-p window)) | 909 | ;; Don't switch to minibuffer window unless it's active. |
| 907 | (minibuffer-window-active-p window))) | 910 | (and (window-minibuffer-p window) |
| 908 | (unless (and (numberp mouse-autoselect-window) | 911 | (not (minibuffer-window-active-p window))) |
| 909 | (not (zerop mouse-autoselect-window)) | 912 | ;; Don't switch when autoselection shall be delayed. |
| 910 | (not (eq mouse-autoselect-window-state 'select)) | 913 | (and (numberp mouse-autoselect-window) |
| 911 | (progn | 914 | (not (zerop mouse-autoselect-window)) |
| 912 | ;; Cancel any delayed autoselection. | 915 | (not (eq mouse-autoselect-window-state 'select)) |
| 913 | (mouse-autoselect-window-cancel t) | 916 | (progn |
| 914 | ;; Start delayed autoselection from current mouse position | 917 | ;; Cancel any delayed autoselection. |
| 915 | ;; and window. | 918 | (mouse-autoselect-window-cancel t) |
| 916 | (mouse-autoselect-window-start (mouse-position) window) | 919 | ;; Start delayed autoselection from current mouse position |
| 917 | ;; Executing a command cancels delayed autoselection. | 920 | ;; and window. |
| 918 | (add-hook | 921 | (mouse-autoselect-window-start (mouse-position) window) |
| 919 | 'pre-command-hook 'mouse-autoselect-window-cancel))) | 922 | ;; Executing a command cancels delayed autoselection. |
| 923 | (add-hook | ||
| 924 | 'pre-command-hook 'mouse-autoselect-window-cancel)))) | ||
| 925 | (when mouse-autoselect-window | ||
| 920 | ;; Reset state of delayed autoselection. | 926 | ;; Reset state of delayed autoselection. |
| 921 | (setq mouse-autoselect-window-state nil) | 927 | (setq mouse-autoselect-window-state nil) |
| 922 | (when mouse-autoselect-window | 928 | ;; Set input focus to handle cross-frame movement. Bind |
| 923 | ;; Run `mouse-leave-buffer-hook' when autoselecting window. | 929 | ;; `focus-follows-mouse' to avoid moving the mouse cursor. |
| 924 | (run-hooks 'mouse-leave-buffer-hook)) | 930 | (let (focus-follows-mouse) |
| 925 | (select-window window))))) | 931 | (select-frame-set-input-focus (window-frame window))) |
| 932 | ;; Run `mouse-leave-buffer-hook' when autoselecting window. | ||
| 933 | (run-hooks 'mouse-leave-buffer-hook)) | ||
| 934 | (select-window window)))) | ||
| 926 | 935 | ||
| 927 | (define-key ctl-x-map "2" 'split-window-vertically) | 936 | (define-key ctl-x-map "2" 'split-window-vertically) |
| 928 | (define-key ctl-x-map "3" 'split-window-horizontally) | 937 | (define-key ctl-x-map "3" 'split-window-horizontally) |