unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Proposal: Only highlight mouse-face when mouse is moved
@ 2002-02-13 11:15 Kim F. Storm
  2002-02-13 17:18 ` Eli Zaretskii
  2002-02-14  3:12 ` Richard Stallman
  0 siblings, 2 replies; 23+ messages in thread
From: Kim F. Storm @ 2002-02-13 11:15 UTC (permalink / raw)



I am getting pretty tired of arbitrary text getting highlighted, e.g.
after splitting windows, just because there happens to be some text
with the mouse-face at the place where mouse cursor happens to be.


It seems fairly easy to me to keep track of whether the last event
was a mouse movement, and only try to display the mouse face in
that case.

-- 
Kim F. Storm  http://www.cua.dk


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-13 11:15 Proposal: Only highlight mouse-face when mouse is moved Kim F. Storm
@ 2002-02-13 17:18 ` Eli Zaretskii
  2002-02-13 19:55   ` Jason Rumney
  2002-02-14  3:12 ` Richard Stallman
  1 sibling, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2002-02-13 17:18 UTC (permalink / raw)
  Cc: emacs-devel

> From: storm@cua.dk (Kim F. Storm)
> Date: 13 Feb 2002 12:15:56 +0100
> 
> It seems fairly easy to me to keep track of whether the last event
> was a mouse movement, and only try to display the mouse face in
> that case.

Does this mean that if I move the mouse in a way that causes the
highlight, and then press a key, the highlight will go off?  If so,
I'm not sure it's a good idea.

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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-13 17:18 ` Eli Zaretskii
@ 2002-02-13 19:55   ` Jason Rumney
  2002-02-13 21:11     ` Kim F. Storm
  2002-02-14 10:07     ` Eli Zaretskii
  0 siblings, 2 replies; 23+ messages in thread
From: Jason Rumney @ 2002-02-13 19:55 UTC (permalink / raw)
  Cc: storm, emacs-devel

"Eli Zaretskii" <eliz@is.elta.co.il> writes:

> > It seems fairly easy to me to keep track of whether the last event
> > was a mouse movement, and only try to display the mouse face in
> > that case.
> 
> Does this mean that if I move the mouse in a way that causes the
> highlight, and then press a key, the highlight will go off?  If so,
> I'm not sure it's a good idea.

I don't think it has to mean that. It need only take effect when
deciding whether to start displaying mouse-highlight, not whether to
continue displaying mouse-highlight that is already displayed.

-- 
Jason Rumney


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-13 19:55   ` Jason Rumney
@ 2002-02-13 21:11     ` Kim F. Storm
  2002-02-14 12:46       ` Richard Stallman
  2002-02-14 10:07     ` Eli Zaretskii
  1 sibling, 1 reply; 23+ messages in thread
From: Kim F. Storm @ 2002-02-13 21:11 UTC (permalink / raw)


Jason Rumney <jasonr@gnu.org> writes:

> "Eli Zaretskii" <eliz@is.elta.co.il> writes:
> 
> > > It seems fairly easy to me to keep track of whether the last event
> > > was a mouse movement, and only try to display the mouse face in
> > > that case.
> > 
> > Does this mean that if I move the mouse in a way that causes the
> > highlight, and then press a key, the highlight will go off?  If so,
> > I'm not sure it's a good idea.
> 
> I don't think it has to mean that. It need only take effect when
> deciding whether to start displaying mouse-highlight, not whether to
> continue displaying mouse-highlight that is already displayed.

Yes, it could probably work that way, and if we decide that this is
the best approach, it's definitely better than the current
situation...

However, my intention was actually to turn off mouse-highlight if the
last event was not a mouse-movement, mainly because that seems to be
the simplest approach to implement.

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


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-13 11:15 Proposal: Only highlight mouse-face when mouse is moved Kim F. Storm
  2002-02-13 17:18 ` Eli Zaretskii
