aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2020-01-21 18:23:32 +0200
committerEli Zaretskii2020-01-21 18:23:32 +0200
commit4aec94da379d956395668e68e07658a529ed3541 (patch)
treeeeb37c3b416d43d21e85f032d33962215efbbfe8 /src
parent5abd8d73b08f0ef57b1ddcab298fa7a3aff8f45c (diff)
downloademacs-4aec94da379d956395668e68e07658a529ed3541.tar.gz
emacs-4aec94da379d956395668e68e07658a529ed3541.zip
Avoid leaving artifacts when the system caret is used on w32
* src/xdisp.c (try_window_reusing_current_matrix, try_window_id): * src/dispnew.c (scrolling_window) [HAVE_NTGUI]: If w32-use-visible-system-caret is non-nil, disallow scrolling the display are in scroll_run_hook. This avoids copying traces of the caret, about which Emacs knows nothing, and thus considers those pixels show the default background. (Bug#39188) (gui_update_window_end): Block input only around part of the code, as we did before this code was extracted from backend-specific implementations. * src/w32term.c (w32_update_window_begin, w32_update_window_end): Only hide/show the caret when redisplaying the window where the caret is shown.
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c13
-rw-r--r--src/w32term.c6
-rw-r--r--src/xdisp.c17
3 files changed, 31 insertions, 5 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 9af1ce259d4..d094ca61798 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3743,11 +3743,10 @@ gui_update_window_end (struct window *w, bool cursor_on_p,
3743{ 3743{
3744 struct frame *f = XFRAME (WINDOW_FRAME (w)); 3744 struct frame *f = XFRAME (WINDOW_FRAME (w));
3745 3745
3746 block_input ();
3747
3748 /* Pseudo windows don't have cursors, so don't display them here. */ 3746 /* Pseudo windows don't have cursors, so don't display them here. */
3749 if (!w->pseudo_window_p) 3747 if (!w->pseudo_window_p)
3750 { 3748 {
3749 block_input ();
3751 3750
3752 if (cursor_on_p) 3751 if (cursor_on_p)
3753 display_and_set_cursor (w, true, 3752 display_and_set_cursor (w, true,
@@ -3761,6 +3760,7 @@ gui_update_window_end (struct window *w, bool cursor_on_p,
3761 else 3760 else
3762 gui_draw_vertical_border (w); 3761 gui_draw_vertical_border (w);
3763 } 3762 }
3763 unblock_input ();
3764 } 3764 }
3765 3765
3766 /* If a row with mouse-face was overwritten, arrange for 3766 /* If a row with mouse-face was overwritten, arrange for
@@ -3778,7 +3778,6 @@ gui_update_window_end (struct window *w, bool cursor_on_p,
3778 FRAME_RIF (f)->update_window_end_hook (w, 3778 FRAME_RIF (f)->update_window_end_hook (w,
3779 cursor_on_p, 3779 cursor_on_p,
3780 mouse_face_overwritten_p); 3780 mouse_face_overwritten_p);
3781 unblock_input ();
3782} 3781}
3783 3782
3784#endif /* HAVE_WINDOW_SYSTEM */ 3783#endif /* HAVE_WINDOW_SYSTEM */
@@ -4360,6 +4359,14 @@ scrolling_window (struct window *w, int tab_line_p)
4360 return 0; 4359 return 0;
4361#endif 4360#endif
4362 4361
4362 /* Can't scroll the display of w32 GUI frames when position of point
4363 is indicated by the system caret, because scrolling the display
4364 will then "copy" the pixles used by the caret. */
4365#ifdef HAVE_NTGUI
4366 if (w32_use_visible_system_caret)
4367 return 0;
4368#endif
4369
4363 /* Give up if some rows in the desired matrix are not enabled. */ 4370 /* Give up if some rows in the desired matrix are not enabled. */
4364 if (! MATRIX_ROW_ENABLED_P (desired_matrix, i)) 4371 if (! MATRIX_ROW_ENABLED_P (desired_matrix, i))
4365 return -1; 4372 return -1;
diff --git a/src/w32term.c b/src/w32term.c
index c38e7409d90..4eb5045fc5b 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -560,7 +560,8 @@ static void
560w32_update_window_begin (struct window *w) 560w32_update_window_begin (struct window *w)
561{ 561{
562 /* Hide the system caret during an update. */ 562 /* Hide the system caret during an update. */
563 if (w32_use_visible_system_caret && w32_system_caret_hwnd) 563 if (w32_use_visible_system_caret && w32_system_caret_hwnd
564 && w == w32_system_caret_window)
564 { 565 {
565 SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0, 566 SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0,
566 0, 6000, NULL); 567 0, 6000, NULL);
@@ -657,7 +658,8 @@ w32_update_window_end (struct window *w, bool cursor_on_p,
657 /* Unhide the caret. This won't actually show the cursor, unless it 658 /* Unhide the caret. This won't actually show the cursor, unless it
658 was visible before the corresponding call to HideCaret in 659 was visible before the corresponding call to HideCaret in
659 w32_update_window_begin. */ 660 w32_update_window_begin. */
660 if (w32_use_visible_system_caret && w32_system_caret_hwnd) 661 if (w32_use_visible_system_caret && w32_system_caret_hwnd
662 && w == w32_system_caret_window)
661 { 663 {
662 SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0, 664 SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0,
663 0, 6000, NULL); 665 0, 6000, NULL);
diff --git a/src/xdisp.c b/src/xdisp.c
index 5b21aaa85a9..6d4c4d3dcf7 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -19191,6 +19191,14 @@ try_window_reusing_current_matrix (struct window *w)
19191 if (!NILP (Vdisplay_line_numbers)) 19191 if (!NILP (Vdisplay_line_numbers))
19192 return false; 19192 return false;
19193 19193
19194 /* Can't scroll the display of w32 GUI frames when position of point
19195 is indicated by the system caret, because scrolling the display
19196 will then "copy" the pixles used by the caret. */
19197#ifdef HAVE_NTGUI
19198 if (w32_use_visible_system_caret)
19199 return false;
19200#endif
19201
19194 /* The variable new_start now holds the new window start. The old 19202 /* The variable new_start now holds the new window start. The old
19195 start `start' can be determined from the current matrix. */ 19203 start `start' can be determined from the current matrix. */
19196 SET_TEXT_POS_FROM_MARKER (new_start, w->start); 19204 SET_TEXT_POS_FROM_MARKER (new_start, w->start);
@@ -20175,6 +20183,15 @@ try_window_id (struct window *w)
20175 if (MATRIX_ROW_START_CHARPOS (row) == MATRIX_ROW_END_CHARPOS (row)) 20183 if (MATRIX_ROW_START_CHARPOS (row) == MATRIX_ROW_END_CHARPOS (row))
20176 GIVE_UP (20); 20184 GIVE_UP (20);
20177 20185
20186 /* Can't let scroll_run_hook below run on w32 GUI frames when
20187 position of point is indicated by the system caret, because
20188 scrolling the display will then "copy" the pixles used by the
20189 caret. */
20190#ifdef HAVE_NTGUI
20191 if (FRAME_W32_P (f) && w32_use_visible_system_caret)
20192 GIVE_UP (25);
20193#endif
20194
20178 /* Compute the position at which we have to start displaying new 20195 /* Compute the position at which we have to start displaying new
20179 lines. Some of the lines at the top of the window might be 20196 lines. Some of the lines at the top of the window might be
20180 reusable because they are not displaying changed text. Find the 20197 reusable because they are not displaying changed text. Find the