Mercurial > hg > xemacs-beta
diff lisp/frame.el @ 284:558f606b08ae r21-0b40
Import from CVS: tag r21-0b40
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:34:13 +0200 |
parents | c42ec1d1cded |
children | e11d67e05968 |
line wrap: on
line diff
--- a/lisp/frame.el Mon Aug 13 10:33:19 2007 +0200 +++ b/lisp/frame.el Mon Aug 13 10:34:13 2007 +0200 @@ -519,13 +519,10 @@ This command selects the frame ARG steps away in that order. A negative ARG moves in the opposite order. -This command ignores the value of `focus-follows-mouse'." +This sets the window system focus, regardless of the value +of `focus-follows-mouse'." (interactive "p") - (let ((frame (selected-frame)) - (old-focus-follows-mouse focus-follows-mouse) - ;; Allow selecting another frame even when - ;; focus-follows-mouse is true. - (focus-follows-mouse nil)) + (let ((frame (selected-frame))) (while (> arg 0) (setq frame (next-frame frame 'visible-nomini)) (setq arg (1- arg))) @@ -533,11 +530,7 @@ (setq frame (previous-frame frame 'visible-nomini)) (setq arg (1+ arg))) (raise-frame frame) - (select-frame frame) - ;; Allow the focus change to be processed while - ;; focus-follows-mouse is nil. - (and old-focus-follows-mouse - (sit-for 0)) + (focus-frame frame) ;this is a bad idea; you should in general never warp the ;pointer unless the user asks for this. Furthermore, ;our version of `set-mouse-position' takes a window, @@ -547,8 +540,24 @@ ;(if (fboundp 'unfocus-frame) ; (unfocus-frame)))) )) + +;; XEmacs-added utility functions -;; XEmacs-added utility functions +(defmacro save-selected-frame (&rest body) + "Execute forms in BODY, then restore the selected frame. +The value returned is the value of the last form in BODY." + (let ((old-frame (gensym "ssf"))) + `(let ((,old-frame (selected-frame))) + (unwind-protect + (progn ,@body) + (select-frame ,old-frame))))) + +(defmacro with-selected-frame (frame &rest body) + "Execute forms in BODY with FRAME as the selected frame. +The value returned is the value of the last form in BODY." + `(save-selected-frame + (select-frame ,frame) + ,@body)) ; this is in C in FSFmacs (defun frame-list ()