aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32term.c
diff options
context:
space:
mode:
authorAlexander Gramiak2019-04-27 15:00:13 -0600
committerAlexander Gramiak2019-05-02 21:16:43 -0600
commit9ae94ebdfa80cf3983c254696b5ab998f7296aec (patch)
tree364c8c2dad661c4a5c7c735677e0bb0ed8775aec /src/w32term.c
parentd17ae7f5afb851a26a957bd7d1765aae6d08fe1d (diff)
downloademacs-9ae94ebdfa80cf3983c254696b5ab998f7296aec.tar.gz
emacs-9ae94ebdfa80cf3983c254696b5ab998f7296aec.zip
Refactor update_window_begin and update_window_end hooks
Bug#35464. * src/dispnew.c (gui_update_window_begin, gui_update_window_end): New procedures implementing common functionality. * src/nsterm.m: (ns_update_window_begin, ns_update_window_end): * src/xterm.c: (x_update_window_begin, x_update_window_end): Remove in favor of only using the new generic versions. * src/w32term.c: (w32_update_window_begin, w32_update_window_end): Remove duplicated and unused code.
Diffstat (limited to 'src/w32term.c')
-rw-r--r--src/w32term.c83
1 files changed, 3 insertions, 80 deletions
diff --git a/src/w32term.c b/src/w32term.c
index 451dd54dd8a..0abec3d92a7 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -529,7 +529,7 @@ w32_display_pixel_width (struct w32_display_info *dpyinfo)
529 529
530/* Start an update of frame F. This function is installed as a hook 530/* Start an update of frame F. This function is installed as a hook
531 for update_begin, i.e. it is called when update_begin is called. 531 for update_begin, i.e. it is called when update_begin is called.
532 This function is called prior to calls to w32_update_window_begin 532 This function is called prior to calls to gui_update_window_begin
533 for each window being updated. */ 533 for each window being updated. */
534 534
535static void 535static void
@@ -555,58 +555,12 @@ w32_update_begin (struct frame *f)
555static void 555static void
556w32_update_window_begin (struct window *w) 556w32_update_window_begin (struct window *w)
557{ 557{
558 struct frame *f = XFRAME (WINDOW_FRAME (w));
559 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
560
561 /* Hide the system caret during an update. */ 558 /* Hide the system caret during an update. */
562 if (w32_use_visible_system_caret && w32_system_caret_hwnd) 559 if (w32_use_visible_system_caret && w32_system_caret_hwnd)
563 { 560 {
564 SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0, 561 SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0,
565 0, 6000, NULL); 562 0, 6000, NULL);
566 } 563 }
567
568 w->output_cursor = w->cursor;
569
570 block_input ();
571
572 if (f == hlinfo->mouse_face_mouse_frame)
573 {
574 /* Don't do highlighting for mouse motion during the update. */
575 hlinfo->mouse_face_defer = true;
576
577 /* If F needs to be redrawn, simply forget about any prior mouse
578 highlighting. */
579 if (FRAME_GARBAGED_P (f))
580 hlinfo->mouse_face_window = Qnil;
581
582#if 0 /* Rows in a current matrix containing glyphs in mouse-face have
583 their mouse_face_p flag set, which means that they are always
584 unequal to rows in a desired matrix which never have that
585 flag set. So, rows containing mouse-face glyphs are never
586 scrolled, and we don't have to switch the mouse highlight off
587 here to prevent it from being scrolled. */
588
589 /* Can we tell that this update does not affect the window
590 where the mouse highlight is? If so, no need to turn off.
591 Likewise, don't do anything if the frame is garbaged;
592 in that case, the frame's current matrix that we would use
593 is all wrong, and we will redisplay that line anyway. */
594 if (!NILP (hlinfo->mouse_face_window)
595 && w == XWINDOW (hlinfo->mouse_face_window))
596 {
597 int i;
598
599 for (i = 0; i < w->desired_matrix->nrows; ++i)
600 if (MATRIX_ROW_ENABLED_P (w->desired_matrix, i))
601 break;
602
603 if (i < w->desired_matrix->nrows)
604 clear_mouse_face (hlinfo);
605 }
606#endif /* 0 */
607 }
608
609 unblock_input ();
610} 564}
611 565
612/* Draw a vertical window border from (x,y0) to (x,y1) */ 566/* Draw a vertical window border from (x,y0) to (x,y1) */
@@ -694,39 +648,8 @@ w32_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1)
694 648
695static void 649static void
696w32_update_window_end (struct window *w, bool cursor_on_p, 650w32_update_window_end (struct window *w, bool cursor_on_p,
697 bool mouse_face_overwritten_p) 651 bool mouse_face_overwritten_p)
698{ 652{
699 if (!w->pseudo_window_p)
700 {
701 block_input ();
702
703 if (cursor_on_p)
704 display_and_set_cursor (w, true,
705 w->output_cursor.hpos, w->output_cursor.vpos,
706 w->output_cursor.x, w->output_cursor.y);
707
708 if (draw_window_fringes (w, true))
709 {
710 if (WINDOW_RIGHT_DIVIDER_WIDTH (w))
711 gui_draw_right_divider (w);
712 else
713 gui_draw_vertical_border (w);
714 }
715
716 unblock_input ();
717 }
718
719 /* If a row with mouse-face was overwritten, arrange for
720 XTframe_up_to_date to redisplay the mouse highlight. */
721 if (mouse_face_overwritten_p)
722 {
723 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
724
725 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
726 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
727 hlinfo->mouse_face_window = Qnil;
728 }
729
730 /* Unhide the caret. This won't actually show the cursor, unless it 653 /* Unhide the caret. This won't actually show the cursor, unless it
731 was visible before the corresponding call to HideCaret in 654 was visible before the corresponding call to HideCaret in
732 w32_update_window_begin. */ 655 w32_update_window_begin. */
@@ -2859,7 +2782,7 @@ w32_scroll_run (struct window *w, struct run *run)
2859 2782
2860 block_input (); 2783 block_input ();
2861 2784
2862 /* Cursor off. Will be switched on again in w32_update_window_end. */ 2785 /* Cursor off. Will be switched on again in gui_update_window_end. */
2863 gui_clear_cursor (w); 2786 gui_clear_cursor (w);
2864 2787
2865 { 2788 {