aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-05-25 09:20:45 +0000
committerRichard M. Stallman1994-05-25 09:20:45 +0000
commit27f338afea8cb9a93b37e9dd524f4b83e66ce19a (patch)
treef30ac53a3fcf16a8d61feb1dcd1ed2ca37e941fa /src
parent10bba2660f47b72a1afdced9a50cbd1217089c6d (diff)
downloademacs-27f338afea8cb9a93b37e9dd524f4b83e66ce19a.tar.gz
emacs-27f338afea8cb9a93b37e9dd524f4b83e66ce19a.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c39
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;
292 gc was in progress. */ 292 gc was in progress. */
293static int mouse_face_deferred_gc; 293static int mouse_face_deferred_gc;
294 294
295/* FRAME and X, Y position of mouse when last checked for highlighting. */ 295/* FRAME and X, Y position of mouse when last checked for
296 highlighting. X and Y can be negative or out of range for the frame. */
296static FRAME_PTR mouse_face_mouse_frame; 297static FRAME_PTR mouse_face_mouse_frame;
297static int mouse_face_mouse_x, mouse_face_mouse_y; 298static int mouse_face_mouse_x, mouse_face_mouse_y;
298 299
@@ -2085,11 +2086,29 @@ note_mouse_movement (frame, event)
2085{ 2086{
2086 last_mouse_movement_time = event->time; 2087 last_mouse_movement_time = event->time;
2087 2088
2089 if (event->window != FRAME_X_WINDOW (frame))
2090 {
2091 mouse_moved = 1;
2092 last_mouse_scroll_bar = Qnil;
2093
2094 note_mouse_highlight (frame, -1, -1);
2095
2096 /* Ask for another mouse motion event. */
2097 {
2098 int dummy;
2099
2100 XQueryPointer (event->display, FRAME_X_WINDOW (frame),
2101 (Window *) &dummy, (Window *) &dummy,
2102 &dummy, &dummy, &dummy, &dummy,
2103 (unsigned int *) &dummy);
2104 }
2105 }
2106
2088 /* Has the mouse moved off the glyph it was on at the last sighting? */ 2107 /* Has the mouse moved off the glyph it was on at the last sighting? */
2089 if (event->x < last_mouse_glyph.x 2108 else if (event->x < last_mouse_glyph.x
2090 || event->x >= last_mouse_glyph.x + last_mouse_glyph.width 2109 || event->x >= last_mouse_glyph.x + last_mouse_glyph.width
2091 || event->y < last_mouse_glyph.y 2110 || event->y < last_mouse_glyph.y
2092 || event->y >= last_mouse_glyph.y + last_mouse_glyph.height) 2111 || event->y >= last_mouse_glyph.y + last_mouse_glyph.height)
2093 { 2112 {
2094 mouse_moved = 1; 2113 mouse_moved = 1;
2095 last_mouse_scroll_bar = Qnil; 2114 last_mouse_scroll_bar = Qnil;
@@ -2100,7 +2119,7 @@ note_mouse_movement (frame, event)
2100 { 2119 {
2101 int dummy; 2120 int dummy;
2102 2121
2103 XQueryPointer (event->display, event->window, 2122 XQueryPointer (event->display, FRAME_X_WINDOW (frame),
2104 (Window *) &dummy, (Window *) &dummy, 2123 (Window *) &dummy, (Window *) &dummy,
2105 &dummy, &dummy, &dummy, &dummy, 2124 &dummy, &dummy, &dummy, &dummy,
2106 (unsigned int *) &dummy); 2125 (unsigned int *) &dummy);
@@ -2113,7 +2132,7 @@ note_mouse_movement (frame, event)
2113 *still* on the same glyph. */ 2132 *still* on the same glyph. */
2114 int dummy; 2133 int dummy;
2115 2134
2116 XQueryPointer (event->display, event->window, 2135 XQueryPointer (event->display, FRAME_X_WINDOW (frame),
2117 (Window *) &dummy, (Window *) &dummy, 2136 (Window *) &dummy, (Window *) &dummy,
2118 &dummy, &dummy, &dummy, &dummy, 2137 &dummy, &dummy, &dummy, &dummy,
2119 (unsigned int *) &dummy); 2138 (unsigned int *) &dummy);
@@ -2125,7 +2144,8 @@ static int disable_mouse_highlight;
2125 2144
2126/* Take proper action when the mouse has moved to position X, Y on frame F 2145/* Take proper action when the mouse has moved to position X, Y on frame F
2127 as regards highlighting characters that have mouse-face properties. 2146 as regards highlighting characters that have mouse-face properties.
2128 Also dehighlighting chars where the mouse was before. */ 2147 Also dehighlighting chars where the mouse was before.
2148 X and Y can be negative or out of range. */
2129 2149
2130static void 2150static void
2131note_mouse_highlight (f, x, y) 2151note_mouse_highlight (f, x, y)
@@ -2166,7 +2186,8 @@ note_mouse_highlight (f, x, y)
2166 2186
2167 /* Are we in a window whose display is up to date? 2187 /* Are we in a window whose display is up to date?
2168 And verify the buffer's text has not changed. */ 2188 And verify the buffer's text has not changed. */
2169 if (WINDOWP (window) && portion == 0 2189 if (WINDOWP (window) && portion == 0 && row >= 0 && column >= 0
2190 && row < FRAME_HEIGHT (f) && column < FRAME_WIDTH (f)
2170 && EQ (w->window_end_valid, w->buffer) 2191 && EQ (w->window_end_valid, w->buffer)
2171 && w->last_modified == BUF_MODIFF (XBUFFER (w->buffer))) 2192 && w->last_modified == BUF_MODIFF (XBUFFER (w->buffer)))
2172 { 2193 {