@ 2002-02-14  3:12 ` Richard Stallman
  2002-02-14  9:58   ` Kim F. Storm
  2002-02-14 22:20   ` Stefan Monnier
  1 sibling, 2 replies; 23+ messages in thread
From: Richard Stallman @ 2002-02-14  3:12 UTC (permalink / raw)
  Cc: emacs-devel

    I am getting pretty tired of arbitrary text getting highlighted, e.g.
    after splitting windows, just because there happens to be some text
    with the mouse-face at the place where mouse cursor happens to be.

That seems correct to me.  The highlighting says the mouse is over
a sensitive area.

    It seems fairly easy to me to keep track of whether the last event
    was a mouse movement, and only try to display the mouse face in
    that case.

It might be easy, but I don't think it is correct.

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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-14  3:12 ` Richard Stallman
@ 2002-02-14  9:58   ` Kim F. Storm
  2002-02-15 10:36     ` Richard Stallman
  2002-02-14 22:20   ` Stefan Monnier
  1 sibling, 1 reply; 23+ messages in thread
From: Kim F. Storm @ 2002-02-14  9:58 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

>     I am getting pretty tired of arbitrary text getting highlighted, e.g.
>     after splitting windows, just because there happens to be some text
>     with the mouse-face at the place where mouse cursor happens to be.
> 
> That seems correct to me.  The highlighting says the mouse is over
> a sensitive area.

Ok, but try this (as an extreme example):

  $ emacs -q

  RET

  [you are now in *scratch*]

  global-map C-j

  [move the mouse into the output from this command]

  [the output is highlighted]

  [move the mouse out of the output from this command]

  [the output is no longer highlighted]

  C-x b RET

  [switches to  *Messages* or some other buffer]

  [... suppose you worked on that buffer for some time]
  [... part of this work included using the mouse     ]
  [... pretend the mouse happens to be left in the 

  [move the mouse approx. 1/3rd from the top of the window]

  C-x b RET

  [switches back to the *scratch* buffer]

  [Now, half your screen is highlighted -- because that is where
   you "happened to" leave the mouse in the previous buffer you
   worked in.]


> 
>     It seems fairly easy to me to keep track of whether the last event
>     was a mouse movement, and only try to display the mouse face in
>     that case.
> 
> It might be easy, but I don't think it is correct.

There could be an option to change the behavoir -- including
turning off mouse-highlight entirely (as has been requested
in recent mails on gnu.emacs.bug).

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


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-13 19:55   ` Jason Rumney
  2002-02-13 21:11     ` Kim F. Storm
@ 2002-02-14 10:07     ` Eli Zaretskii
  2002-02-14 19:04       ` Jason Rumney
  1 sibling, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2002-02-14 10:07 UTC (permalink / raw)
  Cc: storm, emacs-devel


On 13 Feb 2002, Jason Rumney wrote:

> > Does this mean that if I move the mouse in a way that causes the
> > highlight, and then press a key, the highlight will go off?  If so,
> > I'm not sure it's a good idea.
> 
> I don't think it has to mean that. It need only take effect when
> deciding whether to start displaying mouse-highlight, not whether to
> continue displaying mouse-highlight that is already displayed.

It's been awhile since I looked at that code, but IIRC, the decision
whether or not to highlight is made each time the display is updated.
That's because redisplay removes the highlight, redraws the portions
of the screen that need to be updated, and then puts the highlight
back in its (possibly new) screen position.

So unless I'm missing something, it looks like impementing it like you
say would not be easy.  Just looking at the last event is not enough.

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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-13 21:11     ` Kim F. Storm
@ 2002-02-14 12:46       ` Richard Stallman
  2002-02-14 23:40         ` Kim F. Storm
  0 siblings, 1 reply; 23+ messages in thread
From: Richard Stallman @ 2002-02-14 12:46 UTC (permalink / raw)
  Cc: emacs-devel

    However, my intention was actually to turn off mouse-highlight if the
    last event was not a mouse-movement, mainly because that seems to be
    the simplest approach to implement.

This does seem like a coherent alternative: the highlighting goes away
when you don't use the mouse.

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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-14 10:07     ` Eli Zaretskii
@ 2002-02-14 19:04       ` Jason Rumney
  0 siblings, 0 replies; 23+ messages in thread
From: Jason Rumney @ 2002-02-14 19:04 UTC (permalink / raw)
  Cc: storm, emacs-devel

Eli Zaretskii <eliz@is.elta.co.il> writes:

> It's been awhile since I looked at that code, but IIRC, the decision
> whether or not to highlight is made each time the display is updated.

Yes, but we have a record of what was highlighted at the start of
redisplay, so we can easily make the distinction between new
highlighting and maintaining an existing highlight.


-- 
Jason Rumney


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-14  3:12 ` Richard Stallman
  2002-02-14  9:58   ` Kim F. Storm
@ 2002-02-14 22:20   ` Stefan Monnier
  1 sibling, 0 replies; 23+ messages in thread
From: Stefan Monnier @ 2002-02-14 22:20 UTC (permalink / raw)
  Cc: storm, emacs-devel

>     I am getting pretty tired of arbitrary text getting highlighted, e.g.
>     after splitting windows, just because there happens to be some text
>     with the mouse-face at the place where mouse cursor happens to be.
> 
> That seems correct to me.  The highlighting says the mouse is over
> a sensitive area.
> 
>     It seems fairly easy to me to keep track of whether the last event
>     was a mouse movement, and only try to display the mouse face in
>     that case.
> 
> It might be easy, but I don't think it is correct.

But I agree with Kim that if I'm just typing at a *shell* prompt
(for instance), there's no reason to highlight the text that was
scrolled to underneath the mouse (i.e. the text moved to where the mouse
is, instead of the mouse being moved over the text).

I don't find it really important, but if I could choose between the current
behavior and something like what Kim suggests, I'd prefer Kim's behavior.


	Stefan


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-14 12:46       ` Richard Stallman
@ 2002-02-14 23:40         ` Kim F. Storm
  2002-02-15  8:32           ` Kim F. Storm
  0 siblings, 1 reply; 23+ messages in thread
