Mercurial > emacs
changeset 40384:25e6d4bb5f7f
(w32_system_caret_hwnd, w32_system_caret_width)
(w32_system_caret_height, w32_system_caret_x)
(w32_system_caret_y): New variables for tracking system caret.
(w32_initialize): Initialize them.
(x_display_and_set_cursor): Make system caret follow the active cursor.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Sat, 27 Oct 2001 22:21:24 +0000 |
parents | cfc82f90a7d4 |
children | b3dbd98f9b97 |
files | src/w32term.c |
diffstat | 1 files changed, 54 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/w32term.c Sat Oct 27 22:19:29 2001 +0000 +++ b/src/w32term.c Sat Oct 27 22:21:24 2001 +0000 @@ -214,6 +214,13 @@ struct cursor_pos output_cursor; +/* 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; + /* Flag to enable Unicode output in case users wish to use programs like Twinbridge on '95 rather than installed system level support for Far East languages. */ @@ -6460,6 +6467,9 @@ if (!WINDOWP (window)) return; + /* Reset help_echo. It will get recomputed below. */ + help_echo = Qnil; + /* Convert to window-relative pixel coordinates. */ w = XWINDOW (window); frame_to_window_pixel_xy (w, &x, &y); @@ -9482,6 +9492,7 @@ struct glyph_matrix *current_glyphs; struct glyph_row *glyph_row; struct glyph *glyph; + int active_cursor = 1; /* This is pointless on invisible frames, and dangerous on garbaged windows and frames; in the latter case, the frame or window may @@ -9525,7 +9536,10 @@ if (w == XWINDOW (echo_area_window)) new_cursor_type = FRAME_DESIRED_CURSOR (f); else - new_cursor_type = HOLLOW_BOX_CURSOR; + { + new_cursor_type = HOLLOW_BOX_CURSOR; + active_cursor = 0; + } } else { @@ -9533,6 +9547,7 @@ || w != XWINDOW (f->selected_window)) { extern int cursor_in_non_selected_windows; + active_cursor = 0; if (MINI_WINDOW_P (w) || !cursor_in_non_selected_windows @@ -9581,6 +9596,38 @@ 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 + system caret, so third party software like screen magnifiers + and speech synthesizers can follow the cursor. */ + if (active_cursor) + { + HWND hwnd = FRAME_W32_WINDOW (f); + + struct glyph * cursor_glyph = get_phys_cursor_glyph (w); + 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, NULL, NULL); + + 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, NULL, NULL); + } + switch (new_cursor_type) { case HOLLOW_BOX_CURSOR: @@ -10786,6 +10833,12 @@ off the bottom */ baud_rate = 19200; + 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; + last_tool_bar_item = -1; any_help_event_p = 0;