Mercurial > emacs
changeset 42864:c1af6a7f3dd4
(w32_system_caret_width): Remove.
(w32_use_visible_system_caret): New user flag.
(syms_of_w32term): DEFVAR_BOOL it. Initialize based on whether
Windows reports a screen reader running.
(x_update_window_begin): Hide the system caret.
(x_update_window_end): Show the system caret.
(x_display_and_set_cursor): Don't draw a cursor when
w32_use_visible_system_caret is set. Do not adjust width.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Sun, 20 Jan 2002 23:11:52 +0000 |
parents | cff9c12217fd |
children | 40d08b8571ec |
files | src/w32term.c |
diffstat | 1 files changed, 58 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/src/w32term.c Sun Jan 20 23:10:35 2002 +0000 +++ b/src/w32term.c Sun Jan 20 23:11:52 2002 +0000 @@ -222,10 +222,10 @@ /* The handle of the frame that currently owns the system caret. */ HWND w32_system_caret_hwnd; -int w32_system_caret_width; int w32_system_caret_height; int w32_system_caret_x; int w32_system_caret_y; +int w32_use_visible_system_caret; /* Flag to enable Unicode output in case users wish to use programs like Twinbridge on '95 rather than installed system level support @@ -593,6 +593,9 @@ struct frame *f = XFRAME (WINDOW_FRAME (w)); struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); + /* Hide the system caret during an update. */ + SendMessage (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0); + updated_window = w; set_output_cursor (&w->cursor); @@ -714,6 +717,11 @@ dpyinfo->mouse_face_window = Qnil; } + /* Unhide the caret. This won't actually show the cursor, unless it + was visible before the corresponding call to HideCaret in + x_update_window_begin. */ + SendMessage (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0); + updated_window = NULL; } @@ -9690,7 +9698,19 @@ w->phys_cursor.y = glyph_row->y; w->phys_cursor.hpos = hpos; w->phys_cursor.vpos = vpos; - w->phys_cursor_type = new_cursor_type; + + /* If the user wants to use the system caret, make sure our own + cursor remains invisible. */ + if (w32_use_visible_system_caret) + { + if (w->phys_cursor_type != NO_CURSOR) + x_erase_phys_cursor (w); + + new_cursor_type = w->phys_cursor_type = NO_CURSOR; + } + else + w->phys_cursor_type = new_cursor_type; + w->phys_cursor_on_p = 1; /* If this is the active cursor, we need to track it with the @@ -9698,33 +9718,24 @@ and speech synthesizers can follow the cursor. */ if (active_cursor) { - struct glyph * cursor_glyph = get_phys_cursor_glyph (w); - if (cursor_glyph) - { - HWND hwnd = FRAME_W32_WINDOW (f); - int caret_width = cursor_glyph->pixel_width; - w32_system_caret_x - = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); - w32_system_caret_y - = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) - + glyph_row->ascent - w->phys_cursor_ascent); - - /* If the size of the active cursor changed, destroy the old - system caret. */ - if (w32_system_caret_hwnd - && (w32_system_caret_height != w->phys_cursor_height - || w32_system_caret_width != caret_width)) - PostMessage (hwnd, WM_EMACS_DESTROY_CARET, 0, 0); - - if (!w32_system_caret_hwnd) - { - w32_system_caret_height = w->phys_cursor_height; - w32_system_caret_width = caret_width; - } - - /* Move the system caret. */ - PostMessage (hwnd, WM_EMACS_TRACK_CARET, 0, 0); - } + HWND hwnd = FRAME_W32_WINDOW (f); + + w32_system_caret_x + = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); + w32_system_caret_y + = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) + + glyph_row->ascent - w->phys_cursor_ascent); + + /* If the size of the active cursor changed, destroy the old + system caret. */ + if (w32_system_caret_hwnd + && (w32_system_caret_height != w->phys_cursor_height)) + PostMessage (hwnd, WM_EMACS_DESTROY_CARET, 0, 0); + + w32_system_caret_height = w->phys_cursor_height; + + /* Move the system caret. */ + PostMessage (hwnd, WM_EMACS_TRACK_CARET, 0, 0); } switch (new_cursor_type) @@ -11019,7 +11030,6 @@ w32_system_caret_hwnd = NULL; w32_system_caret_height = 0; - w32_system_caret_width = 0; w32_system_caret_x = 0; w32_system_caret_y = 0; @@ -11153,6 +11163,24 @@ staticpro (&previous_help_echo); help_echo_pos = -1; + DEFVAR_BOOL ("w32-use-visible-system-caret", + &w32_use_visible_system_caret, + doc: /* Flag to make the system caret visible. +When this is non-nil, Emacs will indicate the position of point by +using the system caret instead of drawing its own cursor. Some screen +reader software does not track the system cursor properly when it is +invisible, and gets confused by Emacs drawing its own cursor, so this +variable is initialized to t when Emacs detects that screen reader +software is running as it starts up. + +When this variable is set, other variables affecting the appearance of +the cursor have no effect. */); + + /* Initialize w32_use_visible_system_caret based on whether a screen + reader is in use. */ + SystemParametersInfo (SPI_GETSCREENREADER, 0, + &w32_use_visible_system_caret, 0); + DEFVAR_BOOL ("x-stretch-cursor", &x_stretch_cursor_p, doc: /* *Non-nil means draw block cursor as wide as the glyph under it. For example, if a block cursor is over a tab, it will be drawn as