all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Subject: Re: Proposal: Only highlight mouse-face when mouse is moved
Date: 15 Feb 2002 00:40:22 +0100	[thread overview]
Message-ID: <5xk7tfljix.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <200202141246.g1ECkUU09354@aztec.santafe.edu>

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


  reply	other threads:[~2002-02-14 23:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5xk7tfljix.fsf@kfs2.cua.dk \
    --to=storm@cua.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.