aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2002-08-30 12:05:04 +0000
committerKim F. Storm2002-08-30 12:05:04 +0000
commitfdbe859cfbccfa746642d524c582bd86bc86c383 (patch)
tree6ae63efde1b7d40e64e796cdd9496937db755c87 /src
parent33b2311e862c021a5dc956e2bc1335735bf8b8aa (diff)
downloademacs-fdbe859cfbccfa746642d524c582bd86bc86c383.tar.gz
emacs-fdbe859cfbccfa746642d524c582bd86bc86c383.zip
(x_specified_cursor_type): Remove prototype.
(x_draw_bar_cursor): Use FRAME_CURSOR_WIDTH. (x_display_and_set_cursor): Use get_window_cursor_type. Remove unused local variables cursor_off_state. Redraw cursor if hbar cursor width changes.
Diffstat (limited to 'src')
-rw-r--r--src/w32term.c76
-rw-r--r--src/xterm.c76
2 files changed, 8 insertions, 144 deletions
diff --git a/src/w32term.c b/src/w32term.c
index 87a4b2156b0..64643dadc77 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -9537,7 +9537,7 @@ x_draw_bar_cursor (w, row, width, kind)
9537 struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id); 9537 struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id);
9538 9538
9539 if (width < 0) 9539 if (width < 0)
9540 width = f->output_data.w32->cursor_width; 9540 width = FRAME_CURSOR_WIDTH (f);
9541 width = min (cursor_glyph->pixel_width, width); 9541 width = min (cursor_glyph->pixel_width, width);
9542 9542
9543 /* If the glyph's background equals the color we normally draw 9543 /* If the glyph's background equals the color we normally draw
@@ -9759,7 +9759,6 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
9759 struct frame *f = XFRAME (w->frame); 9759 struct frame *f = XFRAME (w->frame);
9760 int new_cursor_type; 9760 int new_cursor_type;
9761 int new_cursor_width; 9761 int new_cursor_width;
9762 int cursor_off_state = 0;
9763 struct glyph_matrix *current_glyphs; 9762 struct glyph_matrix *current_glyphs;
9764 struct glyph_row *glyph_row; 9763 struct glyph_row *glyph_row;
9765 struct glyph *glyph; 9764 struct glyph *glyph;
@@ -9794,75 +9793,8 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
9794 9793
9795 xassert (interrupt_input_blocked); 9794 xassert (interrupt_input_blocked);
9796 9795
9797 /* Set new_cursor_type to the cursor we want to be displayed. In a 9796 /* Set new_cursor_type to the cursor we want to be displayed. */
9798 mini-buffer window, we want the cursor only to appear if we are 9797 new_cursor_type = get_window_cursor_type (w, &new_cursor_width);
9799 reading input from this window. For the selected window, we want
9800 the cursor type given by the frame parameter. If explicitly
9801 marked off, draw no cursor. In all other cases, we want a hollow
9802 box cursor. */
9803 new_cursor_width = -1;
9804 new_cursor_type = -2;
9805
9806 /* Echo area */
9807 if (cursor_in_echo_area
9808 && FRAME_HAS_MINIBUF_P (f)
9809 && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window))
9810 {
9811 if (w == XWINDOW (echo_area_window))
9812 new_cursor_type = FRAME_DESIRED_CURSOR (f);
9813 else if (NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows,
9814 w->buffer)))
9815 new_cursor_type = NO_CURSOR;
9816 else
9817 cursor_off_state = 1;
9818 }
9819
9820 /* Nonselected window or nonselected frame. */
9821 else if (f != FRAME_X_DISPLAY_INFO (f)->w32_highlight_frame
9822 || w != XWINDOW (f->selected_window))
9823 {
9824 if ((MINI_WINDOW_P (w) && minibuf_level == 0)
9825 || NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows,
9826 w->buffer))
9827 || NILP (XBUFFER (w->buffer)->cursor_type))
9828 new_cursor_type = NO_CURSOR;
9829 else
9830 cursor_off_state = 1;
9831 }
9832
9833 /* If new_cursor_type isn't decided yet, decide it now. */
9834 if (new_cursor_type == -2)
9835 {
9836 struct buffer *b = XBUFFER (w->buffer);
9837
9838 if (EQ (b->cursor_type, Qt))
9839 {
9840 new_cursor_type = FRAME_DESIRED_CURSOR (f);
9841 new_cursor_width = FRAME_CURSOR_WIDTH (f);
9842 }
9843 else
9844 new_cursor_type = x_specified_cursor_type (b->cursor_type,
9845 &new_cursor_width);
9846 }
9847
9848 /* If cursor has blinked off, use the other specified state. */
9849 if (w->cursor_off_p)
9850 {
9851 new_cursor_type = FRAME_BLINK_OFF_CURSOR (f);
9852 new_cursor_width = FRAME_BLINK_OFF_CURSOR_WIDTH (f);
9853 }
9854 /* Dim out or hollow out the cursor for nonselected windows. */
9855 if (cursor_off_state)
9856 {
9857 if (new_cursor_type == FILLED_BOX_CURSOR)
9858 new_cursor_type = HOLLOW_BOX_CURSOR;
9859 else if (new_cursor_type == BAR_CURSOR && new_cursor_width > 1)
9860 new_cursor_width = 1;
9861 else
9862 new_cursor_type = NO_CURSOR;
9863 }
9864
9865 /* Now new_cursor_type is correct. */
9866 9798
9867 /* If cursor is currently being shown and we don't want it to be or 9799 /* If cursor is currently being shown and we don't want it to be or
9868 it is in the wrong place, or the cursor type is not what we want, 9800 it is in the wrong place, or the cursor type is not what we want,
@@ -9872,7 +9804,7 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
9872 || w->phys_cursor.x != x 9804 || w->phys_cursor.x != x
9873 || w->phys_cursor.y != y 9805 || w->phys_cursor.y != y
9874 || new_cursor_type != w->phys_cursor_type 9806 || new_cursor_type != w->phys_cursor_type
9875 || (new_cursor_type == BAR_CURSOR 9807 || ((new_cursor_type == BAR_CURSOR || new_cursor_type == HBAR_CURSOR)
9876 && new_cursor_width != w->phys_cursor_width))) 9808 && new_cursor_width != w->phys_cursor_width)))
9877 x_erase_phys_cursor (w); 9809 x_erase_phys_cursor (w);
9878 9810
diff --git a/src/xterm.c b/src/xterm.c
index 1830df51211..d3ec8179aaa 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -11594,7 +11594,7 @@ x_draw_bar_cursor (w, row, width, kind)
11594 } 11594 }
11595 11595
11596 if (width < 0) 11596 if (width < 0)
11597 width = f->output_data.x->cursor_width; 11597 width = FRAME_CURSOR_WIDTH (f);
11598 width = min (cursor_glyph->pixel_width, width); 11598 width = min (cursor_glyph->pixel_width, width);
11599 11599
11600 w->phys_cursor_width = width; 11600 w->phys_cursor_width = width;
@@ -11810,7 +11810,6 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
11810 struct frame *f = XFRAME (w->frame); 11810 struct frame *f = XFRAME (w->frame);
11811 int new_cursor_type; 11811 int new_cursor_type;
11812 int new_cursor_width; 11812 int new_cursor_width;
11813 int cursor_off_state = 0;
11814 struct glyph_matrix *current_glyphs; 11813 struct glyph_matrix *current_glyphs;
11815 struct glyph_row *glyph_row; 11814 struct glyph_row *glyph_row;
11816 struct glyph *glyph; 11815 struct glyph *glyph;
@@ -11843,75 +11842,8 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
11843 11842
11844 xassert (interrupt_input_blocked); 11843 xassert (interrupt_input_blocked);
11845 11844
11846 /* Set new_cursor_type to the cursor we want to be displayed. In a 11845 /* Set new_cursor_type to the cursor we want to be displayed. */
11847 mini-buffer window, we want the cursor only to appear if we are 11846 new_cursor_type = get_window_cursor_type (w, &new_cursor_width);
11848 reading input from this window. For the selected window, we want
11849 the cursor type given by the frame parameter. If explicitly
11850 marked off, draw no cursor. In all other cases, we want a hollow
11851 box cursor. */
11852 new_cursor_width = -1;
11853 new_cursor_type = -2;
11854
11855 /* Echo area */
11856 if (cursor_in_echo_area
11857 && FRAME_HAS_MINIBUF_P (f)
11858 && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window))
11859 {
11860 if (w == XWINDOW (echo_area_window))
11861 new_cursor_type = FRAME_DESIRED_CURSOR (f);
11862 else if (NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows,
11863 w->buffer)))
11864 new_cursor_type = NO_CURSOR;
11865 else
11866 cursor_off_state = 1;
11867 }
11868
11869 /* Nonselected window or nonselected frame. */
11870 else if (f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame
11871 || w != XWINDOW (f->selected_window))
11872 {
11873 if ((MINI_WINDOW_P (w) && minibuf_level == 0)
11874 || NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows,
11875 w->buffer))
11876 || NILP (XBUFFER (w->buffer)->cursor_type))
11877 new_cursor_type = NO_CURSOR;
11878 else
11879 cursor_off_state = 1;
11880 }
11881
11882 /* If new_cursor_type isn't decided yet, decide it now. */
11883 if (new_cursor_type == -2)
11884 {
11885 struct buffer *b = XBUFFER (w->buffer);
11886
11887 if (EQ (b->cursor_type, Qt))
11888 {
11889 new_cursor_type = FRAME_DESIRED_CURSOR (f);
11890 new_cursor_width = FRAME_CURSOR_WIDTH (f);
11891 }
11892 else
11893 new_cursor_type = x_specified_cursor_type (b->cursor_type,
11894 &new_cursor_width);
11895 }
11896
11897 /* If cursor has blinked off, use the other specified state. */
11898 if (w->cursor_off_p)
11899 {
11900 new_cursor_type = FRAME_BLINK_OFF_CURSOR (f);
11901 new_cursor_width = FRAME_BLINK_OFF_CURSOR_WIDTH (f);
11902 }
11903 /* Dim out or hollow out the cursor for nonselected windows. */
11904 if (cursor_off_state)
11905 {
11906 if (new_cursor_type == FILLED_BOX_CURSOR)
11907 new_cursor_type = HOLLOW_BOX_CURSOR;
11908 else if (new_cursor_type == BAR_CURSOR && new_cursor_width > 1)
11909 new_cursor_width = 1;
11910 else
11911 new_cursor_type = NO_CURSOR;
11912 }
11913
11914 /* Now new_cursor_type is correct. */
11915 11847
11916 /* If cursor is currently being shown and we don't want it to be or 11848 /* If cursor is currently being shown and we don't want it to be or
11917 it is in the wrong place, or the cursor type is not what we want, 11849 it is in the wrong place, or the cursor type is not what we want,
@@ -11921,7 +11853,7 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
11921 || w->phys_cursor.x != x 11853 || w->phys_cursor.x != x
11922 || w->phys_cursor.y != y 11854 || w->phys_cursor.y != y
11923 || new_cursor_type != w->phys_cursor_type 11855 || new_cursor_type != w->phys_cursor_type
11924 || (new_cursor_type == BAR_CURSOR 11856 || ((new_cursor_type == BAR_CURSOR || new_cursor_type == HBAR_CURSOR)
11925 && new_cursor_width != w->phys_cursor_width))) 11857 && new_cursor_width != w->phys_cursor_width)))
11926 x_erase_phys_cursor (w); 11858 x_erase_phys_cursor (w);
11927 11859