unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [simon.marshall@misys.com: mouse-autoselect-window needs a delay]
@ 2006-06-24 23:22 Richard Stallman
  2006-06-24 23:36 ` Chong Yidong
  2006-06-26 11:37 ` Kim F. Storm
  0 siblings, 2 replies; 9+ messages in thread
From: Richard Stallman @ 2006-06-24 23:22 UTC (permalink / raw)


This complaint seems valid.  Would someone like to address it?

------- Start of forwarded message -------
From: "Marshall, Simon" <simon.marshall@misys.com>
To: "'Emacs Pretest Bug (emacs-pretest-bug@gnu.org)'"
	<emacs-pretest-bug@gnu.org>
Date: Wed, 21 Jun 2006 15:19:57 +0100
MIME-Version: 1.0
Subject: mouse-autoselect-window needs a delay
Content-Type: multipart/mixed; boundary="===============1676529925=="
X-Spam-Status: No, score=0.1 required=5.0 tests=HTML_30_40,HTML_MESSAGE 
	autolearn=failed version=3.0.4

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

- --===============1676529925==
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C6953D.C5C1E480"

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

- ------_=_NextPart_001_01C6953D.C5C1E480
Content-Type: text/plain

This isn't a bug as such, but a suggestion for feature refinement.

I like the concept of mouse-autoselect-window, since it allows me to attempt
to mimic my WM's focus-follows-mouse frame policy for Emacs windows.  But
there's always a but.

If you have a split window but the invocation of a command forces you to
move the mouse across a different window, you will probably end up applying
the command to the wrong window.  For example, suppose a frame shows 2
different windows, each containing a different C buffer.  Suppose you want
to comment out a region in the buffer in the lower window.  You select the
region, move the mouse up to the menu bar, select C > Comment Out Region,
and watch in frustration as the operation is performed on the buffer in the
upper window.  The focus had changed as you moved to the menu bar.

WMs that support focus-follows-mouse together with raise-on-focus have a
similar issue.  (Focus-follows-mouse is probably best with raise-on-focus.)
They typically deal with that issue by (a) having a delay, (b) requiring the
mouse to be stationary, or (c) both, before transferring focus and raising.
That way, focus is less likely to be transferred when the user does not wish
it.  My current WM implements (a) with something like a 0.5s delay.

So, I'm suggesting that (a) and/or (b) be implemented for
mouse-autoselect-window.  Perhaps the variable could have a numeric value,
meaning a delay.  A value of t might be equivalent to a value of 0.  A
mouse-[123] in a window would still immediately change focus.

Comments?  Simon.

In GNU Emacs 22.0.50.1 (sparc-sun-solaris2.8, Motif Version 2.1.0)
 of 2006-06-15 on perth
X server distributor `Hummingbird Ltd.', version 11.0.100015
configured using `configure
'--prefix=/rvcarma/marshals/software/slash/usr/local'
'--with-x-toolkit=motif' 'CFLAGS=-g''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: en_GB.ISO8859-1
  value of $LC_CTYPE: en_GB.ISO8859-1
  value of $LC_MESSAGES: C
  value of $LC_MONETARY: en_GB.ISO8859-1
  value of $LC_NUMERIC: en_GB.ISO8859-1
  value of $LC_TIME: en_GB.ISO8859-1
  value of $LANG: en_GB.ISO8859-1
  locale-coding-system: iso-8859-1
  default-enable-multibyte-characters: t

- ------_=_NextPart_001_01C6953D.C5C1E480
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2658.24">
<TITLE>mouse-autoselect-window needs a delay</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2 FACE=3D"Arial">This isn't a bug as such, but a =
suggestion for feature refinement.</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">I like the concept of =
mouse-autoselect-window, since it allows me to attempt to mimic my WM's =
focus-follows-mouse frame policy for Emacs windows.&nbsp; But there's =
always a but.</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">If you have a split window but the =
invocation of a command forces you to move the mouse across a different =
window, you will probably end up applying the command to the wrong =
window.&nbsp; For example, suppose a frame shows 2 different windows, =
each containing a different C buffer.&nbsp; Suppose you want to comment =
out a region in the buffer in the lower window.&nbsp; You select the =
region, move the mouse up to the menu bar, select C &gt; Comment Out =
Region, and watch in frustration as the operation is performed on the =
buffer in the upper window.&nbsp; The focus had changed as you moved to =
the menu bar.</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">WMs that support focus-follows-mouse =
together with raise-on-focus have a similar issue.&nbsp; =
(Focus-follows-mouse is probably best with raise-on-focus.)&nbsp; They =
typically deal with that issue by (a) having a delay, (b) requiring the =
mouse to be stationary, or (c) both, before transferring focus and =
raising.&nbsp; That way, focus is less likely to be transferred when =
the user does not wish it.&nbsp; My current WM implements (a) with =
something like a 0.5s delay.</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">So, I'm suggesting that (a) and/or (b) =
be implemented for mouse-autoselect-window.&nbsp; Perhaps the variable =
could have a numeric value, meaning a delay.&nbsp; A value of t might =
be equivalent to a value of 0.&nbsp; A mouse-[123] in a window would =
still immediately change focus.</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Comments?&nbsp; Simon.</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">In GNU Emacs 22.0.50.1 =
(sparc-sun-solaris2.8, Motif Version 2.1.0)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;of 2006-06-15 on perth</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">X server distributor `Hummingbird =
Ltd.', version 11.0.100015</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">configured using `configure =
'--prefix=3D/rvcarma/marshals/software/slash/usr/local' =
'--with-x-toolkit=3Dmotif' 'CFLAGS=3D-g''</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Important settings:</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_ALL: nil</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_COLLATE: =
en_GB.ISO8859-1</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_CTYPE: =
en_GB.ISO8859-1</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_MESSAGES: =
C</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_MONETARY: =
en_GB.ISO8859-1</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_NUMERIC: =
en_GB.ISO8859-1</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_TIME: =
en_GB.ISO8859-1</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LANG: =
en_GB.ISO8859-1</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; locale-coding-system: =
iso-8859-1</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; =
default-enable-multibyte-characters: t</FONT>
</P>