From: Kim F. Storm @ 2002-02-14 23:40 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

>     However, my intention was actually to turn off mouse-highlight if the
>     last event was not a mouse-movement, mainly because that seems to be
>     the simplest approach to implement.
> 
> This does seem like a coherent alternative: the highlighting goes away
> when you don't use the mouse.
> 

The following patch does this for X  (it's a proof of concept - will
make similar change for w32, etc. if you think it is ok).

Could you try it out and tell me what you think?

There is no customization in this patch.  Do we need that?

Index: src/xterm.c
===================================================================
RCS file: /cvs/emacs/src/xterm.c,v
retrieving revision 1.703
diff -c -r1.703 xterm.c
*** src/xterm.c	27 Jan 2002 16:43:36 -0000	1.703
--- src/xterm.c	14 Feb 2002 23:34:56 -0000
***************
*** 6596,6601 ****
--- 6596,6604 ----
  static XMotionEvent last_mouse_motion_event;
  static Lisp_Object last_mouse_motion_frame;
  
+ /* Enable mouse highlight after mouse movement, disable after keypress.  */
+ static int mouse_highlight_on;
+ 
  static void
  note_mouse_movement (frame, event)
       FRAME_PTR frame;
***************
*** 7752,7757 ****
--- 7755,7762 ----
    if (/* If window is in the process of being destroyed, don't bother
  	 to do anything.  */
        w->current_matrix != NULL
+       /* Don't update mouse highlight if off */
+       && (draw != DRAW_MOUSE_FACE || mouse_highlight_on)
        /* Recognize when we are called to operate on rows that don't exist
  	 anymore.  This can happen when a window is split.  */
        && dpyinfo->mouse_face_end_row < w->current_matrix->nrows)
***************
*** 10392,10397 ****
--- 10397,10408 ----
  	    case KeyPress:
  	      f = x_any_window_to_frame (dpyinfo, event.xkey.window);
  
