changeset 7680:8212755ff793

(note_mouse_movement): Use frame's window in XQueryPointer. Special case if mouse isn't on that window. (note_mouse_highlight): Handle negative args and too-large args.
author Richard M. Stallman <rms@gnu.org>
date Wed, 25 May 1994 09:20:45 +0000
parents 5475c6144371
children c5abcd22ce97
files src/xterm.c
diffstat 1 files changed, 30 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Wed May 25 09:20:10 1994 +0000
+++ b/src/xterm.c	Wed May 25 09:20:45 1994 +0000
@@ -292,7 +292,8 @@
    gc was in progress.  */
 static int mouse_face_deferred_gc;
 
-/* FRAME and X, Y position of mouse when last checked for highlighting.  */
+/* FRAME and X, Y position of mouse when last checked for
+   highlighting.  X and Y can be negative or out of range for the frame.  */
 static FRAME_PTR mouse_face_mouse_frame;
 static int mouse_face_mouse_x, mouse_face_mouse_y;
 
@@ -2085,11 +2086,29 @@
 {
   last_mouse_movement_time = event->time;
 
+  if (event->window != FRAME_X_WINDOW (frame))
+    {
+      mouse_moved = 1;
+      last_mouse_scroll_bar = Qnil;
+
+      note_mouse_highlight (frame, -1, -1);
+
+      /* Ask for another mouse motion event.  */
+      {
+	int dummy;
+
+	XQueryPointer (event->display, FRAME_X_WINDOW (frame),
+		       (Window *) &dummy, (Window *) &dummy,
+		       &dummy, &dummy, &dummy, &dummy,
+		       (unsigned int *) &dummy);
+      }
+    }
+
   /* Has the mouse moved off the glyph it was on at the last sighting?  */
-  if (event->x < last_mouse_glyph.x
-      || event->x >= last_mouse_glyph.x + last_mouse_glyph.width
-      || event->y < last_mouse_glyph.y
-      || event->y >= last_mouse_glyph.y + last_mouse_glyph.height)
+  else if (event->x < last_mouse_glyph.x
+	   || event->x >= last_mouse_glyph.x + last_mouse_glyph.width
+	   || event->y < last_mouse_glyph.y
+	   || event->y >= last_mouse_glyph.y + last_mouse_glyph.height)
     {
       mouse_moved = 1;
       last_mouse_scroll_bar = Qnil;
@@ -2100,7 +2119,7 @@
       {
 	int dummy;
 
-	XQueryPointer (event->display, event->window,
+	XQueryPointer (event->display, FRAME_X_WINDOW (frame),
 		       (Window *) &dummy, (Window *) &dummy,
 		       &dummy, &dummy, &dummy, &dummy,
 		       (unsigned int *) &dummy);
@@ -2113,7 +2132,7 @@
 	 *still* on the same glyph.  */
       int dummy;
       
-      XQueryPointer (event->display, event->window,
+      XQueryPointer (event->display, FRAME_X_WINDOW (frame),
 		     (Window *) &dummy, (Window *) &dummy,
 		     &dummy, &dummy, &dummy, &dummy,
 		     (unsigned int *) &dummy);
@@ -2125,7 +2144,8 @@
 
 /* Take proper action when the mouse has moved to position X, Y on frame F
    as regards highlighting characters that have mouse-face properties.
-   Also dehighlighting chars where the mouse was before.  */
+   Also dehighlighting chars where the mouse was before.
+   X and Y can be negative or out of range.  */
 
 static void
 note_mouse_highlight (f, x, y)
@@ -2166,7 +2186,8 @@
 
   /* Are we in a window whose display is up to date?
      And verify the buffer's text has not changed.  */
-  if (WINDOWP (window) && portion == 0
+  if (WINDOWP (window) && portion == 0 && row >= 0 && column >= 0
+      && row < FRAME_HEIGHT (f) && column < FRAME_WIDTH (f)
       && EQ (w->window_end_valid, w->buffer)
       && w->last_modified == BUF_MODIFF (XBUFFER (w->buffer)))
     {