diff options
| author | Gerd Moellmann | 2000-07-03 09:11:33 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-07-03 09:11:33 +0000 |
| commit | d8aa822b225aa8802df4527426fc59d6272dc149 (patch) | |
| tree | 5372743c50cbb3c7f369cd8a91484c84b820c1eb | |
| parent | a74b0a725ac1699b1cb0e2b11dc782ff68d9364f (diff) | |
| download | emacs-d8aa822b225aa8802df4527426fc59d6272dc149.tar.gz emacs-d8aa822b225aa8802df4527426fc59d6272dc149.zip | |
(bg-window-from-x-y): Use some-window instead
of cycling through windows with next-window.
| -rw-r--r-- | lisp/term/bg-mouse.el | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/lisp/term/bg-mouse.el b/lisp/term/bg-mouse.el index 8f980c4d9d1..fee358ae25c 100644 --- a/lisp/term/bg-mouse.el +++ b/lisp/term/bg-mouse.el | |||
| @@ -250,27 +250,10 @@ X and Y are 0-based character positions in the window." | |||
| 250 | 250 | ||
| 251 | ;;; Returns the window that screen position (x, y) is in or nil if none, | 251 | ;;; Returns the window that screen position (x, y) is in or nil if none, |
| 252 | ;;; meaning we are in the echo area with a non-active minibuffer. | 252 | ;;; meaning we are in the echo area with a non-active minibuffer. |
| 253 | ;;; If coordinates-in-window-p were not in an X-windows-specific file | ||
| 254 | ;;; we could use that. In Emacs 19 can even use locate-window-from-coordinates | ||
| 255 | (defun bg-window-from-x-y (x y) | 253 | (defun bg-window-from-x-y (x y) |
| 256 | "Find window corresponding to screen coordinates. | 254 | "Find window corresponding to screen coordinates. |
| 257 | X and Y are 0-based character positions on the screen." | 255 | X and Y are 0-based character positions on the screen." |
| 258 | (let ((edges (window-edges)) | 256 | (some-window (lambda (w) (coordinates-in-window-p (cons x y) w)))) |
| 259 | (window nil)) | ||
| 260 | (while (and (not (eq window (selected-window))) | ||
| 261 | (or (< y (nth 1 edges)) | ||
| 262 | (>= y (nth 3 edges)) | ||
| 263 | (< x (nth 0 edges)) | ||
| 264 | (>= x (nth 2 edges)))) | ||
| 265 | (setq window (next-window window)) | ||
| 266 | (setq edges (window-edges window))) | ||
| 267 | (cond ((eq window (selected-window)) | ||
| 268 | nil) ;we've looped: not found | ||
| 269 | ((not window) | ||
| 270 | (selected-window)) ;just starting: current window | ||
| 271 | (t | ||
| 272 | window)) | ||
| 273 | )) | ||
| 274 | 257 | ||
| 275 | (defun bg-command-execute (bg-command) | 258 | (defun bg-command-execute (bg-command) |
| 276 | (if (commandp bg-command) | 259 | (if (commandp bg-command) |