*** w32fns.c.ori Tue Jul 16 18:58:06 2002 --- w32fns.c Wed Aug 28 12:14:16 2002 *************** *** 202,210 **** #define VIETNAMESE_CHARSET 163 #endif Lisp_Object Qauto_raise; Lisp_Object Qauto_lower; ! Lisp_Object Qbar, Qhbar; Lisp_Object Qborder_color; Lisp_Object Qborder_width; Lisp_Object Qbox; --- 202,213 ---- #define VIETNAMESE_CHARSET 163 #endif + /* How to blink the cursor off. */ + Lisp_Object Vblink_cursor_alist; + Lisp_Object Qauto_raise; Lisp_Object Qauto_lower; ! Lisp_Object Qbar, Qhbar, Qbox, Qhollow; Lisp_Object Qborder_color; Lisp_Object Qborder_width; Lisp_Object Qbox; *************** *** 2386,2396 **** } else if (NILP (arg)) type = NO_CURSOR; else ! /* Treat anything unknown as "box cursor". It was bad to signal an error; people have trouble fixing .Xdefaults with Emacs, when it has something bad in it. */ ! type = FILLED_BOX_CURSOR; return type; } --- 2389,2401 ---- } else if (NILP (arg)) type = NO_CURSOR; + else if (EQ (arg, Qbox)) + type = FILLED_BOX_CURSOR; else ! /* Treat anything unknown as "hollow box cursor". It was bad to signal an error; people have trouble fixing .Xdefaults with Emacs, when it has something bad in it. */ ! type = HOLLOW_BOX_CURSOR; return type; } *************** *** 2401,2413 **** Lisp_Object arg, oldval; { int width; ! FRAME_DESIRED_CURSOR (f) = x_specified_cursor_type (arg, &width); f->output_data.w32->cursor_width = width; /* Make sure the cursor gets redrawn. This is overkill, but how often do people change cursor types? */ update_mode_lines++; } void --- 2406,2439 ---- Lisp_Object arg, oldval; { int width; ! Lisp_Object tem; ! FRAME_DESIRED_CURSOR (f) = x_specified_cursor_type (arg, &width); f->output_data.w32->cursor_width = width; /* Make sure the cursor gets redrawn. This is overkill, but how often do people change cursor types? */ update_mode_lines++; + + /* By default, set up the blink-off state depending on the on-state. */ + + if (FRAME_DESIRED_CURSOR (f) == FILLED_BOX_CURSOR) + FRAME_BLINK_OFF_CURSOR (f) = HOLLOW_BOX_CURSOR; + else if (FRAME_DESIRED_CURSOR (f) == BAR_CURSOR && FRAME_CURSOR_WIDTH (f) > 1) + { + FRAME_BLINK_OFF_CURSOR (f) = BAR_CURSOR; + FRAME_BLINK_OFF_CURSOR_WIDTH (f) = 1; + } + else + FRAME_BLINK_OFF_CURSOR (f) = NO_CURSOR; + + tem = Fassoc (arg, Vblink_cursor_alist); + if (!NILP (tem)) + { + FRAME_BLINK_OFF_CURSOR (f) + = x_specified_cursor_type (XCDR (tem), &width); + f->output_data.w32->blink_off_cursor_width = width; + } } void *************** *** 14870,14875 **** --- 14896,14905 ---- staticpro (&Qbar); Qhbar = intern ("hbar"); staticpro (&Qhbar); + Qbox = intern ("box"); + staticpro (&Qbox); + Qhollow = intern ("hollow"); + staticpro (&Qhollow); Qborder_color = intern ("border-color"); staticpro (&Qborder_color); Qborder_width = intern ("border-width"); *************** *** 15110,15115 **** --- 15140,15153 ---- init_x_parm_symbols (); + DEFVAR_LISP ("blink-cursor-alist", &Vblink_cursor_alist, + doc: /* Alist specifying how to blink the cursor off. + Each element has the form (ON-STATE . OFF-STATE). Whenever the + `cursor-type' frame-parameter or variable equals ON-STATE, + comparing using `equal', Emacs uses OFF-STATE to specify + how to blink it off. */); + Vblink_cursor_alist = Qnil; + DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path, doc: /* List of directories to search for bitmap files for w32. */); Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH"); *** w32term.c.ori Mon Jul 15 10:48:32 2002 --- w32term.c Tue Aug 27 23:35:36 2002 *************** *** 401,406 **** --- 401,408 ---- enum text_cursor_kinds)); static void expose_frame P_ ((struct frame *, int, int, int, int)); static int expose_window_tree P_ ((struct window *, RECT *)); + static void expose_overlaps P_ ((struct window *, struct glyph_row *, + struct glyph_row *)); static int expose_window P_ ((struct window *, RECT *)); static void expose_area P_ ((struct window *, struct glyph_row *, RECT *, enum glyph_row_area)); *************** *** 5771,5776 **** --- 5773,5811 ---- } + /* Redraw those parts of glyphs rows during expose event handling that + overlap other rows. Redrawing of an exposed line writes over parts + of lines overlapping that exposed line; this function fixes that. + + W is the window being exposed. FIRST_OVERLAPPING_ROW is the first + row in W's current matrix that is exposed and overlaps other rows. + LAST_OVERLAPPING_ROW is the last such row. */ + + static void + expose_overlaps (w, first_overlapping_row, last_overlapping_row) + struct window *w; + struct glyph_row *first_overlapping_row; + struct glyph_row *last_overlapping_row; + { + struct glyph_row *row; + + for (row = first_overlapping_row; row <= last_overlapping_row; ++row) + if (row->overlapping_p) + { + xassert (row->enabled_p && !row->mode_line_p); + + if (row->used[LEFT_MARGIN_AREA]) + x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA); + + if (row->used[TEXT_AREA]) + x_fix_overlapping_area (w, row, TEXT_AREA); + + if (row->used[RIGHT_MARGIN_AREA]) + x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA); + } + } + + /* Redraw the part of window W intersection rectagle FR. Pixel coordinates in FR are frame relative. Call this function with input blocked. Value is non-zero if the exposure overwrites *************** *** 5812,5817 **** --- 5847,5853 ---- int yb = window_text_bottom_y (w); struct glyph_row *row; int cursor_cleared_p; + struct glyph_row *first_overlapping_row, *last_overlapping_row; TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", r.left, r.top, r.right, r.bottom)); *************** *** 5832,5838 **** else cursor_cleared_p = 0; ! /* Find the first row intersecting the rectangle R. */ for (row = w->current_matrix->rows; row->enabled_p; ++row) --- 5868,5875 ---- else cursor_cleared_p = 0; ! /* Update lines intersecting rectangle R. */ ! first_overlapping_row = last_overlapping_row = NULL; for (row = w->current_matrix->rows; row->enabled_p; ++row) *************** *** 5845,5850 **** --- 5882,5894 ---- || (r.top >= y0 && r.top < y1) || (r.bottom > y0 && r.bottom < y1)) { + if (row->overlapping_p) + { + if (first_overlapping_row == NULL) + first_overlapping_row = row; + last_overlapping_row = row; + } + if (expose_line (w, row, &r)) mouse_face_overwritten_p = 1; } *************** *** 5865,5870 **** --- 5909,5918 ---- if (!w->pseudo_window_p) { + /* Fix the display of overlapping rows. */ + if (first_overlapping_row) + expose_overlaps (w, first_overlapping_row, last_overlapping_row); + /* Draw border between windows. */ x_draw_vertical_border (w); *************** *** 9617,9623 **** cursor glyph at hand. */ if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA]) goto mark_cursor_off; ! /* If the cursor is in the mouse face area, redisplay that when we clear the cursor. */ if (! NILP (dpyinfo->mouse_face_window) --- 9665,9671 ---- cursor glyph at hand. */ if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA]) goto mark_cursor_off; ! /* If the cursor is in the mouse face area, redisplay that when we clear the cursor. */ if (! NILP (dpyinfo->mouse_face_window) *************** *** 9711,9716 **** --- 9759,9765 ---- struct frame *f = XFRAME (w->frame); int new_cursor_type; int new_cursor_width; + int cursor_off_state = 0; struct glyph_matrix *current_glyphs; struct glyph_row *glyph_row; struct glyph *glyph; *************** *** 9751,9810 **** the cursor type given by the frame parameter. If explicitly marked off, draw no cursor. In all other cases, we want a hollow box cursor. */ - cursor_non_selected - = !NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows, - w->buffer)); new_cursor_width = -1; if (cursor_in_echo_area && FRAME_HAS_MINIBUF_P (f) && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window)) { if (w == XWINDOW (echo_area_window)) new_cursor_type = FRAME_DESIRED_CURSOR (f); else ! { ! if (cursor_non_selected) ! new_cursor_type = HOLLOW_BOX_CURSOR; ! else ! new_cursor_type = NO_CURSOR; ! active_cursor = 0; ! } } - else - { - if (f != FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame - || w != XWINDOW (f->selected_window)) - { - active_cursor = 0; ! if (MINI_WINDOW_P (w) ! || !cursor_non_selected ! || NILP (XBUFFER (w->buffer)->cursor_type)) ! new_cursor_type = NO_CURSOR; ! else ! new_cursor_type = HOLLOW_BOX_CURSOR; ! } else ! { ! struct buffer *b = XBUFFER (w->buffer); ! if (EQ (b->cursor_type, Qt)) ! new_cursor_type = FRAME_DESIRED_CURSOR (f); ! else ! new_cursor_type = x_specified_cursor_type (b->cursor_type, ! &new_cursor_width); ! if (w->cursor_off_p) ! { ! if (new_cursor_type == FILLED_BOX_CURSOR) ! new_cursor_type = HOLLOW_BOX_CURSOR; ! else if (new_cursor_type == BAR_CURSOR && new_cursor_width > 1) ! new_cursor_width = 1; ! else ! new_cursor_type = NO_CURSOR; ! } } } /* If cursor is currently being shown and we don't want it to be or it is in the wrong place, or the cursor type is not what we want, erase it. */ --- 9800,9869 ---- the cursor type given by the frame parameter. If explicitly marked off, draw no cursor. In all other cases, we want a hollow box cursor. */ new_cursor_width = -1; + new_cursor_type = -2; + + /* Echo area */ if (cursor_in_echo_area && FRAME_HAS_MINIBUF_P (f) && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window)) { if (w == XWINDOW (echo_area_window)) new_cursor_type = FRAME_DESIRED_CURSOR (f); + else if (NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows, + w->buffer))) + new_cursor_type = NO_CURSOR; else ! cursor_off_state = 1; } ! /* Nonselected window or nonselected frame. */ ! else if (f != FRAME_X_DISPLAY_INFO (f)->w32_highlight_frame ! || w != XWINDOW (f->selected_window)) ! { ! if ((MINI_WINDOW_P (w) && minibuf_level == 0) ! || NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows, ! w->buffer)) ! || NILP (XBUFFER (w->buffer)->cursor_type)) ! new_cursor_type = NO_CURSOR; else ! cursor_off_state = 1; ! } ! /* If new_cursor_type isn't decided yet, decide it now. */ ! if (new_cursor_type == -2) ! { ! struct buffer *b = XBUFFER (w->buffer); ! ! if (EQ (b->cursor_type, Qt)) ! { ! new_cursor_type = FRAME_DESIRED_CURSOR (f); ! new_cursor_width = FRAME_CURSOR_WIDTH (f); } + else + new_cursor_type = x_specified_cursor_type (b->cursor_type, + &new_cursor_width); } + /* If cursor has blinked off, use the other specified state. */ + if (w->cursor_off_p) + { + new_cursor_type = FRAME_BLINK_OFF_CURSOR (f); + new_cursor_width = FRAME_BLINK_OFF_CURSOR_WIDTH (f); + } + /* Dim out or hollow out the cursor for nonselected windows. */ + if (cursor_off_state) + { + if (new_cursor_type == FILLED_BOX_CURSOR) + new_cursor_type = HOLLOW_BOX_CURSOR; + else if (new_cursor_type == BAR_CURSOR && new_cursor_width > 1) + new_cursor_width = 1; + else + new_cursor_type = NO_CURSOR; + } + + /* Now new_cursor_type is correct. */ + /* If cursor is currently being shown and we don't want it to be or it is in the wrong place, or the cursor type is not what we want, erase it. */ *************** *** 9817,9825 **** && new_cursor_width != w->phys_cursor_width))) x_erase_phys_cursor (w); ! /* If the cursor is now invisible and we want it to be visible, ! display it. */ ! if (on && !w->phys_cursor_on_p) { w->phys_cursor_ascent = glyph_row->ascent; w->phys_cursor_height = glyph_row->height; --- 9876,9887 ---- && new_cursor_width != w->phys_cursor_width))) x_erase_phys_cursor (w); ! /* Don't check phys_cursor_on_p here because that flag is only set ! to zero in some cases where we know that the cursor has been ! completely erased, to avoid the extra work of erasing the cursor ! twice. In other words, phys_cursor_on_p can be 1 and the cursor ! still not be visible, or it has only been partly erased. */ ! if (on) { w->phys_cursor_ascent = glyph_row->ascent; w->phys_cursor_height = glyph_row->height; *** w32term.h.ori Thu May 23 07:34:00 2002 --- w32term.h Tue Aug 27 23:23:31 2002 *************** *** 380,385 **** --- 380,392 ---- /* Width of bar cursor (if we are using that). */ int cursor_width; + /* What kind of text cursor should we draw when the cursor blinks off? + This can be filled_box_cursor or bar_cursor or no_cursor. */ + enum text_cursor_kinds blink_off_cursor; + + /* Width of bar cursor (if we are using that) for blink-off state. */ + int blink_off_cursor_width; + DWORD dwStyle; /* The size of the extra width currently allotted for vertical *************** *** 482,487 **** --- 489,497 ---- #define PIXEL_HEIGHT(f) ((f)->output_data.w32->pixel_height) #define FRAME_DESIRED_CURSOR(f) ((f)->output_data.w32->desired_cursor) + #define FRAME_BLINK_OFF_CURSOR(f) ((f)->output_data.w32->blink_off_cursor) + #define FRAME_CURSOR_WIDTH(f) ((f)->output_data.w32->cursor_width) + #define FRAME_BLINK_OFF_CURSOR_WIDTH(f) ((f)->output_data.w32->blink_off_cursor_width) /* Value is the smallest width of any character in any font on frame F. */ -----------------------------41184676334--