]> code.delx.au - gnu-emacs/commitdiff
Refactor mouse highlight invocation for w32 console.
authorEli Zaretskii <eliz@gnu.org>
Sat, 26 May 2012 09:56:31 +0000 (12:56 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 26 May 2012 09:56:31 +0000 (12:56 +0300)
 src/w32inevt.c: Include termchar.h.
 (mouse_moved_to): Move the call to note_mouse_highlight from here...
 (do_mouse_event): ...to here.
 Call clear_mouse_face if mouse_face_hidden is set in the mouse
 highlight info.

src/ChangeLog
src/w32inevt.c

index 173ed04da73fdd30140cf570f197ace3c1e12790..1a90acbb23b4fd360ce709625a701ba26b38e6e4 100644 (file)
@@ -1,3 +1,12 @@
+2012-05-26  Eli Zaretskii  <eliz@gnu.org>
+
+       Refactor mouse highlight invocation for w32 console.
+       * w32inevt.c: Include termchar.h.
+       (mouse_moved_to): Move the call to note_mouse_highlight from here...
+       (do_mouse_event): ...to here.
+       Call clear_mouse_face if mouse_face_hidden is set in the mouse
+       highlight info.
+
 2012-05-26  Eli Zaretskii  <eliz@gnu.org>
 
        Support mouse highlight on w32 text-mode frames.
index cd4a8dd1d49cf26ad01e65527ff6ffa9961a7128..da8ec0eadb7306da334c86b611fb08b751e0b298 100644 (file)
@@ -37,6 +37,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "dispextern.h"
 #include "blockinput.h"
 #include "termhooks.h"
+#include "termchar.h"
 #include "w32heap.h"
 #include "w32term.h"
 
@@ -562,17 +563,14 @@ w32_console_mouse_position (FRAME_PTR *f,
   UNBLOCK_INPUT;
 }
 
-/* Remember mouse motion, notify emacs, and trigger mouse highlight.  */
+/* Remember mouse motion and notify emacs.  */
 static void
 mouse_moved_to (int x, int y)
 {
   /* If we're in the same place, ignore it.  */
   if (x != movement_pos.X || y != movement_pos.Y)
     {
-      FRAME_PTR f = SELECTED_FRAME ();
-
-      f->mouse_moved = 1;
-      note_mouse_highlight (f, x, y);
+      SELECTED_FRAME ()->mouse_moved = 1;
       movement_pos.X = x;
       movement_pos.Y = y;
       movement_time = GetTickCount ();
@@ -607,10 +605,22 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
 
   if (event->dwEventFlags == MOUSE_MOVED)
     {
-      /* For movement events we just note that the mouse has moved so
-        that emacs will generate drag events and perhaps trigger
-        mouse highlighting.  */
+      FRAME_PTR f = SELECTED_FRAME ();
+      Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+
       mouse_moved_to (event->dwMousePosition.X, event->dwMousePosition.Y);
+
+      if (f->mouse_moved)
+       {
+         if (hlinfo->mouse_face_hidden)
+           {
+             hlinfo->mouse_face_hidden = 0;
+             clear_mouse_face (hlinfo);
+           }
+
+         note_mouse_highlight (f, event->dwMousePosition.X,
+                               event->dwMousePosition.Y);
+       }
       return 0;
     }