</BODY>
</HTML>
- ------_=_NextPart_001_01C6953D.C5C1E480--



- --===============1676529925==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

- --===============1676529925==--
------- End of forwarded message -------

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [simon.marshall@misys.com: mouse-autoselect-window needs a delay]
  2006-06-24 23:22 [simon.marshall@misys.com: mouse-autoselect-window needs a delay] Richard Stallman
@ 2006-06-24 23:36 ` Chong Yidong
  2006-06-28 17:25   ` Richard Stallman
  2006-06-26 11:37 ` Kim F. Storm
  1 sibling, 1 reply; 9+ messages in thread
From: Chong Yidong @ 2006-06-24 23:36 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> This complaint seems valid.  Would someone like to address it?

Could we delay this for after the release?  It's far from crucial.

> From: "Marshall, Simon" <simon.marshall@misys.com>
> Subject: mouse-autoselect-window needs a delay
> To: "'Emacs Pretest Bug (emacs-pretest-bug@gnu.org)'" <emacs-pretest-bug@gnu.org>
>
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
>
> - --===============1676529925==
> Content-Type: multipart/alternative;
> 	boundary="----_=_NextPart_001_01C6953D.C5C1E480"
>
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
>
> - ------_=_NextPart_001_01C6953D.C5C1E480
> Content-Type: text/plain
>
> This isn't a bug as such, but a suggestion for feature refinement.
>
> I like the concept of mouse-autoselect-window, since it allows me to attempt
> to mimic my WM's focus-follows-mouse frame policy for Emacs windows.  But
> there's always a but.
>
> If you have a split window but the invocation of a command forces you to
> move the mouse across a different window, you will probably end up applying
> the command to the wrong window.  For example, suppose a frame shows 2
> different windows, each containing a different C buffer.  Suppose you want
> to comment out a region in the buffer in the lower window.  You select the
> region, move the mouse up to the menu bar, select C > Comment Out Region,
> and watch in frustration as the operation is performed on the buffer in the
> upper window.  The focus had changed as you moved to the menu bar.
>
> WMs that support focus-follows-mouse together with raise-on-focus have a
> similar issue.  (Focus-follows-mouse is probably best with raise-on-focus.)
> They typically deal with that issue by (a) having a delay, (b) requiring the
> mouse to be stationary, or (c) both, before transferring focus and raising.
> That way, focus is less likely to be transferred when the user does not wish
> it.  My current WM implements (a) with something like a 0.5s delay.
>
> So, I'm suggesting that (a) and/or (b) be implemented for
> mouse-autoselect-window.  Perhaps the variable could have a numeric value,
> meaning a delay.  A value of t might be equivalent to a value of 0.  A
> mouse-[123] in a window would still immediately change focus.
>
> Comments?  Simon.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [simon.marshall@misys.com: mouse-autoselect-window needs a delay]
  2006-06-24 23:22 [simon.marshall@misys.com: mouse-autoselect-window needs a delay] Richard Stallman
  2006-06-24 23:36 ` Chong Yidong