+ 	      if (mouse_highlight_on)
+ 		{
+ 		  mouse_highlight_on = 0;
+ 		  clear_mouse_face (dpyinfo);
+ 		}
+ 
  #if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS
  	      if (f == 0)
  		{
***************
*** 10803,10808 ****
--- 10814,10825 ----
  		  f = last_mouse_frame;
  		else
  		  f = x_window_to_frame (dpyinfo, event.xmotion.window);
+ 
+ 		if (!mouse_highlight_on)
+ 		  {
+ 		    mouse_highlight_on = 1;
+ 		    clear_mouse_face (dpyinfo);
+ 		  }
  
  		if (f)
  		  note_mouse_movement (f, &event.xmotion);


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


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-14 23:40         ` Kim F. Storm
@ 2002-02-15  8:32           ` Kim F. Storm
  2002-02-16 21:55             ` Richard Stallman
  0 siblings, 1 reply; 23+ messages in thread
From: Kim F. Storm @ 2002-02-15  8:32 UTC (permalink / raw)


storm@cua.dk (Kim F. Storm) writes:

> Richard Stallman <rms@gnu.org> writes:
> 
> >     However, my intention was actually to turn off mouse-highlight if the
> >     last event was not a mouse-movement, mainly because that seems to be
> >     the simplest approach to implement.
> > 
> > This does seem like a coherent alternative: the highlighting goes away
> > when you don't use the mouse.
> > 
> 
> The following patch does this for X  (it's a proof of concept - will
> make similar change for w32, etc. if you think it is ok).
> 
> Could you try it out and tell me what you think?

I forgot to explain exactly what it does...:

1) It keeps track of what the last user activity was:
   - if it was a mouse movement, mouse highlight is enabled
   - if it was a key press, mouse highlight is disabled
   - any other event doesn't change the mouse highlight state

2) The mouse "sensitivity" is still there.  It is only the
   actual highlighting which is controlled.

3) This means that the mouse shape still changes to a cross
   when the mouse is over mouse sensitive text.

BTW, if we decide I should install this feature, I need to keep
track of this per display, i.e. in the display_info structure.

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


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-14  9:58   ` Kim F. Storm
@ 2002-02-15 10:36     ` Richard Stallman
  2002-02-15 12:44       ` Eli Zaretskii
  2002-02-17  0:39       ` Kim F. Storm
  0 siblings, 2 replies; 23+ messages in thread
From: Richard Stallman @ 2002-02-15 10:36 UTC (permalink / raw)
  Cc: emacs-devel

      [switches back to the *scratch* buffer]

      [Now, half your screen is highlighted -- because that is where
       you "happened to" leave the mouse in the previous buffer you
       worked in.]

If the idea is that mouse highlighting says "the mouse is over a
sensitive area", which is what it is currently supposed to be, then
this behavior is correct.

It is also consistent to say that mouse highlighting says "the mouse
is over a sensitive area and the last user action was to move the mouse."
That seems like another useful option.

One we have this variable, adding an alternative for "no highlighting"
would be reasonable.  But I suspect that the people who asked for that
would be happy if highlighting never happens except just after a
mouse motion.


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-15 10:36     ` Richard Stallman
@ 2002-02-15 12:44       ` Eli Zaretskii
  2002-02-15 13:23         ` Kim F. Storm
  2002-02-17  0:39       ` Kim F. Storm
  1 sibling, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2002-02-15 12:44 UTC (permalink / raw)
  Cc: storm, emacs-devel

> From: Richard Stallman <rms@gnu.org>
> Date: Fri, 15 Feb 2002 03:36:54 -0700 (MST)
> 
> One we have this variable, adding an alternative for "no highlighting"
> would be reasonable.  But I suspect that the people who asked for that
> would be happy if highlighting never happens except just after a
> mouse motion.

I suggested a few days ago to add a Lisp binding for the global
variable disable_mouse_highlight, as a means to implement such a
option to turn off any mouse highlight.  I'm willing to code this if
people consider it to be a good idea.

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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-15 12:44       ` Eli Zaretskii
@ 2002-02-15 13:23         ` Kim F. Storm
  2002-02-15 13:33           ` Eli Zaretskii
  0 siblings, 1 reply; 23+ messages in thread
From: Kim F. Storm @ 2002-02-15 13:23 UTC (permalink / raw)


"Eli Zaretskii" <eliz@is.elta.co.il> writes:

> > From: Richard Stallman <rms@gnu.org>
> > Date: Fri, 15 Feb 2002 03:36:54 -0700 (MST)
> > 
> > One we have this variable, adding an alternative for "no highlighting"
> > would be reasonable.  But I suspect that the people who asked for that
> > would be happy if highlighting never happens except just after a
> > mouse motion.
> 
> I suggested a few days ago to add a Lisp binding for the global
> variable disable_mouse_highlight, as a means to implement such a
> option to turn off any mouse highlight.  I'm willing to code this if
> people consider it to be a good idea.

I don't think it is a good idea.

Either it is not needed at all if my proposal is installed, or it
should be one of the options for the variable selecting that
behaviour.

Personally, having used the new behaviour all day, I think it is a big
improvement over the current behaviour [especially because the mouse
highlight is still indicated by the mouse cross cursor].

So IMHO it could just replace the current behaviour, and I really
don't think there is a need for an option to bring back the old
behaviour (nor to disable mouse highlight all together).

Have any of you actually tried the patch I posted yesterday?

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


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-15 13:23         ` Kim F. Storm
@ 2002-02-15 13:33           ` Eli Zaretskii
  2002-02-15 22:27             ` Kim F. Storm
  2002-02-16 21:56             ` Richard Stallman
  0 siblings, 2 replies; 23+ messages in thread
From: Eli Zaretskii @ 2002-02-15 13:33 UTC (permalink / raw)
  Cc: emacs-devel

> From: storm@cua.dk (Kim F. Storm)
> Date: 15 Feb 2002 14:23:02 +0100
> 
> So IMHO it could just replace the current behaviour, and I really
> don't think there is a need for an option to bring back the old
> behaviour (nor to disable mouse highlight all together).

Someone explicitly asked for a total disable option, either here or
on gnu.emacs.bug.

> Have any of you actually tried the patch I posted yesterday?

I cannot try it because you only posted a patch that's specific to X,
and I don't have an X installation here.

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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-15 13:33           ` Eli Zaretskii
@ 2002-02-15 22:27             ` Kim F. Storm
  2002-02-16 19:41               ` Eli Zaretskii
  2002-02-16 21:56             ` Richard Stallman
  1 sibling, 1 reply; 23+ messages in thread
From: Kim F. Storm @ 2002-02-15 22:27 UTC (permalink / raw)
  Cc: emacs-devel

"Eli Zaretskii" <eliz@is.elta.co.il> writes:

> > Have any of you actually tried the patch I posted yesterday?
> 
> I cannot try it because you only posted a patch that's specific to X,
> and I don't have an X installation here.

Here is a complete patch (except for NEWS and ChangeLog) which also
(attempts to) work for the w32 and msdos ports -- neither of which I
can test myself.

So I'd really appreciate some help testing (and evaluating) this.

Index: src/frame.c
===================================================================
RCS file: /cvs/emacs/src/frame.c,v
retrieving revision 1.279
diff -c -r1.279 frame.c
*** src/frame.c	14 Jan 2002 13:47:02 -0000	1.279
--- src/frame.c	15 Feb 2002 21:50:25 -0000
***************
*** 79,84 ****
--- 79,85 ----
  Lisp_Object Vterminal_frame;
  Lisp_Object Vdefault_frame_alist;
  Lisp_Object Vmouse_position_function;
+ Lisp_Object Vmouse_highlight;
  \f
  static void
  set_menu_bar_lines_1 (window, n)
***************
*** 2534,2539 ****
--- 2535,2548 ----
  This abnormal hook exists for the benefit of packages like `xt-mouse.el'
  which need to do mouse handling at the Lisp level.  */);
    Vmouse_position_function = Qnil;
+ 
+   DEFVAR_LISP ("mouse-highlight", &Vmouse_highlight,
+ 	       doc: /* If non-nil, clickable text is highlighted when mouse is over it.  
+ If the value is an integer, highlighting is only shown after moving the
+ mouse, while keyboard input turns off the highlight even when the mouse
+ is over the clickable text.  However, the mouse shape still indicates
+ when the mouse is over clickable text.  */);
+   Vmouse_highlight = make_number (1);
  
    DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame,
  		 doc: /* Minibufferless frames use this frame's minibuffer.
Index: src/frame.h
===================================================================
RCS file: /cvs/emacs/src/frame.h,v
retrieving revision 1.94
diff -c -r1.94 frame.h
*** src/frame.h	1 Dec 2001 01:14:09 -0000	1.94
--- src/frame.h	15 Feb 2002 21:50:25 -0000
***************
*** 661,666 ****
--- 661,668 ----
  extern Lisp_Object Vdefault_frame_alist;
  
  extern Lisp_Object Vterminal_frame;
+ 
+ extern Lisp_Object Vmouse_highlight;
  \f
  /* Device-independent scroll bar stuff.  */
  
Index: src/msdos.c
===================================================================
RCS file: /cvs/emacs/src/msdos.c,v
retrieving revision 1.160
diff -c -r1.160 msdos.c
*** src/msdos.c	11 Feb 2002 07:14:56 -0000	1.160
--- src/msdos.c	15 Feb 2002 21:50:26 -0000
***************
*** 1181,1189 ****
  			  Mouse Highlight (and friends..)
   ************************************************************************/
  
- /* This is used for debugging, to turn off note_mouse_highlight.  */
- int disable_mouse_highlight;
- 
  /* If non-nil, dos_rawgetc generates an event to display that string.
     (The display is done in keyboard.c:read_char, by calling
     show_help_echo.)  */
--- 1181,1186 ----
***************
*** 1235,1240 ****
--- 1232,1240 ----
    /* There's no sense to do anything if the mouse face isn't realized.  */
    if (hl > 0)
      {
+       if (dpyinfo->mouse_face_hidden)
+ 	goto set_cursor_shape;
+ 
        fp = FACE_FROM_ID (SELECTED_FRAME(), dpyinfo->mouse_face_face_id);
        if (!fp)
  	goto set_cursor_shape;
***************
*** 1489,1495 ****
    if (mouse_preempted)
      return;
  
!   if (disable_mouse_highlight
        || !f->glyphs_initialized_p)
      return;
  
--- 1489,1495 ----
    if (mouse_preempted)
      return;
  
!   if (NILP (Vmouse_highlight)
        || !f->glyphs_initialized_p)
      return;
  
***************
*** 2584,2589 ****
--- 2584,2590 ----
    the_only_x_display.display_info.mouse_face_mouse_x =
      the_only_x_display.display_info.mouse_face_mouse_y = 0;
    the_only_x_display.display_info.mouse_face_defer = 0;
+   the_only_x_display.display_info.mouse_face_hidden = 0;
  
    init_frame_faces (sf);
  
***************
*** 3154,3159 ****
--- 3155,3161 ----
  {
    struct input_event event;
    union REGS regs;
+   struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME());
    
  #ifndef HAVE_X_WINDOWS
    /* Maybe put the cursor where it should be.  */
***************
*** 3363,3369 ****
      make_event:
        if (code == 0)
  	continue;
!       
        if (code >= 0x100)
  	event.kind = non_ascii_keystroke;
        else
--- 3365,3377 ----
      make_event:
        if (code == 0)
  	continue;
! 
!       if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
! 	{
! 	  dpyinfo->mouse_face_hidden = 1;
! 	  clear_mouse_face (dpyinfo);
! 	}
! 
        if (code >= 0x100)
  	event.kind = non_ascii_keystroke;
        else
***************
*** 3388,3393 ****
--- 3396,3407 ----
           might need to update mouse highlight.  */
        if (mouse_last_x != mouse_prev_x || mouse_last_y != mouse_prev_y)
  	{
+ 	  if (dpyinfo->mouse_face_hidden)
+ 	    {
+ 	      dpyinfo->mouse_face_hidden = 0;
+ 	      clear_mouse_face (dpyinfo);
+ 	    }
+ 
  	  previous_help_echo = help_echo;
  	  help_echo = help_echo_object = help_echo_window = Qnil;
  	  help_echo_pos = -1;
***************
*** 3429,3435 ****
  		if (mouse_button_count == 2 && but < 2)
  		  {
  		    int x2, y2;	/* don't clobber original coordinates */
- 
  		    /* If only one button is pressed, wait 100 msec and
  		       check again.  This way, Speedy Gonzales isn't
  		       punished, while the slow get their chance.  */
--- 3443,3448 ----
***************
*** 3473,3479 ****
    else
      return ((prev_get_char = dos_rawgetc ()) != -1);
  }
- 
  /* Read a key.  Return -1 if no key is ready.  */
  
  dos_keyread ()
--- 3486,3491 ----
Index: src/msdos.h
===================================================================
RCS file: /cvs/emacs/src/msdos.h,v
retrieving revision 1.23
diff -c -r1.23 msdos.h
*** src/msdos.h	30 Oct 2001 15:32:26 -0000	1.23
--- src/msdos.h	15 Feb 2002 21:50:26 -0000
***************
*** 80,85 ****
--- 80,88 ----
  
    /* Nonzero means defer mouse-motion highlighting.  */
    int mouse_face_defer;
+ 
+   /* Nonzero means that the mouse highlight should not be shown.  */
+   int mouse_face_hidden;
  };
  
  /* This is a cut-down version of the one in xterm.h, which see.  */
Index: src/w32term.c
===================================================================
RCS file: /cvs/emacs/src/w32term.c,v
retrieving revision 1.141
diff -c -r1.141 w32term.c
*** src/w32term.c	6 Feb 2002 20:57:44 -0000	1.141
--- src/w32term.c	15 Feb 2002 21:50:29 -0000
***************
*** 6314,6324 ****
      }
  }
  
- /* This is used for debugging, to turn off note_mouse_highlight.  */
- 
- int disable_mouse_highlight;
- 
- 
  \f
  /************************************************************************
  			      Mouse Face
--- 6314,6319 ----
***************
*** 6535,6541 ****
    if (popup_activated ())
      return;
  
!   if (disable_mouse_highlight
        || !f->glyphs_initialized_p)
      return;
  
--- 6530,6536 ----
    if (popup_activated ())
      return;
  
!   if (NILP (Vmouse_highlight)
        || !f->glyphs_initialized_p)
      return;
  
***************
*** 7444,7449 ****
--- 7439,7446 ----
    if (/* If window is in the process of being destroyed, don't bother
  	 to do anything.  */
        w->current_matrix != NULL
+       /* Don't update mouse highlight if hidden */
+       && (draw != DRAW_MOUSE_FACE || !dpyinfo->mouse_face_hidden)
        /* Recognize when we are called to operate on rows that don't exist
  	 anymore.  This can happen when a window is split.  */
        && dpyinfo->mouse_face_end_row < w->current_matrix->nrows)
***************
*** 8642,8647 ****
--- 8639,8650 ----
  	  
  	  if (f && !f->iconified)
  	    {
+ 	      if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
+ 		{
+ 		  dpyinfo->mouse_face_hidden = 1;
+ 		  clear_mouse_face (dpyinfo);
+ 		}
+ 
  	      if (temp_index == sizeof temp_buffer / sizeof (short))
  		temp_index = 0;
  	      temp_buffer[temp_index++] = msg.msg.wParam;
***************
*** 8663,8668 ****
--- 8666,8677 ----
  	  
  	  if (f && !f->iconified)
  	    {
+ 	      if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
+ 		{
+ 		  dpyinfo->mouse_face_hidden = 1;
+ 		  clear_mouse_face (dpyinfo);
+ 		}
+ 
  	      if (temp_index == sizeof temp_buffer / sizeof (short))
  		temp_index = 0;
  	      temp_buffer[temp_index++] = msg.msg.wParam;
***************
*** 8689,8694 ****
--- 8698,8709 ----
  	  else
  	    f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
  	  
+ 	  if (dpyinfo->mouse_face_hidden)
+ 	    {
+ 	      dpyinfo->mouse_face_hidden = 0;
+ 	      clear_mouse_face (dpyinfo);
+ 	    }
+ 
  	  if (f)
  	    note_mouse_movement (f, &msg.msg);
  	  else
***************
*** 10852,10857 ****
--- 10867,10873 ----
    dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID;
    dpyinfo->mouse_face_window = Qnil;
    dpyinfo->mouse_face_overlay = Qnil;
+   dpyinfo->mouse_face_hidden = 0;
    /* TODO: dpyinfo->gray */
  
  }
Index: src/w32term.h
===================================================================
RCS file: /cvs/emacs/src/w32term.h,v
retrieving revision 1.42
diff -c -r1.42 w32term.h
*** src/w32term.h	20 Jan 2002 23:10:35 -0000	1.42
--- src/w32term.h	15 Feb 2002 21:50:29 -0000
***************
*** 195,200 ****
--- 195,203 ----
    /* Nonzero means defer mouse-motion highlighting.  */
    int mouse_face_defer;
  
+   /* Nonzero means that the mouse highlight should not be shown.  */
+   int mouse_face_hidden;
+ 
    int mouse_face_image_state;
  
    char *w32_id_name;
Index: src/xterm.c
===================================================================
RCS file: /cvs/emacs/src/xterm.c,v
retrieving revision 1.704
diff -c -r1.704 xterm.c
*** src/xterm.c	15 Feb 2002 09:36:05 -0000	1.704
--- src/xterm.c	15 Feb 2002 21:50:33 -0000
***************
*** 6662,6672 ****
      }
  }
  
- /* This is used for debugging, to turn off note_mouse_highlight.  */
- 
-  int disable_mouse_highlight;
- 
- 
  \f
  /************************************************************************
  			      Mouse Face
--- 6662,6667 ----
***************
*** 6884,6890 ****
      return;
  #endif
  
!   if (disable_mouse_highlight
        || !f->glyphs_initialized_p)
      return;
  
--- 6879,6885 ----
      return;
  #endif
  
!   if (NILP (Vmouse_highlight)
        || !f->glyphs_initialized_p)
      return;
  
***************
*** 7790,7795 ****
--- 7785,7792 ----
    if (/* If window is in the process of being destroyed, don't bother
  	 to do anything.  */
        w->current_matrix != NULL
+       /* Don't update mouse highlight if hidden */
+       && (draw != DRAW_MOUSE_FACE || !dpyinfo->mouse_face_hidden)
        /* Recognize when we are called to operate on rows that don't exist
  	 anymore.  This can happen when a window is split.  */
        && dpyinfo->mouse_face_end_row < w->current_matrix->nrows)
***************
*** 10430,10435 ****
--- 10427,10438 ----
  	    case KeyPress:
  	      f = x_any_window_to_frame (dpyinfo, event.xkey.window);
  
+ 	      if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
+ 		{
+ 		  dpyinfo->mouse_face_hidden = 1;
+ 		  clear_mouse_face (dpyinfo);
+ 		}
+ 
  #if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS
  	      if (f == 0)
  		{
***************
*** 10842,10847 ****
--- 10845,10856 ----
  		else
  		  f = x_window_to_frame (dpyinfo, event.xmotion.window);
  
+ 		if (dpyinfo->mouse_face_hidden)
+ 		  {
+ 		    dpyinfo->mouse_face_hidden = 0;
+ 		    clear_mouse_face (dpyinfo);
+ 		  }
+ 
  		if (f)
  		  note_mouse_movement (f, &event.xmotion);
  		else
***************
*** 14656,14661 ****
--- 14665,14671 ----
    dpyinfo->mouse_face_overlay = Qnil;
    dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0;
    dpyinfo->mouse_face_defer = 0;
+   dpyinfo->mouse_face_hidden = 0;
    dpyinfo->x_focus_frame = 0;
    dpyinfo->x_focus_event_frame = 0;
    dpyinfo->x_highlight_frame = 0;
Index: src/xterm.h
===================================================================
RCS file: /cvs/emacs/src/xterm.h,v
retrieving revision 1.126
diff -c -r1.126 xterm.h
*** src/xterm.h	27 Jan 2002 16:44:10 -0000	1.126
--- src/xterm.h	15 Feb 2002 21:50:33 -0000
***************
*** 223,228 ****
--- 223,231 ----
    /* Nonzero means defer mouse-motion highlighting.  */
    int mouse_face_defer;
  
+   /* Nonzero means that the mouse highlight should not be shown.  */
+   int mouse_face_hidden;
+ 
    int mouse_face_image_state;
  
    char *x_id_name;

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


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-15 22:27             ` Kim F. Storm
@ 2002-02-16 19:41               ` Eli Zaretskii
  0 siblings, 0 replies; 23+ messages in thread
From: Eli Zaretskii @ 2002-02-16 19:41 UTC (permalink / raw)
  Cc: emacs-devel

> From: storm@cua.dk (Kim F. Storm)
> Date: 15 Feb 2002 23:27:07 +0100
> 
> Here is a complete patch (except for NEWS and ChangeLog) which also
> (attempts to) work for the w32 and msdos ports -- neither of which I
> can test myself.

Thanks.  The MS-DOS port seems to work fine, although I cannot say I
like this new behavior much more than the old one.  (Note that the
MS-DOS port cannot change the shape of the mouse pointer.)

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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-15  8:32           ` Kim F. Storm
@ 2002-02-16 21:55             ` Richard Stallman
  0 siblings, 0 replies; 23+ messages in thread
From: Richard Stallman @ 2002-02-16 21:55 UTC (permalink / raw)
  Cc: emacs-devel

    I forgot to explain exactly what it does...:

    1) It keeps track of what the last user activity was:
       - if it was a mouse movement, mouse highlight is enabled
       - if it was a key press, mouse highlight is disabled
       - any other event doesn't change the mouse highlight state

    2) The mouse "sensitivity" is still there.  It is only the
       actual highlighting which is controlled.

    3) This means that the mouse shape still changes to a cross
       when the mouse is over mouse sensitive text.

That seems right to me, except maybe it should also suppress
the change in mouse cursor shape.  I am not sure.

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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-15 13:33           ` Eli Zaretskii
  2002-02-15 22:27             ` Kim F. Storm
@ 2002-02-16 21:56             ` Richard Stallman
  2002-02-17  8:56               ` Eli Zaretskii
  1 sibling, 1 reply; 23+ messages in thread
From: Richard Stallman @ 2002-02-16 21:56 UTC (permalink / raw)
  Cc: storm, emacs-devel

    > So IMHO it could just replace the current behaviour, and I really
    > don't think there is a need for an option to bring back the old
    > behaviour (nor to disable mouse highlight all together).

    Someone explicitly asked for a total disable option, either here or
    on gnu.emacs.bug.

That doesn't mean we should add one.  Users ask for many features;
only some are worth implementing.  Besides, the feature being added
now does almost the same job.  People who want to turn off mouse
highlighting will probably be happy using that instead.


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-15 10:36     ` Richard Stallman
  2002-02-15 12:44       ` Eli Zaretskii
@ 2002-02-17  0:39       ` Kim F. Storm
  1 sibling, 0 replies; 23+ messages in thread
From: Kim F. Storm @ 2002-02-17  0:39 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

> If the idea is that mouse highlighting says "the mouse is over a
> sensitive area", which is what it is currently supposed to be, then
> this behavior is correct.
> 
> It is also consistent to say that mouse highlighting says "the mouse
> is over a sensitive area and the last user action was to move the mouse."
> That seems like another useful option.
> 
> One we have this variable, adding an alternative for "no highlighting"
> would be reasonable.  But I suspect that the people who asked for that
> would be happy if highlighting never happens except just after a
> mouse motion.

I just checked in the changes adding the `mouse-highlight' variable.

If its value is t, the first (old) behaviour is used.
If its value is an integer, the second (new) behaviour is used [the default]
If its value is nil, mouse highlight is disabled (replacing the existing
disable_mouse_highlight variable (available in C/gdb only)).

The changes cover the X, w32 and msdos ports.

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


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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-16 21:56             ` Richard Stallman
@ 2002-02-17  8:56               ` Eli Zaretskii
  2002-02-17 22:50                 ` Richard Stallman
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2002-02-17  8:56 UTC (permalink / raw)
  Cc: storm, emacs-devel


On Sat, 16 Feb 2002, Richard Stallman wrote:

>     > So IMHO it could just replace the current behaviour, and I really
>     > don't think there is a need for an option to bring back the old
>     > behaviour (nor to disable mouse highlight all together).
> 
>     Someone explicitly asked for a total disable option, either here or
>     on gnu.emacs.bug.
> 
> That doesn't mean we should add one.  Users ask for many features;
> only some are worth implementing.

Except that in this case, you replied by asking whether someone wants
to code it ;-)

