aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32term.c
diff options
context:
space:
mode:
authorEli Zaretskii2010-11-01 22:09:03 +0200
committerEli Zaretskii2010-11-01 22:09:03 +0200
commitbbf534ce52f044f79773e91f558227c3e9a1727b (patch)
tree289207d3fa6d3bd520b1e2b69d96f116b8f372c1 /src/w32term.c
parent7ea692f66f4367755bb9e80991182ac55c90ead2 (diff)
downloademacs-bbf534ce52f044f79773e91f558227c3e9a1727b.tar.gz
emacs-bbf534ce52f044f79773e91f558227c3e9a1727b.zip
Finish coding mouse highlight redesigned for portability.
Not compiled yet. 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.
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 7690f13799f..ba861f083a1 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);
@@ -3964,6 +3964,7 @@ w32_read_socket (struct terminal *terminal, int expected,
3964 W32Msg msg; 3964 W32Msg msg;
3965 struct frame *f; 3965 struct frame *f;
3966 struct w32_display_info *dpyinfo = &one_w32_display_info; 3966 struct w32_display_info *dpyinfo = &one_w32_display_info;
3967 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
3967 3968
3968 if (interrupt_input_blocked) 3969 if (interrupt_input_blocked)
3969 { 3970 {
@@ -4064,11 +4065,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4064 4065
4065 if (f && !f->iconified) 4066 if (f && !f->iconified)
4066 { 4067 {
4067 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4068 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4068 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4069 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4069 { 4070 {
4070 clear_mouse_face (dpyinfo); 4071 clear_mouse_face (hlinfo);
4071 dpyinfo->mouse_face_hidden = 1; 4072 hlinfo->mouse_face_hidden = 1;
4072 } 4073 }
4073 4074
4074 if (temp_index == sizeof temp_buffer / sizeof (short)) 4075 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4089,11 +4090,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4089 4090
4090 if (f && !f->iconified) 4091 if (f && !f->iconified)
4091 { 4092 {
4092 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4093 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4093 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4094 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4094 { 4095 {
4095 clear_mouse_face (dpyinfo); 4096 clear_mouse_face (hlinfo);
4096 dpyinfo->mouse_face_hidden = 1; 4097 hlinfo->mouse_face_hidden = 1;
4097 } 4098 }
4098 4099
4099 if (temp_index == sizeof temp_buffer / sizeof (short)) 4100 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4167,11 +4168,11 @@ w32_read_socket (struct terminal *terminal, int expected,
4167 4168
4168 if (f && !f->iconified) 4169 if (f && !f->iconified)
4169 { 4170 {
4170 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4171 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4171 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 4172 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window))
4172 { 4173 {
4173 clear_mouse_face (dpyinfo); 4174 clear_mouse_face (hlinfo);
4174 dpyinfo->mouse_face_hidden = 1; 4175 hlinfo->mouse_face_hidden = 1;
4175 } 4176 }
4176 4177
4177 if (temp_index == sizeof temp_buffer / sizeof (short)) 4178 if (temp_index == sizeof temp_buffer / sizeof (short))
@@ -4205,10 +4206,10 @@ w32_read_socket (struct terminal *terminal, int expected,
4205 else 4206 else
4206 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); 4207 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
4207 4208
4208 if (dpyinfo->mouse_face_hidden) 4209 if (hlinfo->mouse_face_hidden)
4209 { 4210 {
4210 dpyinfo->mouse_face_hidden = 0; 4211 hlinfo->mouse_face_hidden = 0;
4211 clear_mouse_face (dpyinfo); 4212 clear_mouse_face (hlinfo);
4212 } 4213 }
4213 4214
4214 if (f) 4215 if (f)
@@ -4249,7 +4250,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4249 { 4250 {
4250 /* If we move outside the frame, then we're 4251 /* If we move outside the frame, then we're
4251 certainly no longer on any text in the frame. */ 4252 certainly no longer on any text in the frame. */
4252 clear_mouse_face (dpyinfo); 4253 clear_mouse_face (hlinfo);
4253 } 4254 }
4254 4255
4255 /* If the contents of the global variable help_echo_string 4256 /* If the contents of the global variable help_echo_string
@@ -4538,12 +4539,12 @@ w32_read_socket (struct terminal *terminal, int expected,
4538 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd); 4539 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd);
4539 if (f) 4540 if (f)
4540 { 4541 {
4541 if (f == dpyinfo->mouse_face_mouse_frame) 4542 if (f == hlinfo->mouse_face_mouse_frame)
4542 { 4543 {
4543 /* If we move outside the frame, then we're 4544 /* If we move outside the frame, then we're
4544 certainly no longer on any text in the frame. */ 4545 certainly no longer on any text in the frame. */
4545 clear_mouse_face (dpyinfo); 4546 clear_mouse_face (hlinfo);
4546 dpyinfo->mouse_face_mouse_frame = 0; 4547 hlinfo->mouse_face_mouse_frame = 0;
4547 } 4548 }
4548 4549
4549 /* Generate a nil HELP_EVENT to cancel a help-echo. 4550 /* Generate a nil HELP_EVENT to cancel a help-echo.
@@ -4573,12 +4574,12 @@ w32_read_socket (struct terminal *terminal, int expected,
4573 if (f == dpyinfo->w32_focus_frame) 4574 if (f == dpyinfo->w32_focus_frame)
4574 x_new_focus_frame (dpyinfo, 0); 4575 x_new_focus_frame (dpyinfo, 0);
4575 4576
4576 if (f == dpyinfo->mouse_face_mouse_frame) 4577 if (f == hlinfo->mouse_face_mouse_frame)
4577 { 4578 {
4578 /* If we move outside the frame, then we're 4579 /* If we move outside the frame, then we're
4579 certainly no longer on any text in the frame. */ 4580 certainly no longer on any text in the frame. */
4580 clear_mouse_face (dpyinfo); 4581 clear_mouse_face (hlinfo);
4581 dpyinfo->mouse_face_mouse_frame = 0; 4582 hlinfo->mouse_face_mouse_frame = 0;
4582 } 4583 }
4583 4584
4584 /* Generate a nil HELP_EVENT to cancel a help-echo. 4585 /* Generate a nil HELP_EVENT to cancel a help-echo.
@@ -5726,6 +5727,7 @@ void
5726x_free_frame_resources (struct frame *f) 5727x_free_frame_resources (struct frame *f)
5727{ 5728{
5728 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 5729 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
5730 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
5729 5731
5730 BLOCK_INPUT; 5732 BLOCK_INPUT;
5731 5733
@@ -5764,15 +5766,15 @@ x_free_frame_resources (struct frame *f)
5764 if (f == dpyinfo->x_highlight_frame) 5766 if (f == dpyinfo->x_highlight_frame)
5765 dpyinfo->x_highlight_frame = 0; 5767 dpyinfo->x_highlight_frame = 0;
5766 5768
5767 if (f == dpyinfo->mouse_face_mouse_frame) 5769 if (f == hlinfo->mouse_face_mouse_frame)
5768 { 5770 {
5769 dpyinfo->mouse_face_beg_row 5771 hlinfo->mouse_face_beg_row
5770 = dpyinfo->mouse_face_beg_col = -1; 5772 = hlinfo->mouse_face_beg_col = -1;
5771 dpyinfo->mouse_face_end_row 5773 hlinfo->mouse_face_end_row
5772 = dpyinfo->mouse_face_end_col = -1; 5774 = hlinfo->mouse_face_end_col = -1;
5773 dpyinfo->mouse_face_window = Qnil; 5775 hlinfo->mouse_face_window = Qnil;
5774 dpyinfo->mouse_face_deferred_gc = 0; 5776 hlinfo->mouse_face_deferred_gc = 0;
5775 dpyinfo->mouse_face_mouse_frame = 0; 5777 hlinfo->mouse_face_mouse_frame = 0;
5776 } 5778 }
5777 5779
5778 UNBLOCK_INPUT; 5780 UNBLOCK_INPUT;
@@ -5838,6 +5840,7 @@ void
5838w32_initialize_display_info (Lisp_Object display_name) 5840w32_initialize_display_info (Lisp_Object display_name)
5839{ 5841{
5840 struct w32_display_info *dpyinfo = &one_w32_display_info; 5842 struct w32_display_info *dpyinfo = &one_w32_display_info;
5843 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
5841 5844
5842 memset (dpyinfo, 0, sizeof (*dpyinfo)); 5845 memset (dpyinfo, 0, sizeof (*dpyinfo));
5843 5846
@@ -5863,12 +5866,12 @@ w32_initialize_display_info (Lisp_Object display_name)
5863 dpyinfo->smallest_font_height = 1; 5866 dpyinfo->smallest_font_height = 1;
5864 dpyinfo->smallest_char_width = 1; 5867 dpyinfo->smallest_char_width = 1;
5865 5868
5866 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 5869 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
5867 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 5870 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
5868 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; 5871 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
5869 dpyinfo->mouse_face_window = Qnil; 5872 hlinfo->mouse_face_window = Qnil;
5870 dpyinfo->mouse_face_overlay = Qnil; 5873 hlinfo->mouse_face_overlay = Qnil;
5871 dpyinfo->mouse_face_hidden = 0; 5874 hlinfo->mouse_face_hidden = 0;
5872 5875
5873 dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW); 5876 dpyinfo->vertical_scroll_bar_cursor = w32_load_cursor (IDC_ARROW);
5874 /* TODO: dpyinfo->gray */ 5877 /* TODO: dpyinfo->gray */