diff options
| author | Jason Rumney | 2002-01-20 23:11:52 +0000 |
|---|---|---|
| committer | Jason Rumney | 2002-01-20 23:11:52 +0000 |
| commit | 99558ce8851c56c6e9c481a70c9a2feea57d22d4 (patch) | |
| tree | 3f0584b3ec9777cc6043bea73cc43693dcc2e242 /src | |
| parent | ab8b2d20639d5e72541f65c22c8d68c3d9e8c8ce (diff) | |
| download | emacs-99558ce8851c56c6e9c481a70c9a2feea57d22d4.tar.gz emacs-99558ce8851c56c6e9c481a70c9a2feea57d22d4.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32term.c | 86 |
1 files changed, 57 insertions, 29 deletions
diff --git a/src/w32term.c b/src/w32term.c index e25a270fc1d..9648758d7c7 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -222,10 +222,10 @@ struct cursor_pos output_cursor; | |||
| 222 | 222 | ||
| 223 | /* The handle of the frame that currently owns the system caret. */ | 223 | /* The handle of the frame that currently owns the system caret. */ |
| 224 | HWND w32_system_caret_hwnd; | 224 | HWND w32_system_caret_hwnd; |
| 225 | int w32_system_caret_width; | ||
| 226 | int w32_system_caret_height; | 225 | int w32_system_caret_height; |
| 227 | int w32_system_caret_x; | 226 | int w32_system_caret_x; |
| 228 | int w32_system_caret_y; | 227 | int w32_system_caret_y; |
| 228 | int w32_use_visible_system_caret; | ||
| 229 | 229 | ||
| 230 | /* Flag to enable Unicode output in case users wish to use programs | 230 | /* Flag to enable Unicode output in case users wish to use programs |
| 231 | like Twinbridge on '95 rather than installed system level support | 231 | like Twinbridge on '95 rather than installed system level support |
| @@ -593,6 +593,9 @@ x_update_window_begin (w) | |||
| 593 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 593 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 594 | struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); | 594 | struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); |
| 595 | 595 | ||
| 596 | /* Hide the system caret during an update. */ | ||
| 597 | SendMessage (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0); | ||
| 598 | |||
| 596 | updated_window = w; | 599 | updated_window = w; |
| 597 | set_output_cursor (&w->cursor); | 600 | set_output_cursor (&w->cursor); |
| 598 | 601 | ||
| @@ -714,6 +717,11 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p) | |||
| 714 | dpyinfo->mouse_face_window = Qnil; | 717 | dpyinfo->mouse_face_window = Qnil; |
| 715 | } | 718 | } |
| 716 | 719 | ||
| 720 | /* Unhide the caret. This won't actually show the cursor, unless it | ||
| 721 | was visible before the corresponding call to HideCaret in | ||
| 722 | x_update_window_begin. */ | ||
| 723 | SendMessage (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0); | ||
| 724 | |||
| 717 | updated_window = NULL; | 725 | updated_window = NULL; |
| 718 | } | 726 | } |
| 719 | 727 | ||
| @@ -9690,7 +9698,19 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y) | |||
| 9690 | w->phys_cursor.y = glyph_row->y; | 9698 | w->phys_cursor.y = glyph_row->y; |
| 9691 | w->phys_cursor.hpos = hpos; | 9699 | w->phys_cursor.hpos = hpos; |
| 9692 | w->phys_cursor.vpos = vpos; | 9700 | w->phys_cursor.vpos = vpos; |
| 9693 | w->phys_cursor_type = new_cursor_type; | 9701 | |
| 9702 | /* If the user wants to use the system caret, make sure our own | ||
| 9703 | cursor remains invisible. */ | ||
| 9704 | if (w32_use_visible_system_caret) | ||
| 9705 | { | ||
| 9706 | if (w->phys_cursor_type != NO_CURSOR) | ||
| 9707 | x_erase_phys_cursor (w); | ||
| 9708 | |||
| 9709 | new_cursor_type = w->phys_cursor_type = NO_CURSOR; | ||
| 9710 | } | ||
| 9711 | else | ||
| 9712 | w->phys_cursor_type = new_cursor_type; | ||
| 9713 | |||
| 9694 | w->phys_cursor_on_p = 1; | 9714 | w->phys_cursor_on_p = 1; |
| 9695 | 9715 | ||
| 9696 | /* If this is the active cursor, we need to track it with the | 9716 | /* If this is the active cursor, we need to track it with the |
| @@ -9698,33 +9718,24 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y) | |||
| 9698 | and speech synthesizers can follow the cursor. */ | 9718 | and speech synthesizers can follow the cursor. */ |
| 9699 | if (active_cursor) | 9719 | if (active_cursor) |
| 9700 | { | 9720 | { |
| 9701 | struct glyph * cursor_glyph = get_phys_cursor_glyph (w); | 9721 | HWND hwnd = FRAME_W32_WINDOW (f); |
| 9702 | if (cursor_glyph) | ||
| 9703 | { | ||
| 9704 | HWND hwnd = FRAME_W32_WINDOW (f); | ||
| 9705 | int caret_width = cursor_glyph->pixel_width; | ||
| 9706 | w32_system_caret_x | ||
| 9707 | = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | ||
| 9708 | w32_system_caret_y | ||
| 9709 | = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) | ||
| 9710 | + glyph_row->ascent - w->phys_cursor_ascent); | ||
| 9711 | |||
| 9712 | /* If the size of the active cursor changed, destroy the old | ||
| 9713 | system caret. */ | ||
| 9714 | if (w32_system_caret_hwnd | ||
| 9715 | && (w32_system_caret_height != w->phys_cursor_height | ||
| 9716 | || w32_system_caret_width != caret_width)) | ||
| 9717 | PostMessage (hwnd, WM_EMACS_DESTROY_CARET, 0, 0); | ||
| 9718 | |||
| 9719 | if (!w32_system_caret_hwnd) | ||
| 9720 | { | ||
| 9721 | w32_system_caret_height = w->phys_cursor_height; | ||
| 9722 | w32_system_caret_width = caret_width; | ||
| 9723 | } | ||
| 9724 | 9722 | ||
| 9725 | /* Move the system caret. */ | 9723 | w32_system_caret_x |
| 9726 | PostMessage (hwnd, WM_EMACS_TRACK_CARET, 0, 0); | 9724 | = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); |
| 9727 | } | 9725 | w32_system_caret_y |
| 9726 | = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) | ||
| 9727 | + glyph_row->ascent - w->phys_cursor_ascent); | ||
| 9728 | |||
| 9729 | /* If the size of the active cursor changed, destroy the old | ||
| 9730 | system caret. */ | ||
| 9731 | if (w32_system_caret_hwnd | ||
| 9732 | && (w32_system_caret_height != w->phys_cursor_height)) | ||
| 9733 | PostMessage (hwnd, WM_EMACS_DESTROY_CARET, 0, 0); | ||
| 9734 | |||
| 9735 | w32_system_caret_height = w->phys_cursor_height; | ||
| 9736 | |||
| 9737 | /* Move the system caret. */ | ||
| 9738 | PostMessage (hwnd, WM_EMACS_TRACK_CARET, 0, 0); | ||
| 9728 | } | 9739 | } |
| 9729 | 9740 | ||
| 9730 | switch (new_cursor_type) | 9741 | switch (new_cursor_type) |
| @@ -11019,7 +11030,6 @@ w32_initialize () | |||
| 11019 | 11030 | ||
| 11020 | w32_system_caret_hwnd = NULL; | 11031 | w32_system_caret_hwnd = NULL; |
| 11021 | w32_system_caret_height = 0; | 11032 | w32_system_caret_height = 0; |
| 11022 | w32_system_caret_width = 0; | ||
| 11023 | w32_system_caret_x = 0; | 11033 | w32_system_caret_x = 0; |
| 11024 | w32_system_caret_y = 0; | 11034 | w32_system_caret_y = 0; |
| 11025 | 11035 | ||
| @@ -11153,6 +11163,24 @@ affect on NT machines. */); | |||
| 11153 | staticpro (&previous_help_echo); | 11163 | staticpro (&previous_help_echo); |
| 11154 | help_echo_pos = -1; | 11164 | help_echo_pos = -1; |
| 11155 | 11165 | ||
| 11166 | DEFVAR_BOOL ("w32-use-visible-system-caret", | ||
| 11167 | &w32_use_visible_system_caret, | ||
| 11168 | doc: /* Flag to make the system caret visible. | ||
| 11169 | When this is non-nil, Emacs will indicate the position of point by | ||
| 11170 | using the system caret instead of drawing its own cursor. Some screen | ||
| 11171 | reader software does not track the system cursor properly when it is | ||
| 11172 | invisible, and gets confused by Emacs drawing its own cursor, so this | ||
| 11173 | variable is initialized to t when Emacs detects that screen reader | ||
| 11174 | software is running as it starts up. | ||
| 11175 | |||
| 11176 | When this variable is set, other variables affecting the appearance of | ||
| 11177 | the cursor have no effect. */); | ||
| 11178 | |||
| 11179 | /* Initialize w32_use_visible_system_caret based on whether a screen | ||
| 11180 | reader is in use. */ | ||
| 11181 | SystemParametersInfo (SPI_GETSCREENREADER, 0, | ||
| 11182 | &w32_use_visible_system_caret, 0); | ||
| 11183 | |||
| 11156 | DEFVAR_BOOL ("x-stretch-cursor", &x_stretch_cursor_p, | 11184 | DEFVAR_BOOL ("x-stretch-cursor", &x_stretch_cursor_p, |
| 11157 | doc: /* *Non-nil means draw block cursor as wide as the glyph under it. | 11185 | doc: /* *Non-nil means draw block cursor as wide as the glyph under it. |
| 11158 | For example, if a block cursor is over a tab, it will be drawn as | 11186 | For example, if a block cursor is over a tab, it will be drawn as |