aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32term.c
diff options
context:
space:
mode:
authorEli Zaretskii2010-11-06 10:28:31 +0200
committerEli Zaretskii2010-11-06 10:28:31 +0200
commitc1fc2d3a9c511d6893dfb919f543d747913d1539 (patch)
tree26330a31c1cf115f35c919c17ee3309d36fb9ce5 /src/w32term.c
parent6e373c1afbf1d95475bc9cbc191f0bf646c30360 (diff)
parent0a56722656b17dd7ef87009d646be9304c8ef83e (diff)
downloademacs-c1fc2d3a9c511d6893dfb919f543d747913d1539.tar.gz
emacs-c1fc2d3a9c511d6893dfb919f543d747913d1539.zip
Unify mouse-highlight code for all GUI and TTY sessions.
term.c: Remove static mouse_face_* variables. All users changed. (term_show_mouse_face, term_clear_mouse_face) (fast_find_position, term_mouse_highlight): Functions deleted. (tty_draw_row_with_mouse_face): New function. (term_mouse_movement): Call note_mouse_highlight instead of term_mouse_highlight. nsterm.m (ns_update_window_begin, ns_update_window_end) (ns_update_end, x_destroy_window, ns_frame_up_to_date) (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background) (ns_dumpglyphs_image, ns_dumpglyphs_stretch) (ns_initialize_display_info, keyDown, mouseMoved, mouseExited): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. xterm.c (x_update_window_begin, x_update_window_end) (x_update_end, XTframe_up_to_date, x_set_mouse_face_gc) (handle_one_xevent, x_free_frame_resources, x_term_init): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. w32term.c (x_update_window_begin, x_update_window_end) (x_update_end, w32_read_socket, x_free_frame_resources) (w32_initialize_display_info): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. xdisp.c (show_mouse_face, note_mode_line_or_margin_highlight) (note_mouse_highlight) [HAVE_WINDOW_SYSTEM]: Don't run GUI code unless the frame is on a window-system. (get_tool_bar_item, handle_tool_bar_click) (note_tool_bar_highlight, draw_glyphs, erase_phys_cursor) (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) (note_mode_line_or_margin_highlight, note_mouse_highlight) (x_clear_window_mouse_face, cancel_mouse_face, expose_frame): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. (coords_in_mouse_face_p): Move prototype out of the HAVE_WINDOW_SYSTEM conditional. (x_y_to_hpos_vpos, frame_to_window_pixel_xy): Move out of the HAVE_WINDOW_SYSTEM block. (try_window_id) [HAVE_GPM || MSDOS]: Call x_clear_window_mouse_face. (draw_row_with_mouse_face): Implementation for HAVE_WINDOW_SYSTEM systems. Call tty_draw_row_with_mouse_face for TTY systems. (show_mouse_face): Call draw_row_with_mouse_face, instead of calling draw_glyphs directly. (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) (cursor_in_mouse_face_p, rows_from_pos_range) (mouse_face_from_buffer_pos, mouse_face_from_string_pos) (note_mode_line_or_margin_highlight, note_mouse_highlight) (x_clear_window_mouse_face, cancel_mouse_face): Move out of the HAVE_WINDOW_SYSTEM block. Ifdef away window-system specific fragments. (note_mouse_highlight): Call popup_activated for MSDOS as well. Clear mouse highlight if pointer is over glyphs whose OBJECT is an integer. (mouse_face_from_buffer_pos): Add parentheses around && within ||. (x_consider_frame_title, tool_bar_lines_needed): Move prototypes to HAVE_WINDOW_SYSTEM-only part. (get_window_cursor_type): Move inside a HAVE_WINDOW_SYSTEM-only part. Remove "#ifdef HAVE_WINDOW_SYSTEM" from body of function. (null_glyph_slice): Move declaration into HAVE_WINDOW_SYSTEM-only part. dispnew.c (mirror_make_current): Set Y coordinate of the mode-line and header-line rows. (init_display): Setup initial frame's output_data for text terminal frames. xmenu.c (popup_activated): Don't define on MSDOS, which now has its own definition on msdos.c. msdos.c (show_mouse_face, clear_mouse_face) (fast_find_position, IT_note_mode_line_highlight) (IT_note_mouse_highlight): Functions deleted. (IT_frame_up_to_date, dos_rawgetc): Call note_mouse_highlight instead of IT_note_mouse_highlight. (draw_row_with_mouse_face, popup_activated): New functions. (dos_set_window_size, draw_row_with_mouse_face, IT_update_begin) (IT_update_end, IT_frame_up_to_date, internal_terminal_init) (dos_rawgetc): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes. msdos.h (initialize_msdos_display): Add prototype. frame.h (MOUSE_HL_INFO): New macro. lisp.h (Mouse_HLInfo): New data type. xterm.h (struct x_display_info): w32term.h (struct w32_display_info): nsterm.h (struct ns_display_info): termchar.h (struct tty_display_info): Use it instead of mouse_face_* members. dispextern.h (show_mouse_face, clear_mouse_face): Update type of 1st argument. (frame_to_window_pixel_xy, note_mouse_highlight) (x_clear_window_mouse_face, cancel_mouse_face, clear_mouse_face) (show_mouse_face, cursor_in_mouse_face_p): Move prototypes out of HAVE_WINDOW_SYSTEM conditional. (draw_row_with_mouse_face): Declare prototype. (tty_draw_row_with_mouse_face): Declare prototype.
Diffstat (limited to 'src/w32term.c')
-rw-r--r--src/w32term.c117
1 files changed, 60 insertions, 57 deletions
diff --git a/src/w32term.c b/src/w32term.c
index a491e0941db..a93bc064c39 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -505,7 +505,7 @@ static void
505x_update_window_begin (struct window *w) 505x_update_window_begin (struct window *w)
506{ 506{
507 struct frame *f = XFRAME (WINDOW_FRAME (w)); 507 struct frame *f = XFRAME (WINDOW_FRAME (w));
508 struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); 508 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
509 509
510 /* Hide the system caret during an update. */ 510 /* Hide the system caret during an update. */
511 if (w32_use_visible_system_caret && w32_system_caret_hwnd) 511 if (w32_use_visible_system_caret && w32_system_caret_hwnd)
@@ -518,15 +518,15 @@ x_update_window_begin (struct window *w)
518 518
519 BLOCK_INPUT; 519 BLOCK_INPUT;
520 520
521 if (f == display_info->mouse_face_mouse_frame) 521 if (f == hlinfo->mouse_face_mouse_frame)
522 { 522 {
523 /* Don't do highlighting for mouse motion during the update. */ 523 /* Don't do highlighting for mouse motion during the update. */
524 display_info->mouse_face_defer = 1; 524 hlinfo->mouse_face_defer = 1;
525 525
526 /* If F needs to be redrawn, simply forget about any prior mouse 526 /* If F needs to be redrawn, simply forget about any prior mouse
527 highlighting. */ 527 highlighting. */
528 if (FRAME_GARBAGED_P (f)) 528 if (FRAME_GARBAGED_P (f))
529 display_info->mouse_face_window = Qnil; 529 hlinfo->mouse_face_window = Qnil;
530 530
531#if 0 /* Rows in a current matrix containing glyphs in mouse-face have 531#if 0 /* Rows in a current matrix containing glyphs in mouse-face have
532 their mouse_face_p flag set, which means that they are always 532 their mouse_face_p flag set, which means that they are always
@@ -540,8 +540,8 @@ x_update_window_begin (struct window *w)
540 Likewise, don't do anything if the frame is garbaged; 540 Likewise, don't do anything if the frame is garbaged;
541 in that case, the frame's current matrix that we would use 541 in that case, the frame's current matrix that we would use
542 is all wrong, and we will redisplay that line anyway. */ 542 is all wrong, and we will redisplay that line anyway. */
543 if (!NILP (display_info->mouse_face_window) 543 if (!NILP (hlinfo->mouse_face_window)
544 && w == XWINDOW (display_info->mouse_face_window)) 544 && w == XWINDOW (hlinfo->mouse_face_window))
545 { 545 {
546 int i; 546 int i;
547 547
@@ -550,7 +550,7 @@ x_update_window_begin (struct window *w)
550 break; 550 break;
551 551
552 if (i < w->desired_matrix->nrows) 552 if (i < w->desired_matrix->nrows)
553 clear_mouse_face (display_info); 553 clear_mouse_face (hlinfo);
554 } 554 }
555#endif /* 0 */ 555#endif /* 0 */
556 } 556 }
@@ -601,7 +601,7 @@ static void
601x_update_window_end (struct window *w, int cursor_on_p, 601x_update_window_end (struct window *w, int cursor_on_p,
602 int mouse_face_overwritten_p) 602 int mouse_face_overwritten_p)
603{ 603{
604 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame)); 604 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
605 605
606 if (!w->pseudo_window_p) 606 if (!w->pseudo_window_p)
607 { 607 {
@@ -622,9 +622,9 @@ x_update_window_end (struct window *w, int cursor_on_p,
622 XTframe_up_to_date to redisplay the mouse highlight. */ 622 XTframe_up_to_date to redisplay the mouse highlight. */
623 if (mouse_face_overwritten_p) 623 if (mouse_face_overwritten_p)
624 { 624 {
625 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 625 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
626 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 626 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
627 dpyinfo->mouse_face_window = Qnil; 627 hlinfo->mouse_face_window = Qnil;
628 } 628 }
629 629
630 /* Unhide the caret. This won't actually show the cursor, unless it 630 /* Unhide the caret. This won't actually show the cursor, unless it
@@ -649,7 +649,7 @@ x_update_end (struct frame *f)
649 return; 649 return;
650 650
651 /* Mouse highlight may be displayed again. */ 651 /* Mouse highlight may be displayed again. */
652 FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 0; 652 MOUSE_HL_INFO (f)->mouse_face_defer = 0;
653} 653}
654 654
655 655
@@ -662,17 +662,17 @@ w32_frame_up_to_date (struct frame *f)
662{ 662{
663 if (FRAME_W32_P (f)) 663 if (FRAME_W32_P (f))
664 { 664 {
665 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 665 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
666 666
667 if (dpyinfo->mouse_face_deferred_gc 667 if (hlinfo->mouse_face_deferred_gc
668 || f == dpyinfo->mouse_face_mouse_frame) 668 || f == hlinfo->mouse_face_mouse_frame)
669 { 669 {
670 BLOCK_INPUT; 670 BLOCK_INPUT;
671 if (dpyinfo->mouse_face_mouse_frame) 671 if (hlinfo->mouse_face_mouse_frame)
672 note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, 672 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
673 dpyinfo->mouse_face_mouse_x, 673 hlinfo->mouse_face_mouse_x,
674 dpyinfo->mouse_face_mouse_y); 674 hlinfo->mouse_face_mouse_y);
675 dpyinfo->mouse_face_deferred_gc = 0; 675 hlinfo->mouse_face_deferred_gc = 0;
676 UNBLOCK_INPUT; 676 UNBLOCK_INPUT;
677 } 677 }
678 } 678 }
@@ -999,7 +999,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
999 struct face *face; 999 struct face *face;
1000 1000
1001 /* What face has to be used last for the mouse face? */ 1001 /* What face has to be used last for the mouse face? */
1002 face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id; 1002 face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id;
1003 face = FACE_FROM_ID (s->f, face_id); 1003 face = FACE_FROM_ID (s->f, face_id);
1004 if (face == NULL) 1004 if (face == NULL)
1005 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); 1005 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
@@ -4060,6 +4060,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4060 W32Msg msg; 4060 W32Msg msg;
4061 struct frame *f; 4061 struct frame *f;
4062 struct w32_display_info *dpyinfo = &one_w32_display_info; 4062 struct w32_display_info *dpyinfo = &one_w32_display_info;
4063 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
4063 4064
4064 if (interrupt_input_blocked) 4065 if (interrupt_input_blocked)
4065 { 4066 {
@@ -4160,11 +4161,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4160 4161
4161 if (f && !f->iconified) 4162 if (f && !f->iconified)
4162 { 4163 {
4163 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4164 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4164 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4165 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4165 { 4166 {
4166 clear_mouse_face (dpyinfo); 4167 clear_mouse_face (hlinfo);
4167 dpyinfo->mouse_face_hidden = 1; 4168 hlinfo->mouse_face_hidden = 1;
4168 } 4169 }
4169 4170
4170 if (temp_index == sizeof temp_buffer / sizeof (short)) 4171 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4185,11 +4186,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4185 4186
4186 if (f && !f->iconified) 4187 if (f && !f->iconified)
4187 { 4188 {
4188 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4189 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4189 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4190 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4190 { 4191 {
4191 clear_mouse_face (dpyinfo); 4192 clear_mouse_face (hlinfo);
4192 dpyinfo->mouse_face_hidden = 1; 4193 hlinfo->mouse_face_hidden = 1;
4193 } 4194 }
4194 4195
4195 if (temp_index == sizeof temp_buffer / sizeof (short)) 4196 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4263,11 +4264,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4263 4264
4264 if (f && !f->iconified) 4265 if (f && !f->iconified)
4265 { 4266 {
4266 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4267 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4267 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4268 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4268 { 4269 {
4269 clear_mouse_face (dpyinfo); 4270 clear_mouse_face (hlinfo);
4270 dpyinfo->mouse_face_hidden = 1; 4271 hlinfo->mouse_face_hidden = 1;
4271 } 4272 }
4272 4273
4273 if (temp_index == sizeof temp_buffer / sizeof (short)) 4274 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4301,10 +4302,10 @@ w32_read_socket (struct terminal *terminal, int expected,
4301 else 4302 else
4302 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); 4303 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
4303 4304
4304 if (dpyinfo->mouse_face_hidden) 4305 if (hlinfo->mouse_face_hidden)
4305 { 4306 {
4306 dpyinfo->mouse_face_hidden = 0; 4307 hlinfo->mouse_face_hidden = 0;
4307 clear_mouse_face (dpyinfo); 4308 clear_mouse_face (hlinfo);
4308 } 4309 }
4309 4310
4310 if (f) 4311 if (f)
@@ -4345,7 +4346,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4345 { 4346 {
4346 /* If we move outside the frame, then we're 4347 /* If we move outside the frame, then we're
4347 certainly no longer on any text in the frame. */ 4348 certainly no longer on any text in the frame. */
4348 clear_mouse_face (dpyinfo); 4349 clear_mouse_face (hlinfo);
4349 } 4350 }
4350 4351
4351 /* If the contents of the global variable help_echo_string 4352 /* If the contents of the global variable help_echo_string
@@ -4634,12 +4635,12 @@ w32_read_socket (struct terminal *terminal, int expected,
4634 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd); 4635 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd);
4635 if (f) 4636 if (f)
4636 { 4637 {
4637 if (f == dpyinfo->mouse_face_mouse_frame) 4638 if (f == hlinfo->mouse_face_mouse_frame)
4638 { 4639 {
4639 /* If we move outside the frame, then we're 4640 /* If we move outside the frame, then we're
4640 certainly no longer on any text in the frame. */ 4641 certainly no longer on any text in the frame. */
4641 clear_mouse_face (dpyinfo); 4642 clear_mouse_face (hlinfo);
4642 dpyinfo->mouse_face_mouse_frame = 0; 4643 hlinfo->mouse_face_mouse_frame = 0;
4643 } 4644 }
4644 4645
4645 /* Generate a nil HELP_EVENT to cancel a help-echo. 4646 /* Generate a nil HELP_EVENT to cancel a help-echo.
@@ -4669,12 +4670,12 @@ w32_read_socket (struct terminal *terminal, int expected,
4669 if (f == dpyinfo->w32_focus_frame) 4670 if (f == dpyinfo->w32_focus_frame)
4670 x_new_focus_frame (dpyinfo, 0); 4671 x_new_focus_frame (dpyinfo, 0);
4671 4672
4672 if (f == dpyinfo->mouse_face_mouse_frame) 4673 if (f == hlinfo->mouse_face_mouse_frame)
4673 { 4674 {
4674 /* If we move outside the frame, then we're 4675 /* If we move outside the frame, then we're
4675 certainly no longer on any text in the frame. */ 4676 certainly no longer on any text in the frame. */
4676 clear_mouse_face (dpyinfo); 4677 clear_mouse_face (hlinfo);
4677 dpyinfo->mouse_face_mouse_frame = 0; 4678 hlinfo->mouse_face_mouse_frame = 0;
4678 } 4679 }
4679 4680
4680 /* Generate a nil HELP_EVENT to cancel a help-echo. 4681 /* Generate a nil HELP_EVENT to cancel a help-echo.
@@ -5822,6 +5823,7 @@ void
5822x_free_frame_resources (struct frame *f) 5823x_free_frame_resources (struct frame *f)
5823{ 5824{
5824 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 5825 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
5826 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
5825 5827
5826 BLOCK_INPUT; 5828 BLOCK_INPUT;
5827 5829
@@ -5860,15 +5862,15 @@ x_free_frame_resources (struct frame *f)
5860 if (f == dpyinfo->x_highlight_frame) 5862 if (f == dpyinfo->x_highlight_frame)
5861 dpyinfo->x_highlight_frame = 0; 5863 dpyinfo->x_highlight_frame = 0;
5862 5864
5863 if (f == dpyinfo->mouse_face_mouse_frame) 5865 if (f == hlinfo->mouse_face_mouse_frame)
5864 { 5866 {
5865 dpyinfo->mouse_face_beg_row 5867 hlinfo->mouse_face_beg_row
5866 = dpyinfo->mouse_face_beg_col = -1; 5868 = hlinfo->mouse_face_beg_col = -1;
5867 dpyinfo->mouse_face_end_row 5869 hlinfo->mouse_face_end_row
5868 = dpyinfo->mouse_face_end_col = -1; 5870 = hlinfo->mouse_face_end_col = -1;
5869 dpyinfo->mouse_face_window = Qnil; 5871 hlinfo->mouse_face_window = Qnil;
5870 dpyinfo->mouse_face_deferred_gc = 0; 5872 hlinfo->mouse_face_deferred_gc = 0;
5871 dpyinfo->mouse_face_mouse_frame = 0; 5873 hlinfo->mouse_face_mouse_frame = 0;
5872 } 5874 }
5873 5875
5874 UNBLOCK_INPUT; 5876 UNBLOCK_INPUT;
@@ -5934,6 +5936,7 @@ void
5934w32_initialize_display_info (Lisp_Object display_name) 5936w32_initialize_display_info (Lisp_Object display_name)
5935{ 5937{
5936 struct w32_display_info *dpyinfo = &one_w32_display_info; 5938 struct w32_display_info *dpyinfo = &one_w32_display_info;
5939 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
5937 5940
5938 memset (dpyinfo, 0, sizeof (*dpyinfo)); 5941 memset (dpyinfo, 0, sizeof (*dpyinfo));
5939 5942
@@ -5959,12 +5962,12 @@ w32_initialize_display_info (Lisp_Object display_name)
5959 dpyinfo->smallest_font_height = 1; 5962 dpyinfo->smallest_font_height = 1;
5960 dpyinfo->smallest_char_width = 1; 5963 dpyinfo->smallest_char_width = 1;
5961 5964
5962 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 5965 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
5963 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 5966 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
5964 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; 5967 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
5965 dpyinfo->mouse_face_window = Qnil; 5968 hlinfo->mouse_face_window = Qnil;
5966 dpyinfo->mouse_face_overlay = Qnil; 5969 hlinfo->mouse_face_overlay = Qnil;
5967 dpyinfo->mouse_face_hidden = 0; 5970 hlinfo->mouse_face_hidden = 0;
5968 5971
5969 dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW); 5972 dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW);
5970 /* TODO: dpyinfo->gray */ 5973 /* TODO: dpyinfo->gray */