emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proposal: Only highlight mouse-face when mouse is moved


From: Kim F. Storm
Subject: Re: Proposal: Only highlight mouse-face when mouse is moved
Date: 15 Feb 2002 00:40:22 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

Richard Stallman <address@hidden> 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 <address@hidden> http://www.cua.dk




reply via email to

[Prev in Thread] Current Thread [Next in Thread]