@ 2006-06-26 11:37 ` Kim F. Storm
  2006-06-26 15:30   ` Robert J. Chassell
  2006-06-27 16:14   ` Richard Stallman
  1 sibling, 2 replies; 9+ messages in thread
From: Kim F. Storm @ 2006-06-26 11:37 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> This complaint seems valid.  Would someone like to address it?

It is non-trivial to fix (it requires changes to all GUI ports), so
this is for after the release.  I have added it to TODO.


>
> From: "Marshall, Simon" <simon.marshall@misys.com>
> Subject: mouse-autoselect-window needs a delay
> To: "'Emacs Pretest Bug (emacs-pretest-bug@gnu.org)'" <emacs-pretest-bug@gnu.org>
> Date: Wed, 21 Jun 2006 15:19:57 +0100
>
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
>
> - --===============1676529925==
> Content-Type: multipart/alternative;
> 	boundary="----_=_NextPart_001_01C6953D.C5C1E480"
>
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
>
> - ------_=_NextPart_001_01C6953D.C5C1E480
> Content-Type: text/plain
>
> This isn't a bug as such, but a suggestion for feature refinement.
>
> I like the concept of mouse-autoselect-window, since it allows me to attempt
> to mimic my WM's focus-follows-mouse frame policy for Emacs windows.  But
> there's always a but.
>
> If you have a split window but the invocation of a command forces you to
> move the mouse across a different window, you will probably end up applying
> the command to the wrong window.  For example, suppose a frame shows 2
> different windows, each containing a different C buffer.  Suppose you want
> to comment out a region in the buffer in the lower window.  You select the
> region, move the mouse up to the menu bar, select C > Comment Out Region,
> and watch in frustration as the operation is performed on the buffer in the
> upper window.  The focus had changed as you moved to the menu bar.
>
> WMs that support focus-follows-mouse together with raise-on-focus have a
> similar issue.  (Focus-follows-mouse is probably best with raise-on-focus.)
> They typically deal with that issue by (a) having a delay, (b) requiring the
> mouse to be stationary, or (c) both, before transferring focus and raising.
> That way, focus is less likely to be transferred when the user does not wish
> it.  My current WM implements (a) with something like a 0.5s delay.
>
> So, I'm suggesting that (a) and/or (b) be implemented for
> mouse-autoselect-window.  Perhaps the variable could have a numeric value,
> meaning a delay.  A value of t might be equivalent to a value of 0.  A
> mouse-[123] in a window would still immediately change focus.
>
> Comments?  Simon.
>
> In GNU Emacs 22.0.50.1 (sparc-sun-solaris2.8, Motif Version 2.1.0)
>  of 2006-06-15 on perth
> X server distributor `Hummingbird Ltd.', version 11.0.100015
> configured using `configure
> '--prefix=/rvcarma/marshals/software/slash/usr/local'
> '--with-x-toolkit=motif' 'CFLAGS=-g''
>
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: en_GB.ISO8859-1
>   value of $LC_CTYPE: en_GB.ISO8859-1
>   value of $LC_MESSAGES: C
>   value of $LC_MONETARY: en_GB.ISO8859-1
>   value of $LC_NUMERIC: en_GB.ISO8859-1
>   value of $LC_TIME: en_GB.ISO8859-1
>   value of $LANG: en_GB.ISO8859-1
>   locale-coding-system: iso-8859-1
>   default-enable-multibyte-characters: t
>
> - ------_=_NextPart_001_01C6953D.C5C1E480
> Content-Type: text/html
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> <HTML>
> <HEAD>
> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
> charset=3Dus-ascii">
> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
> 5.5.2658.24">
> <TITLE>mouse-autoselect-window needs a delay</TITLE>
> </HEAD>
> <BODY>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">This isn't a bug as such, but a =
> suggestion for feature refinement.</FONT>
> </P>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">I like the concept of =
> mouse-autoselect-window, since it allows me to attempt to mimic my WM's =
> focus-follows-mouse frame policy for Emacs windows.&nbsp; But there's =
> always a but.</FONT></P>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">If you have a split window but the =
> invocation of a command forces you to move the mouse across a different =
> window, you will probably end up applying the command to the wrong =
> window.&nbsp; For example, suppose a frame shows 2 different windows, =
> each containing a different C buffer.&nbsp; Suppose you want to comment =
> out a region in the buffer in the lower window.&nbsp; You select the =
> region, move the mouse up to the menu bar, select C &gt; Comment Out =
> Region, and watch in frustration as the operation is performed on the =
> buffer in the upper window.&nbsp; The focus had changed as you moved to =
> the menu bar.</FONT></P>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">WMs that support focus-follows-mouse =
> together with raise-on-focus have a similar issue.&nbsp; =
> (Focus-follows-mouse is probably best with raise-on-focus.)&nbsp; They =
> typically deal with that issue by (a) having a delay, (b) requiring the =
> mouse to be stationary, or (c) both, before transferring focus and =
> raising.&nbsp; That way, focus is less likely to be transferred when =
> the user does not wish it.&nbsp; My current WM implements (a) with =
> something like a 0.5s delay.</FONT></P>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">So, I'm suggesting that (a) and/or (b) =
> be implemented for mouse-autoselect-window.&nbsp; Perhaps the variable =
> could have a numeric value, meaning a delay.&nbsp; A value of t might =
> be equivalent to a value of 0.&nbsp; A mouse-[123] in a window would =
> still immediately change focus.</FONT></P>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">Comments?&nbsp; Simon.</FONT>
> </P>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">In GNU Emacs 22.0.50.1 =
> (sparc-sun-solaris2.8, Motif Version 2.1.0)</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;of 2006-06-15 on perth</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">X server distributor `Hummingbird =
> Ltd.', version 11.0.100015</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">configured using `configure =
> '--prefix=3D/rvcarma/marshals/software/slash/usr/local' =
> '--with-x-toolkit=3Dmotif' 'CFLAGS=3D-g''</FONT>
> </P>
>
> <P><FONT SIZE=3D2 FACE=3D"Arial">Important settings:</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_ALL: nil</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_COLLATE: =
> en_GB.ISO8859-1</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_CTYPE: =
> en_GB.ISO8859-1</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_MESSAGES: =
> C</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_MONETARY: =
> en_GB.ISO8859-1</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_NUMERIC: =
> en_GB.ISO8859-1</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LC_TIME: =
> en_GB.ISO8859-1</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; value of $LANG: =
> en_GB.ISO8859-1</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; locale-coding-system: =
> iso-8859-1</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; =
> default-enable-multibyte-characters: t</FONT>
> </P>
>
> </BODY>
> </HTML>
> - ------_=_NextPart_001_01C6953D.C5C1E480--
>
>
>
> - --===============1676529925==
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
>
> _______________________________________________
> emacs-pretest-bug mailing list
> emacs-pretest-bug@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
>
> - --===============1676529925==--
> ----------
>

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [simon.marshall@misys.com: mouse-autoselect-window needs a delay]
  2006-06-26 11:37 ` Kim F. Storm
@ 2006-06-26 15:30   ` Robert J. Chassell
  2006-06-27 16:14   ` Richard Stallman
  1 sibling, 0 replies; 9+ messages in thread
From: Robert J. Chassell @ 2006-06-26 15:30 UTC (permalink / raw)


    > WMs that support focus-follows-mouse together with
    > raise-on-focus have a similar issue.  ... deal with that issue
    > by (a) having a delay, (b) requiring the mouse to be stationary,
    > or (c) both,

    > ... focus is less likely to be transferred when the user does
    > not wish it.  My current WM implements (a) with something like a
    > 0.5s delay.

    > Comments?  Simon.

I have focus-follows-mouse together with raise-on-focus in my window
manager and mouse-autoselect-window in Emacs, with zero delay in both
cases, and have never had a problem.  Indeed, I love the current
configuration.  It is much easier and more efficent for me than any
alternative.

Recently I suffered an alternative: because of a lightning strike, I
had to run WindowMaker (on an old and and known-to-be-broken machine,
but less broken than the zapped machine).  That instance of the window
manager (the only one I could run on that machine at first) did not
have raise-on-focus that I could find.  It was terrible.  I moved the
cursor much more.

(I don't know if a working WindowMaker lacks raise-on-focus; if it
lacks, as delivered, the window manager is broken.  More likely, the
lack is a side effect of the old and broken machine.)

-- 
    Robert J. Chassell                         
    bob@rattlesnake.com                         GnuPG Key ID: 004B4AC8
    http://www.rattlesnake.com                  http://www.teak.cc

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [simon.marshall@misys.com: mouse-autoselect-window needs a delay]
  2006-06-26 11:37 ` Kim F. Storm
  2006-06-26 15:30   ` Robert J. Chassell
@ 2006-06-27 16:14   ` Richard Stallman
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Stallman @ 2006-06-27 16:14 UTC (permalink / raw)
  Cc: emacs-devel

    It is non-trivial to fix (it requires changes to all GUI ports), so
    this is for after the release.  I have added it to TODO.

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [simon.marshall@misys.com: mouse-autoselect-window needs a delay]
  2006-06-24 23:36 ` Chong Yidong
@ 2006-06-28 17:25   ` Richard Stallman
  2006-06-29 16:37     ` martin rudalics
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2006-06-28 17:25 UTC (permalink / raw)
  Cc: emacs-devel

    > This complaint seems valid.  Would someone like to address it?

    Could we delay this for after the release?  It's far from crucial.

We can.  But while we wait for someone else to check the files of the
Lisp manual, why shouldn't someone else fix this?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [simon.marshall@misys.com: mouse-autoselect-window needs a delay]
  2006-06-28 17:25   ` Richard Stallman
