This business of binding focus follows mouse to nil and then calling sit-for 0 is
really really evil. I think the correct solution is to make a new command
focus-on-frame, somewhat analogous to switch-to-buffer, that directly changes the
window manager's focus.
Also, do there exist forms save-selected-frame and with-selected-frame? If not,
there should be.
Also, focus-follows-mouse needs to be a console property instead of just a simple
variable.
Also, the default value of focus-follows-mouse should be set according to the
window manager's focus policy. This might entail some special case code for
particular window managers (each of which has their own protocol for obtaining
this property), with a default value of nil under Unix and true under Windows.
Greg Klanderman wrote:
OK, this should do it in terms of documentation and fixing C-x 5 o.
greg
>>>>> "Hrvoje" == Hrvoje Niksic <hniksic(a)srce.hr> writes:
Hrvoje>
Hrvoje> greg(a)alphatech.com (Greg Klanderman) writes:
>> Are we agreed that with f-f-m true, C-x 5 o (other-frame) is the
>> *only* command which should warp focus.
Hrvoje>
Hrvoje> Yes. But this is still a major behavioral change which you should
Hrvoje> document. For instance, it may be worth noting (in the manual) that
Hrvoje> if you want `select-frame' to actually select the WM frame, you must
Hrvoje> bind focus-follows-mouse to nil.
Hrvoje>
Hrvoje> Other than the `C-x 5 o' problem, I must once again state that your
Hrvoje> patch does The Right Thing. For instance,
Hrvoje> (progn (select-frame (other-frame)) (insert "foo")) inserts
"foo" in
Hrvoje> the other buffer's frame, which is correct, and then reselects this
Hrvoje> frame for focus. Kudos to you. :-)
1998-04-30 Greg Klanderman <greg(a)alphatech.com>
* frame.el (other-frame): Work even when focus-follows-mouse is true.
1998-04-30 Greg Klanderman <greg(a)alphatech.com>
* frame.c (Fselect_frame): update docstring to describe
focus-follows-mouse behavior.
1998-04-30 Greg Klanderman <greg(a)alphatech.com>
* lispref/frames.texi (Input Focus): Document behavior of
select-frame wrt focus-follows-mouse.
Index: etc/NEWS
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs-20/etc/NEWS,v
retrieving revision 1.48
diff -u -r1.48 NEWS
--- NEWS 1998/04/24 21:33:58 1.48
+++ NEWS 1998/05/01 08:41:08
@@ -33,6 +33,17 @@
* Changes in XEmacs 21.0
========================
+** When the variable focus-follows-mouse is non-nil, it is no longer
+possible for select-frame to permanently select a different frame.
+The frame selection is temporary and is reverted when the current
+command terminates, much like the buffer selected by `set-buffer'.
+In order to effect a permanent focus change in this case, bind
+focus-follows-mouse to nil, select the frame you want, and do a
+(sit-for 0) within the scope of the binding. The function
+other-frame (normally bound to C-x 5 o) is the only command provided
+which does not respect the setting of focus-follows-mouse, and *will*
+allow one to select a different frame even when set non-nil.
+
** XEmacs has been unbundled into constituent installable packages.
See the file `etc/PACKAGES' in the distribution for a full
description.
Index: man/lispref/frames.texi
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs-20/man/lispref/frames.texi,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 frames.texi
--- frames.texi 1996/12/18 22:43:49 1.1.1.1
+++ frames.texi 1998/05/01 08:41:09
@@ -677,6 +677,13 @@
@code{deselect-frame-hook} to be run, until the next time that XEmacs is
waiting for an event.
+Also note that when the variable @code{focus-follows-mouse} is non-nil,
+the frame selection is temporary and is reverted when the current
+command terminates, much like the buffer selected by @code{set-buffer}.
+In order to effect a permanent focus change in this case, bind
+@code{focus-follows-mouse} to nil, select the frame you want, and do a
+@code{(sit-for 0)} within the scope of the binding.
+
@ignore (FSF Emacs)
XEmacs cooperates with the X server and the window managers by arranging
to select frames according to what the server and window manager ask
Index: lisp/frame.el
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs-20/lisp/frame.el,v
retrieving revision 1.11
diff -u -r1.11 frame.el
--- frame.el 1998/04/23 02:07:52 1.11
+++ frame.el 1998/05/01 08:41:10
@@ -516,10 +516,15 @@
(defun other-frame (arg)
"Select the ARG'th different visible frame, and raise it.
All frames are arranged in a cyclic order.
-This command selects the frame ARG steps away in that order.
+This command selects the frame ARG steps away in that order,
+regardless of the value of `focus-follows-mouse'.
A negative ARG moves in the opposite order."
(interactive "p")
- (let ((frame (selected-frame)))
+ (let ((frame (selected-frame))
+ ;; Allow selecting another frame even when
+ ;; focus-follows-mouse is true.
+ (focus-policy focus-follows-mouse)
+ (focus-follows-mouse nil))
(while (> arg 0)
(setq frame (next-frame frame 'visible-nomini))
(setq arg (1- arg)))
@@ -528,6 +533,8 @@
(setq arg (1+ arg)))
(raise-frame frame)
(select-frame frame)
+ (if focus-policy ;; this hack allows the focus change to be
+ (sit-for 0)) ;; processed while focus-follows-mouse is nil.
;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,
Index: src/frame.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs-20/src/frame.c,v
retrieving revision 1.27
diff -u -r1.27 frame.c
--- frame.c 1998/04/29 23:03:51 1.27
+++ frame.c 1998/05/01 08:41:11
@@ -667,6 +667,13 @@
Note that this does not actually cause the window-system focus to
be set to this frame, or the select-frame-hook or deselect-frame-hook
to be run, until the next time that XEmacs is waiting for an event.
+
+Also note that when focus-follows-mouse is non-nil, the frame
+selection is temporary and is reverted when the current command
+terminates, much like the buffer selected by `set-buffer'. In order
+to effect a permanent focus change in this case, bind
+focus-follows-mouse to nil, select the frame you want, and do
+a (sit-for 0) within the scope of the binding.
*/
(frame))
{
--
This message composed using voice recognition software and foot pedals.
(No keyboards were harmed while composing this message.)