> Besides, the feature being added now does almost the same job.
> People who want to turn off mouse highlighting will probably be
> happy using that instead.

I'm not sure, but the future will tell.

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


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

* Re: Proposal: Only highlight mouse-face when mouse is moved
  2002-02-17  8:56               ` Eli Zaretskii
@ 2002-02-17 22:50                 ` Richard Stallman
  0 siblings, 0 replies; 23+ messages in thread
From: Richard Stallman @ 2002-02-17 22:50 UTC (permalink / raw)
  Cc: storm, emacs-devel

    > That doesn't mean we should add one.  Users ask for many features;
    > only some are worth implementing.

    Except that in this case, you replied by asking whether someone wants
    to code it ;-)

That was before we had a feature to have mouse highlighting only after
a mouse motion.  In the new context, the need for that other feature
is gone.

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


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

end of thread, other threads:[~2002-02-17 22:50 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-13 11:15 Proposal: Only highlight mouse-face when mouse is moved Kim F. Storm
2002-02-13 17:18 ` Eli Zaretskii
2002-02-13 19:55   ` Jason Rumney
2002-02-13 21:11     ` Kim F. Storm
2002-02-14 12:46       ` Richard Stallman
2002-02-14 23:40         ` Kim F. Storm
2002-02-15  8:32           ` Kim F. Storm
2002-02-16 21:55             ` Richard Stallman
2002-02-14 10:07     ` Eli Zaretskii
2002-02-14 19:04       ` Jason Rumney
2002-02-14  3:12 ` Richard Stallman
2002-02-14  9:58   ` Kim F. Storm
2002-02-15 10:36     ` Richard Stallman
2002-02-15 12:44       ` Eli Zaretskii
2002-02-15 13:23         ` Kim F. Storm
2002-02-15 13:33           ` Eli Zaretskii
2002-02-15 22:27             ` Kim F. Storm
2002-02-16 19:41               ` Eli Zaretskii
2002-02-16 21:56             ` Richard Stallman
2002-02-17  8:56               ` Eli Zaretskii
2002-02-17 22:50                 ` Richard Stallman
2002-02-17  0:39       ` Kim F. Storm
2002-02-14 22:20   ` Stefan Monnier

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).