@ 2006-06-29 16:37     ` martin rudalics
  2006-06-30 11:07       ` Richard Stallman
  0 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2006-06-29 16:37 UTC (permalink / raw)
  Cc: Chong Yidong, Marshall, Simon, emacs-devel

 > We can.  But while we wait for someone else to check the files of the
 > Lisp manual, why shouldn't someone else fix this?

There are (at least) two questions that should be cleared before:

1. Suppose I have two windows - SW is the selected one and UW the
unselected one.  I move the mouse to the menubar as described in Simon's
original scenario.  UW should not be selected here.  However, I then
change my mind and move the mouse to UW.  I suppose that UW should be
selected now - agreed?  (It's important to clear this since the current
autoselect mechanism triggers iff the mouse moves from the selected
window to an unselected one.)

2. Currently `mouse-leave-buffer-hook' is not run when autoselecting
a window.  I believe this is a bug that should be resolved - agreed?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [simon.marshall@misys.com: mouse-autoselect-window needs a delay]
  2006-06-29 16:37     ` martin rudalics
@ 2006-06-30 11:07       ` Richard Stallman
  2006-07-03 17:47         ` martin rudalics
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2006-06-30 11:07 UTC (permalink / raw)
  Cc: cyd, simon.marshall, emacs-devel

    1. Suppose I have two windows - SW is the selected one and UW the
    unselected one.  I move the mouse to the menubar as described in Simon's
    original scenario.  UW should not be selected here.  However, I then
    change my mind and move the mouse to UW.  I suppose that UW should be
    selected now - agreed?

