aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-04 00:43:13 +0000
committerRichard M. Stallman1994-04-04 00:43:13 +0000
commit514e46817a2d71dad0d599248ed2f053392f9c8d (patch)
treeaded88cf77394d7d4457d3d0d754f2c5922133bc /src
parent3ccf510abd96e9001133f35c142a9329a1d0c731 (diff)
downloademacs-514e46817a2d71dad0d599248ed2f053392f9c8d.tar.gz
emacs-514e46817a2d71dad0d599248ed2f053392f9c8d.zip
(note_mouse_highlight): Do nothing if gc_in_progress.
Set mouse_face_deferred_gc when that case arise. (XTframe_up_to_date): If mouse_face_deferred_gc, redo highlighting. (show_mouse_face): Turn off cursor only if it's in the area being manipulated. (XTupdate_begin): Don't turn off highlight if we aren't updating the window that it is in.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c67
1 files changed, 59 insertions, 8 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 5d22c27ae1e..94ce71cc878 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -285,6 +285,10 @@ static int mouse_face_beg, mouse_face_end;
285static Lisp_Object mouse_face_window; 285static Lisp_Object mouse_face_window;
286static int mouse_face_face_id; 286static int mouse_face_face_id;
287 287
288/* 1 if a mouse motion event came and we didn't handle it right away because
289 gc was in progress. */
290static int mouse_face_deferred_gc;
291
288/* FRAME and X, Y position of mouse when last checked for highlighting. */ 292/* FRAME and X, Y position of mouse when last checked for highlighting. */
289static FRAME_PTR mouse_face_mouse_frame; 293static FRAME_PTR mouse_face_mouse_frame;
290static int mouse_face_mouse_x, mouse_face_mouse_y; 294static int mouse_face_mouse_x, mouse_face_mouse_y;
@@ -393,9 +397,34 @@ XTupdate_begin (f)
393 397
394 if (f == mouse_face_mouse_frame) 398 if (f == mouse_face_mouse_frame)
395 { 399 {
400 /* Don't do highlighting for mouse motion during the update. */
396 mouse_face_defer = 1; 401 mouse_face_defer = 1;
397 if (!NILP (mouse_face_window)) 402 if (!NILP (mouse_face_window))
398 clear_mouse_face (); 403 {
404 int firstline, lastline, i;
405 struct window *w = XWINDOW (mouse_face_window);
406
407 /* Find the first, and the last+1, lines affected by redisplay. */
408 for (firstline = 0; firstline < f->height; firstline++)
409 if (FRAME_DESIRED_GLYPHS (f)->enable[firstline])
410 break;
411
412 lastline = f->height;
413 for (i = f->height - 1; i >= 0; i--)
414 {
415 if (FRAME_DESIRED_GLYPHS (f)->enable[i])
416 break;
417 else
418 lastline = i;
419 }
420
421 /* Can we tell that this update does not affect the window
422 where the mouse highlight is? If so, no need to turn off. */
423 if (! (firstline > (XFASTINT (w->top) + window_internal_height (w))
424 || lastline < XFASTINT (w->top)))
425 /* Otherwise turn off the mouse highlight now. */
426 clear_mouse_face ();
427 }
399 } 428 }
400#ifndef HAVE_X11 429#ifndef HAVE_X11
401 dumpqueue (); 430 dumpqueue ();
@@ -438,14 +467,18 @@ XTupdate_end (f)
438 UNBLOCK_INPUT; 467 UNBLOCK_INPUT;
439} 468}
440 469
441/* This is called when all windows on frame F are now up to date. */ 470/* This is called after a redisplay on frame F. */
442 471
443static 472static
444XTframe_up_to_date (f) 473XTframe_up_to_date (f)
445 FRAME_PTR f; 474 FRAME_PTR f;
446{ 475{
447 if (f == mouse_face_mouse_frame) 476 if (mouse_face_deferred_gc || f == mouse_face_mouse_frame)
448 note_mouse_highlight (f, mouse_face_mouse_x, mouse_face_mouse_y); 477 {
478 note_mouse_highlight (mouse_face_mouse_frame,
479 mouse_face_mouse_x, mouse_face_mouse_y);
480 mouse_face_deferred_gc = 0;
481 }
449} 482}
450 483
451/* External interface to control of standout mode. 484/* External interface to control of standout mode.
@@ -1938,6 +1971,12 @@ note_mouse_highlight (f, x, y)
1938 if (mouse_face_defer) 1971 if (mouse_face_defer)
1939 return; 1972 return;
1940 1973
1974 if (gc_in_progress)
1975 {
1976 mouse_face_deferred_gc = 1;
1977 return;
1978 }
1979
1941 /* Find out which glyph the mouse is on. */ 1980 /* Find out which glyph the mouse is on. */
1942 pixel_to_glyph_coords (f, x, y, &column, &row, 1981 pixel_to_glyph_coords (f, x, y, &column, &row,
1943 &new_glyph, x_mouse_grabbed); 1982 &new_glyph, x_mouse_grabbed);
@@ -2135,19 +2174,29 @@ show_mouse_face (hl)
2135 int width = window_internal_width (w); 2174 int width = window_internal_width (w);
2136 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); 2175 FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
2137 int i; 2176 int i;
2177 int curs_x = f->phys_cursor_x;
2178 int curs_y = f->phys_cursor_y;
2179 int cursor_off = 0;
2138 2180
2139 fast_find_position (mouse_face_window, mouse_face_beg, 2181 fast_find_position (mouse_face_window, mouse_face_beg,
2140 &begcol, &begrow); 2182 &begcol, &begrow);
2141 fast_find_position (mouse_face_window, mouse_face_end, 2183 fast_find_position (mouse_face_window, mouse_face_end,
2142 &endcol, &endrow); 2184 &endcol, &endrow);
2143 2185
2144 x_display_cursor (f, 0);
2145
2146 for (i = begrow; i <= endrow; i++) 2186 for (i = begrow; i <= endrow; i++)
2147 { 2187 {
2148 int column = (i == begrow ? begcol : w->left); 2188 int column = (i == begrow ? begcol : w->left);
2149 int endcolumn = (i == endrow ? endcol : w->left + width); 2189 int endcolumn = (i == endrow ? endcol : w->left + width);
2150 endcolumn = min (endcolumn, FRAME_CURRENT_GLYPHS (f)->used[i] - w->left), 2190 endcolumn = min (endcolumn, FRAME_CURRENT_GLYPHS (f)->used[i] - w->left);
2191
2192 /* If the cursor's in the text we are about to rewrite,
2193 turn the cursor off. */
2194 if (i == curs_y
2195 && (curs_x >= begrow - 1 || curs_x <= endrow))
2196 {
2197 x_display_cursor (f, 0);
2198 cursor_off = 1;
2199 }
2151 2200
2152 dumpglyphs (f, 2201 dumpglyphs (f,
2153 CHAR_TO_PIXEL_COL (f, column), 2202 CHAR_TO_PIXEL_COL (f, column),
@@ -2158,7 +2207,9 @@ show_mouse_face (hl)
2158 hl > 0 ? 3 : 0); 2207 hl > 0 ? 3 : 0);
2159 } 2208 }
2160 2209
2161 x_display_cursor (f, 1); 2210 /* If we turned the cursor off, turn it back on. */
2211 if (cursor_off)
2212 x_display_cursor (f, 1);
2162} 2213}
2163 2214
2164/* Clear out the mouse-highlighted active region. 2215/* Clear out the mouse-highlighted active region.