diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32term.c | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/w32term.c b/src/w32term.c index 76836209506..41c2a759cb4 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -214,6 +214,13 @@ struct frame *pending_autoraise_frame; | |||
| 214 | 214 | ||
| 215 | struct cursor_pos output_cursor; | 215 | struct cursor_pos output_cursor; |
| 216 | 216 | ||
| 217 | /* The handle of the frame that currently owns the system caret. */ | ||
| 218 | HWND w32_system_caret_hwnd; | ||
| 219 | int w32_system_caret_width; | ||
| 220 | int w32_system_caret_height; | ||
| 221 | int w32_system_caret_x; | ||
| 222 | int w32_system_caret_y; | ||
| 223 | |||
| 217 | /* Flag to enable Unicode output in case users wish to use programs | 224 | /* Flag to enable Unicode output in case users wish to use programs |
| 218 | like Twinbridge on '95 rather than installed system level support | 225 | like Twinbridge on '95 rather than installed system level support |
| 219 | for Far East languages. */ | 226 | for Far East languages. */ |
| @@ -6460,6 +6467,9 @@ note_mouse_highlight (f, x, y) | |||
| 6460 | if (!WINDOWP (window)) | 6467 | if (!WINDOWP (window)) |
| 6461 | return; | 6468 | return; |
| 6462 | 6469 | ||
| 6470 | /* Reset help_echo. It will get recomputed below. */ | ||
| 6471 | help_echo = Qnil; | ||
| 6472 | |||
| 6463 | /* Convert to window-relative pixel coordinates. */ | 6473 | /* Convert to window-relative pixel coordinates. */ |
| 6464 | w = XWINDOW (window); | 6474 | w = XWINDOW (window); |
| 6465 | frame_to_window_pixel_xy (w, &x, &y); | 6475 | frame_to_window_pixel_xy (w, &x, &y); |
| @@ -9482,6 +9492,7 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y) | |||
| 9482 | struct glyph_matrix *current_glyphs; | 9492 | struct glyph_matrix *current_glyphs; |
| 9483 | struct glyph_row *glyph_row; | 9493 | struct glyph_row *glyph_row; |
| 9484 | struct glyph *glyph; | 9494 | struct glyph *glyph; |
| 9495 | int active_cursor = 1; | ||
| 9485 | 9496 | ||
| 9486 | /* This is pointless on invisible frames, and dangerous on garbaged | 9497 | /* This is pointless on invisible frames, and dangerous on garbaged |
| 9487 | windows and frames; in the latter case, the frame or window may | 9498 | windows and frames; in the latter case, the frame or window may |
| @@ -9525,7 +9536,10 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y) | |||
| 9525 | if (w == XWINDOW (echo_area_window)) | 9536 | if (w == XWINDOW (echo_area_window)) |
| 9526 | new_cursor_type = FRAME_DESIRED_CURSOR (f); | 9537 | new_cursor_type = FRAME_DESIRED_CURSOR (f); |
| 9527 | else | 9538 | else |
| 9528 | new_cursor_type = HOLLOW_BOX_CURSOR; | 9539 | { |
| 9540 | new_cursor_type = HOLLOW_BOX_CURSOR; | ||
| 9541 | active_cursor = 0; | ||
| 9542 | } | ||
| 9529 | } | 9543 | } |
| 9530 | else | 9544 | else |
| 9531 | { | 9545 | { |
| @@ -9533,6 +9547,7 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y) | |||
| 9533 | || w != XWINDOW (f->selected_window)) | 9547 | || w != XWINDOW (f->selected_window)) |
| 9534 | { | 9548 | { |
| 9535 | extern int cursor_in_non_selected_windows; | 9549 | extern int cursor_in_non_selected_windows; |
| 9550 | active_cursor = 0; | ||
| 9536 | 9551 | ||
| 9537 | if (MINI_WINDOW_P (w) | 9552 | if (MINI_WINDOW_P (w) |
| 9538 | || !cursor_in_non_selected_windows | 9553 | || !cursor_in_non_selected_windows |
| @@ -9581,6 +9596,38 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y) | |||
| 9581 | w->phys_cursor_type = new_cursor_type; | 9596 | w->phys_cursor_type = new_cursor_type; |
| 9582 | w->phys_cursor_on_p = 1; | 9597 | w->phys_cursor_on_p = 1; |
| 9583 | 9598 | ||
| 9599 | /* If this is the active cursor, we need to track it with the | ||
| 9600 | system caret, so third party software like screen magnifiers | ||
| 9601 | and speech synthesizers can follow the cursor. */ | ||
| 9602 | if (active_cursor) | ||
| 9603 | { | ||
| 9604 | HWND hwnd = FRAME_W32_WINDOW (f); | ||
| 9605 | |||
| 9606 | struct glyph * cursor_glyph = get_phys_cursor_glyph (w); | ||
| 9607 | int caret_width = cursor_glyph->pixel_width; | ||
| 9608 | w32_system_caret_x | ||
| 9609 | = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | ||
| 9610 | w32_system_caret_y | ||
| 9611 | = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) | ||
| 9612 | + glyph_row->ascent - w->phys_cursor_ascent); | ||
| 9613 | |||
| 9614 | /* If the size of the active cursor changed, destroy the old | ||
| 9615 | system caret. */ | ||
| 9616 | if (w32_system_caret_hwnd | ||
| 9617 | && (w32_system_caret_height != w->phys_cursor_height | ||
| 9618 | || w32_system_caret_width != caret_width)) | ||
| 9619 | PostMessage (hwnd, WM_EMACS_DESTROY_CARET, NULL, NULL); | ||
| 9620 | |||
| 9621 | if (!w32_system_caret_hwnd) | ||
| 9622 | { | ||
| 9623 | w32_system_caret_height = w->phys_cursor_height; | ||
| 9624 | w32_system_caret_width = caret_width; | ||
| 9625 | } | ||
| 9626 | |||
| 9627 | /* Move the system caret. */ | ||
| 9628 | PostMessage (hwnd, WM_EMACS_TRACK_CARET, NULL, NULL); | ||
| 9629 | } | ||
| 9630 | |||
| 9584 | switch (new_cursor_type) | 9631 | switch (new_cursor_type) |
| 9585 | { | 9632 | { |
| 9586 | case HOLLOW_BOX_CURSOR: | 9633 | case HOLLOW_BOX_CURSOR: |
| @@ -10786,6 +10833,12 @@ w32_initialize () | |||
| 10786 | off the bottom */ | 10833 | off the bottom */ |
| 10787 | baud_rate = 19200; | 10834 | baud_rate = 19200; |
| 10788 | 10835 | ||
| 10836 | w32_system_caret_hwnd = NULL; | ||
| 10837 | w32_system_caret_height = 0; | ||
| 10838 | w32_system_caret_width = 0; | ||
| 10839 | w32_system_caret_x = 0; | ||
| 10840 | w32_system_caret_y = 0; | ||
| 10841 | |||
| 10789 | last_tool_bar_item = -1; | 10842 | last_tool_bar_item = -1; |
| 10790 | any_help_event_p = 0; | 10843 | any_help_event_p = 0; |
| 10791 | 10844 | ||