Yes.  The question is how to distinguish the two cases.  I thought
someone people suggested using a time delay for that, right.

    2. Currently `mouse-leave-buffer-hook' is not run when autoselecting
    a window.  I believe this is a bug that should be resolved - agreed?

Yes, I think so; this should exit an isearch.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [simon.marshall@misys.com: mouse-autoselect-window needs a delay]
  2006-06-30 11:07       ` Richard Stallman
@ 2006-07-03 17:47         ` martin rudalics
  0 siblings, 0 replies; 9+ messages in thread
From: martin rudalics @ 2006-07-03 17:47 UTC (permalink / raw)
  Cc: cyd, simon.marshall, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 925 bytes --]

Richard Stallman schrieb:
>     1. Suppose I have two windows - SW is the selected one and UW the
>     unselected one.  I move the mouse to the menubar as described in Simon's
>     original scenario.  UW should not be selected here.  However, I then
>     change my mind and move the mouse to UW.  I suppose that UW should be
>     selected now - agreed?
> 
> Yes.  The question is how to distinguish the two cases.  I thought
> someone people suggested using a time delay for that, right.
> 
>     2. Currently `mouse-leave-buffer-hook' is not run when autoselecting
>     a window.  I believe this is a bug that should be resolved - agreed?
> 
> Yes, I think so; this should exit an isearch.
> 
> 

