diff options
| author | Richard M. Stallman <rms@gnu.org> | 1994-05-25 09:20:45 +0000 |
|---|---|---|
| committer | Richard M. Stallman <rms@gnu.org> | 1994-05-25 09:20:45 +0000 |
| commit | 27f338afea8cb9a93b37e9dd524f4b83e66ce19a (patch) | |
| tree | f30ac53a3fcf16a8d61feb1dcd1ed2ca37e941fa | |
| parent | 10bba2660f47b72a1afdced9a50cbd1217089c6d (diff) | |
| download | emacs-27f338afea8cb9a93b37e9dd524f4b83e66ce19a.tar.gz | |
(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.
| -rw-r--r-- | src/xterm.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/src/xterm.c b/src/xterm.c index 528b250b32c..3f8293254d4 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -292,7 +292,8 @@ static int mouse_face_face_id; 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 @@ note_mouse_movement (frame, event) { 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 @@ note_mouse_movement (frame, event) { 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 @@ note_mouse_movement (frame, event) *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 @@ static int disable_mouse_highlight; /* 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 @@ note_mouse_highlight (f, x, y) /* 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))) { |