The attached patch is a first approximation.  I've been able to test this
on Windows 98 only, hence I would be glad to hear if this works in a general
context too - simply customize the variable `mouse-autoselect-window'.

[-- Attachment #2: mouse-autoselect-window.patch --]
[-- Type: text/plain, Size: 15412 bytes --]

*** dispextern.h	Sun Jul  2 09:50:00 2006
--- dispextern.h	Sun Jul  2 11:35:22 2006
***************
*** 2690,2696 ****
  extern int help_echo_pos;
  extern struct frame *last_mouse_frame;
  extern int last_tool_bar_item;
! extern int mouse_autoselect_window;
  extern int unibyte_display_via_language_environment;

  extern void reseat_at_previous_visible_line_start P_ ((struct it *));
--- 2690,2697 ----
  extern int help_echo_pos;
  extern struct frame *last_mouse_frame;
  extern int last_tool_bar_item;
! extern Lisp_Object mouse_autoselect_window;
! extern Lisp_Object mouse_autoselect_window_function;
  extern int unibyte_display_via_language_environment;

  extern void reseat_at_previous_visible_line_start P_ ((struct it *));

*** macterm.c	Sun Jul  2 09:50:00 2006
--- macterm.c	Mon Jul  3 10:03:42 2006
***************
*** 10562,10568 ****
  		  else
  		    {
  		      /* Generate SELECT_WINDOW_EVENTs when needed.  */
! 		      if (mouse_autoselect_window)
  			{
  			  Lisp_Object window;

--- 10562,10568 ----
  		  else
  		    {
  		      /* Generate SELECT_WINDOW_EVENTs when needed.  */
! 		      if (!NILP (mouse_autoselect_window))
  			{
  			  Lisp_Object window;

***************
*** 10571,10589 ****
  							    mouse_pos.v,
  							    0, 0, 0, 0);

! 			  /* Window will be selected only when it is
! 			     not selected now and last mouse movement
! 			     event was not in it.  Minibuffer window
! 			     will be selected iff it is active.  */
! 			  if (WINDOWP (window)
! 			      && !EQ (window, last_window)
! 			      && !EQ (window, selected_window))
  			    {
  			      inev.kind = SELECT_WINDOW_EVENT;
  			      inev.frame_or_window = window;
  			    }
! 
! 			  last_window=window;
  			}
  		      if (!note_mouse_movement (f, &mouse_pos))
  			help_echo_string = previous_help_echo_string;
--- 10571,10596 ----
  							    mouse_pos.v,
  							    0, 0, 0, 0);

! 			  if (NUMBERP (mouse_autoselect_window))
! 			    /* Let mouse_autoselect_window_function handle this. */
  			    {
+ 			      if (!NILP (mouse_autoselect_window_function))
+ 				call2 (mouse_autoselect_window_function,
+ 				       last_window, window);
+ 			    }
+ 			  else if (WINDOWP (window)
+ 				   && !EQ (window, last_window)
+ 				   && !EQ (window, selected_window))
+ 			    /* Window will be selected only when it is
+ 			       not selected now and last mouse movement
+ 			       event was not in it.  Minibuffer window
+ 			       will be selected iff it is active.  */
+ 			    {
+ 			      call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
  			      inev.kind = SELECT_WINDOW_EVENT;
  			      inev.frame_or_window = window;
  			    }
! 			  last_window = window;
  			}
  		      if (!note_mouse_movement (f, &mouse_pos))
  			help_echo_string = previous_help_echo_string;

*** msdos.c	Sun Jul  2 12:09:26 2006
--- msdos.c	Mon Jul  3 10:03:46 2006
***************
*** 3387,3400 ****
  						      mouse_last_x,
  						      mouse_last_y,
  						      0, 0, 0, 0);
! 	      /* A window will be selected only when it is not
! 		 selected now, and the last mouse movement event was
! 		 not in it.  A minibuffer window will be selected iff
! 		 it is active.  */
! 	      if (WINDOWP (mouse_window)
! 		  && !EQ (mouse_window, last_mouse_window)
! 		  && !EQ (mouse_window, selected_window))
  		{
  		  event.kind = SELECT_WINDOW_EVENT;
  		  event.frame_or_window = mouse_window;
  		  event.arg = Qnil;
--- 3387,3408 ----
  						      mouse_last_x,
  						      mouse_last_y,
  						      0, 0, 0, 0);
! 	      if (NUMBERP (mouse_autoselect_window))
! 		/* Let mouse_autoselect_window_function handle this. */
  		{
+ 		  if (!NILP (mouse_autoselect_window_function))
+ 		    call2 (mouse_autoselect_window_function,
+ 			   last_window, mouse_window);
+ 		}
+ 	      else if (WINDOWP (mouse_window)
+ 		       && !EQ (mouse_window, last_mouse_window)
+ 		       && !EQ (mouse_window, selected_window))
+ 		/* A window will be selected only when it is not
+ 		   selected now, and the last mouse movement event was
+ 		   not in it.  A minibuffer window will be selected iff
+ 		   it is active.  */
+ 		{
+ 		  call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
  		  event.kind = SELECT_WINDOW_EVENT;
  		  event.frame_or_window = mouse_window;
  		  event.arg = Qnil;

*** w32term.c	Sun Jul  2 09:50:02 2006
--- w32term.c	Sun Jul  2 12:02:38 2006
***************
*** 4286,4292 ****
  	  if (f)
  	    {
  	      /* Generate SELECT_WINDOW_EVENTs when needed.  */
! 	      if (mouse_autoselect_window)
  		{
  		  Lisp_Object window;
  		  int x = LOWORD (msg.msg.lParam);
--- 4286,4292 ----
  	  if (f)
  	    {
  	      /* Generate SELECT_WINDOW_EVENTs when needed.  */
! 	      if (!NILP (mouse_autoselect_window))
  		{
  		  Lisp_Object window;
  		  int x = LOWORD (msg.msg.lParam);
***************
*** 4294,4312 ****

  		  window = window_from_coordinates (f, x, y, 0, 0, 0, 0);

! 		  /* Window will be selected only when it is not
! 		     selected now and last mouse movement event was
! 		     not in it.  Minibuffer window will be selected
! 		     iff it is active.  */
! 		  if (WINDOWP(window)
! 		      && !EQ (window, last_window)
! 		      && !EQ (window, selected_window))
  		    {
  		      inev.kind = SELECT_WINDOW_EVENT;
  		      inev.frame_or_window = window;
  		    }
! 
! 		  last_window=window;
  		}
  	      if (!note_mouse_movement (f, &msg.msg))
  		help_echo_string = previous_help_echo_string;
--- 4294,4319 ----

  		  window = window_from_coordinates (f, x, y, 0, 0, 0, 0);

! 		  if (NUMBERP (mouse_autoselect_window))
! 		    /* Let mouse_autoselect_window_function handle this. */
  		    {
+ 		      if (!NILP (mouse_autoselect_window_function))
+ 			call2 (mouse_autoselect_window_function,
+ 			       last_window, window);
+ 		    }
+ 		  else if (WINDOWP(window)
+ 			   && !EQ (window, last_window)
+ 			   && !EQ (window, selected_window))
+ 		    /* Window will be selected only when it is not
+ 		       selected now and last mouse movement event was
+ 		       not in it.  Minibuffer window will be selected
+ 		       iff it is active.  */
+ 		    {
+ 		      call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
  		      inev.kind = SELECT_WINDOW_EVENT;
  		      inev.frame_or_window = window;
  		    }
! 		  last_window = window;
  		}
  	      if (!note_mouse_movement (f, &msg.msg))
  		help_echo_string = previous_help_echo_string;

*** xdisp.c	Sun Jul  2 09:50:02 2006
--- xdisp.c	Mon Jul  3 19:29:14 2006
***************
*** 256,264 ****
  Lisp_Object Vfontification_functions;
  Lisp_Object Qfontification_functions;

! /* Non-zero means automatically select any window when the mouse
     cursor moves into it.  */
! int mouse_autoselect_window;

  /* Non-zero means draw tool bar buttons raised when the mouse moves
     over them.  */
--- 256,268 ----
  Lisp_Object Vfontification_functions;
  Lisp_Object Qfontification_functions;

! /* Non-nil means automatically select any window when the mouse
!    cursor moves into it.  If a number wait that many seconds before.  */
! Lisp_Object mouse_autoselect_window;
! 
! /* Function called to automatically select a window when the mouse
     cursor moves into it.  */
! Lisp_Object mouse_autoselect_window_function;

  /* Non-zero means draw tool bar buttons raised when the mouse moves
     over them.  */
***************
*** 23933,23941 ****
  See `set-window-redisplay-end-trigger'.  */);
    Vredisplay_end_trigger_functions = Qnil;

!   DEFVAR_BOOL ("mouse-autoselect-window", &mouse_autoselect_window,
!     doc: /* *Non-nil means autoselect window with mouse pointer.  */);
!   mouse_autoselect_window = 0;

    DEFVAR_BOOL ("auto-resize-tool-bars", &auto_resize_tool_bars_p,
      doc: /* *Non-nil means automatically resize tool-bars.
--- 23937,23958 ----
  See `set-window-redisplay-end-trigger'.  */);
    Vredisplay_end_trigger_functions = Qnil;

!   DEFVAR_LISP ("mouse-autoselect-window", &mouse_autoselect_window,
!     doc: /* *Non-nil means autoselect windows with mouse pointer.
! If nil, do not autoselect windows.  If t, autoselection occurs instantaneously. 
! A number means delay autoselection by that many seconds: A window is selected iff
! Emacs can establish that the mouse has remained in that window quiescent for the
! time indicated by the delay.  Note that autoselection does not occur before this
! delay has elapsed at least twice.  Hence, a delay of 0.5 secs means that a new
! window may be selected after 1, 1.5, 2, 2.5, ... seconds.  A delay of less than
! 0.1 seconds is automatically translated into a delay of 0.1 seconds.  */);
!   mouse_autoselect_window = Qnil;
! 
!   DEFVAR_LISP ("mouse-autoselect-window-function", &mouse_autoselect_window_function,
! 	       doc: /* If non-nil, function to run when autoselecting a new window.
! The function is called with two arguments, the window that has been left and the
! window that is entered.  */);
!   mouse_autoselect_window_function = Qnil;

    DEFVAR_BOOL ("auto-resize-tool-bars", &auto_resize_tool_bars_p,
      doc: /* *Non-nil means automatically resize tool-bars.

*** xterm.c	Sun Jul  2 12:10:00 2006
--- xterm.c	Mon Jul  3 10:03:50 2006
***************
*** 6583,6600 ****
                                                    event.xmotion.x, event.xmotion.y,
                                                    0, 0, 0, 0);

!                 /* Window will be selected only when it is not selected now and
!                    last mouse movement event was not in it.  Minibuffer window
!                    will be selected iff it is active.  */
!                 if (WINDOWP (window)
!                     && !EQ (window, last_window)
!                     && !EQ (window, selected_window))
!                   {
!                     inev.ie.kind = SELECT_WINDOW_EVENT;
!                     inev.ie.frame_or_window = window;
!                   }
! 
!                 last_window=window;
                }
              if (!note_mouse_movement (f, &event.xmotion))
  	      help_echo_string = previous_help_echo_string;
--- 6583,6608 ----
                                                    event.xmotion.x, event.xmotion.y,
                                                    0, 0, 0, 0);

! 		if (NUMBERP (mouse_autoselect_window))
! 		  /* Let mouse_autoselect_window_function handle this. */
! 		  {
! 		    if (!NILP (mouse_autoselect_window_function))
! 		      call2 (mouse_autoselect_window_function,
! 			     last_window, window);
! 		  }
! 		else if (WINDOWP(window)
! 			 && !EQ (window, last_window)
! 			 && !EQ (window, selected_window))
! 		  /* Window will be selected only when it is not
! 		     selected now and last mouse movement event was
! 		     not in it.  Minibuffer window will be selected
! 		     iff it is active.  */
! 		  {
! 		    call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
! 		    inev.ie.kind = SELECT_WINDOW_EVENT;
! 		    inev.ie.frame_or_window = window;
! 		  }
! 		last_window = window;
                }
              if (!note_mouse_movement (f, &event.xmotion))
  	      help_echo_string = previous_help_echo_string;

*** cus-start.el	Sun Jul  2 11:41:42 2006
--- cus-start.el	Sun Jul  2 11:40:24 2006
***************
*** 360,365 ****
--- 360,370 ----
  					    (other :tag "Unlimited" t)))
  	     (unibyte-display-via-language-environment mule boolean)
  	     (blink-cursor-alist cursor alist "22.1")
+              (mouse-autoselect-window display
+ 				      (choice (const :tag "Off" nil)
+ 					      (number :tag "Delay" 0.5)
+ 					      (const :tag "Immediate" t))
+ 				      "21.3")
  	     ;; xfaces.c
  	     (scalable-fonts-allowed display boolean)
  	     ;; xfns.c
***************
*** 369,375 ****
  	     (x-gtk-show-hidden-files menu boolean "22.1")
  	     (x-gtk-whole-detached-tool-bar x boolean "22.1")
  	     ;; xterm.c
-              (mouse-autoselect-window display boolean "21.3")
  	     (x-use-underline-position-properties display boolean "21.3")
  	     (x-stretch-cursor display boolean "21.1")))
        this symbol group type standard version native-p
--- 374,379 ----

*** mouse.el	Sun Jul  2 09:49:56 2006
--- mouse.el	Mon Jul  3 19:30:50 2006
***************
*** 1728,1733 ****
--- 1728,1793 ----
  			   (buffer-substring
  			    (overlay-start mouse-secondary-overlay)
  			    (overlay-end mouse-secondary-overlay)))))))
+ 
+ (defvar mouse-autoselect-window-timer nil
+   "Timer used by timer-driven window autoselection.")
+ 
+ (defvar mouse-autoselect-window-position nil
+   "Last mouse position calculated during timer-driven window autoselection.")
+ 
+ (defun mouse-autoselect-window-cancel ()
+   "Terminate timer-driven window autoselection."
+   (when (timerp mouse-autoselect-window-timer)
+     (cancel-timer mouse-autoselect-window-timer))
+   (remove-hook 'pre-command-hook 'mouse-autoselect-window-cancel))
+ 
+ (defun mouse-autoselect-window-start (last-window current-window)
+   "Initiate timer-driven window autoselection.
+ This function is called when the mouse was moved and the variable
+ `mouse-autoselect-window' has a numeric value.  LAST-WINDOW is the last
+ window where the mouse was seen.  CURRENT-WINDOW is the window where the
+ mouse now appears.  Both arguments are currently ignored."
+   (mouse-autoselect-window-cancel)
+   (let ((delay (max (if (numberp mouse-autoselect-window)
+ 			mouse-autoselect-window
+ 		      0.5)
+ 		    ;; Avoid a zero delay here, use 0.1 secs as minimum.
+ 		    0.1)))
+     ;; Reset `mouse-autoselect-window-position' to nil.  We can't set this to
+     ;; `mouse-position' immediately since we'd risk breaking active region
+     ;; highlighting and mode-line related functions.  As a consequence, a window
+     ;; can't be selected before `mouse-autoselect-window' has elapsed twice.
+     (setq mouse-autoselect-window-position nil)
+     (setq mouse-autoselect-window-timer
+ 	  (run-at-time t delay 'mouse-autoselect-window-select))
+     (add-hook 'pre-command-hook 'mouse-autoselect-window-cancel)))
+ 
+ (setq mouse-autoselect-window-function 'mouse-autoselect-window-start)
+ 
+ (defun mouse-autoselect-window-select ()
+   "Select window with timer-driven autoselection of windows.
+ Select window where the mouse appears provided the mouse has not moved
+ for at least `mouse-autoselect-window' seconds and the window is not yet
+ selected.  The minibuffer window is selected iff the minibuffer is
+ active."
+   (condition-case nil
+       (let ((mouse-position (mouse-position)))
+ 	(if (equal mouse-position mouse-autoselect-window-position)
+ 	    ;; mouse-position has stabilized, try to select a new window,
+ 	    ;; cancel timer-driven autoselection in any case.
+ 	    (let* ((window (window-at (cadr mouse-position)
+ 				      (cddr mouse-position)
+ 				      (car mouse-position))))
+ 	      (setq mouse-autoselect-window-position nil)
+ 	      (mouse-autoselect-window-cancel)
+ 	      (when (and window (not (eq window (selected-window)))
+ 			 (or (not (window-minibuffer-p window))
+ 			     (eq window (active-minibuffer-window))))
+ 		(run-hooks 'mouse-leave-buffer-hook)
+ 		(select-window window)))
+ 	  ;; mouse-position has not stabilized yet, record new position.
+ 	  (setq mouse-autoselect-window-position mouse-position)))
+     (error nil)))
  \f
  (defcustom mouse-buffer-menu-maxlen 20
    "*Number of buffers in one pane (submenu) of the buffer menu.


[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-07-03 17:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-24 23:22 [simon.marshall@misys.com: mouse-autoselect-window needs a delay] Richard Stallman
2006-06-24 23:36 ` Chong Yidong
2006-06-28 17:25   ` Richard Stallman
2006-06-29 16:37     ` martin rudalics
2006-06-30 11:07       ` Richard Stallman
2006-07-03 17:47         ` martin rudalics
2006-06-26 11:37 ` Kim F. Storm
2006-06-26 15:30   ` Robert J. Chassell
2006-06-27 16:14   ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).