Mercurial > emacs
comparison src/w32term.c @ 48218:01e253345507
(w32_draw_fringe_bitmap): Remove unused local variable window.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Fri, 08 Nov 2002 08:42:03 +0000 |
parents | 77df00035231 |
children | 44c0f878e8b9 |
comparison
equal
deleted
inserted
replaced
48217:f5937cc72e33 | 48218:01e253345507 |
---|---|
153 | 153 |
154 Lisp_Object Vx_toolkit_scroll_bars; | 154 Lisp_Object Vx_toolkit_scroll_bars; |
155 | 155 |
156 /* If a string, w32_read_socket generates an event to display that string. | 156 /* If a string, w32_read_socket generates an event to display that string. |
157 (The display is done in read_char.) */ | 157 (The display is done in read_char.) */ |
158 | 158 |
159 static Lisp_Object help_echo; | 159 static Lisp_Object help_echo; |
160 static Lisp_Object help_echo_window; | 160 static Lisp_Object help_echo_window; |
161 static Lisp_Object help_echo_object; | 161 static Lisp_Object help_echo_object; |
162 static int help_echo_pos; | 162 static int help_echo_pos; |
163 | 163 |
413 static void x_update_window_cursor P_ ((struct window *, int)); | 413 static void x_update_window_cursor P_ ((struct window *, int)); |
414 static void x_erase_phys_cursor P_ ((struct window *)); | 414 static void x_erase_phys_cursor P_ ((struct window *)); |
415 void x_display_cursor P_ ((struct window *w, int, int, int, int, int)); | 415 void x_display_cursor P_ ((struct window *w, int, int, int, int, int)); |
416 void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int)); | 416 void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int)); |
417 static void w32_draw_fringe_bitmap P_ ((struct window *, HDC hdc, | 417 static void w32_draw_fringe_bitmap P_ ((struct window *, HDC hdc, |
418 struct glyph_row *, | 418 struct glyph_row *, |
419 enum fringe_bitmap_type, int left_p)); | 419 enum fringe_bitmap_type, int left_p)); |
420 static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, | 420 static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, |
421 HDC, int)); | 421 HDC, int)); |
422 static int x_phys_cursor_in_rect_p P_ ((struct window *, RECT *)); | 422 static int x_phys_cursor_in_rect_p P_ ((struct window *, RECT *)); |
423 static void x_draw_row_fringe_bitmaps P_ ((struct window *, | 423 static void x_draw_row_fringe_bitmaps P_ ((struct window *, |
436 #if 0 | 436 #if 0 |
437 | 437 |
438 /* This is a function useful for recording debugging information about | 438 /* This is a function useful for recording debugging information about |
439 the sequence of occurrences in this file. */ | 439 the sequence of occurrences in this file. */ |
440 | 440 |
441 struct record | 441 struct record |
442 { | 442 { |
443 char *locus; | 443 char *locus; |
444 int type; | 444 int type; |
445 }; | 445 }; |
446 | 446 |
525 DeleteObject (hb); | 525 DeleteObject (hb); |
526 DeleteObject (hp); | 526 DeleteObject (hp); |
527 } | 527 } |
528 | 528 |
529 /* Draw a filled rectangle at the specified position. */ | 529 /* Draw a filled rectangle at the specified position. */ |
530 void | 530 void |
531 w32_fill_rect (f, hdc, pix, lprect) | 531 w32_fill_rect (f, hdc, pix, lprect) |
532 FRAME_PTR f; | 532 FRAME_PTR f; |
533 HDC hdc; | 533 HDC hdc; |
534 COLORREF pix; | 534 COLORREF pix; |
535 RECT * lprect; | 535 RECT * lprect; |
539 hb = CreateSolidBrush (pix); | 539 hb = CreateSolidBrush (pix); |
540 FillRect (hdc, lprect, hb); | 540 FillRect (hdc, lprect, hb); |
541 DeleteObject (hb); | 541 DeleteObject (hb); |
542 } | 542 } |
543 | 543 |
544 void | 544 void |
545 w32_clear_window (f) | 545 w32_clear_window (f) |
546 FRAME_PTR f; | 546 FRAME_PTR f; |
547 { | 547 { |
548 RECT rect; | 548 RECT rect; |
549 HDC hdc = get_frame_dc (f); | 549 HDC hdc = get_frame_dc (f); |
562 | 562 |
563 | 563 |
564 /*********************************************************************** | 564 /*********************************************************************** |
565 Starting and ending an update | 565 Starting and ending an update |
566 ***********************************************************************/ | 566 ***********************************************************************/ |
567 | 567 |
568 /* Start an update of frame F. This function is installed as a hook | 568 /* Start an update of frame F. This function is installed as a hook |
569 for update_begin, i.e. it is called when update_begin is called. | 569 for update_begin, i.e. it is called when update_begin is called. |
570 This function is called prior to calls to x_update_window_begin for | 570 This function is called prior to calls to x_update_window_begin for |
571 each window being updated. */ | 571 each window being updated. */ |
572 | 572 |
623 their mouse_face_p flag set, which means that they are always | 623 their mouse_face_p flag set, which means that they are always |
624 unequal to rows in a desired matrix which never have that | 624 unequal to rows in a desired matrix which never have that |
625 flag set. So, rows containing mouse-face glyphs are never | 625 flag set. So, rows containing mouse-face glyphs are never |
626 scrolled, and we don't have to switch the mouse highlight off | 626 scrolled, and we don't have to switch the mouse highlight off |
627 here to prevent it from being scrolled. */ | 627 here to prevent it from being scrolled. */ |
628 | 628 |
629 /* Can we tell that this update does not affect the window | 629 /* Can we tell that this update does not affect the window |
630 where the mouse highlight is? If so, no need to turn off. | 630 where the mouse highlight is? If so, no need to turn off. |
631 Likewise, don't do anything if the frame is garbaged; | 631 Likewise, don't do anything if the frame is garbaged; |
632 in that case, the frame's current matrix that we would use | 632 in that case, the frame's current matrix that we would use |
633 is all wrong, and we will redisplay that line anyway. */ | 633 is all wrong, and we will redisplay that line anyway. */ |
656 static void | 656 static void |
657 x_draw_vertical_border (w) | 657 x_draw_vertical_border (w) |
658 struct window *w; | 658 struct window *w; |
659 { | 659 { |
660 struct frame *f = XFRAME (WINDOW_FRAME (w)); | 660 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
661 | 661 |
662 /* Redraw borders between horizontally adjacent windows. Don't | 662 /* Redraw borders between horizontally adjacent windows. Don't |
663 do it for frames with vertical scroll bars because either the | 663 do it for frames with vertical scroll bars because either the |
664 right scroll bar of a window, or the left scroll bar of its | 664 right scroll bar of a window, or the left scroll bar of its |
665 neighbor will suffice as a border. */ | 665 neighbor will suffice as a border. */ |
666 if (!WINDOW_RIGHTMOST_P (w) | 666 if (!WINDOW_RIGHTMOST_P (w) |
679 w32_fill_rect (f, hdc, FRAME_FOREGROUND_PIXEL (f), &r); | 679 w32_fill_rect (f, hdc, FRAME_FOREGROUND_PIXEL (f), &r); |
680 release_frame_dc (f, hdc); | 680 release_frame_dc (f, hdc); |
681 } | 681 } |
682 } | 682 } |
683 | 683 |
684 | 684 |
685 /* End update of window W (which is equal to updated_window). | 685 /* End update of window W (which is equal to updated_window). |
686 | 686 |
687 Draw vertical borders between horizontally adjacent windows, and | 687 Draw vertical borders between horizontally adjacent windows, and |
688 display W's cursor if CURSOR_ON_P is non-zero. | 688 display W's cursor if CURSOR_ON_P is non-zero. |
689 | 689 |
709 | 709 |
710 if (cursor_on_p) | 710 if (cursor_on_p) |
711 x_display_and_set_cursor (w, 1, output_cursor.hpos, | 711 x_display_and_set_cursor (w, 1, output_cursor.hpos, |
712 output_cursor.vpos, | 712 output_cursor.vpos, |
713 output_cursor.x, output_cursor.y); | 713 output_cursor.x, output_cursor.y); |
714 | 714 |
715 x_draw_vertical_border (w); | 715 x_draw_vertical_border (w); |
716 UNBLOCK_INPUT; | 716 UNBLOCK_INPUT; |
717 } | 717 } |
718 | 718 |
719 /* If a row with mouse-face was overwritten, arrange for | 719 /* If a row with mouse-face was overwritten, arrange for |
790 struct window *w = updated_window; | 790 struct window *w = updated_window; |
791 struct frame *f; | 791 struct frame *f; |
792 int width, height; | 792 int width, height; |
793 | 793 |
794 xassert (w); | 794 xassert (w); |
795 | 795 |
796 if (!desired_row->mode_line_p && !w->pseudo_window_p) | 796 if (!desired_row->mode_line_p && !w->pseudo_window_p) |
797 { | 797 { |
798 BLOCK_INPUT; | 798 BLOCK_INPUT; |
799 x_draw_row_fringe_bitmaps (w, desired_row); | 799 x_draw_row_fringe_bitmaps (w, desired_row); |
800 UNBLOCK_INPUT; | 800 UNBLOCK_INPUT; |
845 struct glyph_row *row; | 845 struct glyph_row *row; |
846 enum fringe_bitmap_type which; | 846 enum fringe_bitmap_type which; |
847 int left_p; | 847 int left_p; |
848 { | 848 { |
849 struct frame *f = XFRAME (WINDOW_FRAME (w)); | 849 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
850 Window window = FRAME_W32_WINDOW (f); | |
851 HDC compat_hdc; | 850 HDC compat_hdc; |
852 int x, y, wd, h, dy; | 851 int x, y, wd, h, dy; |
853 int b1, b2; | 852 int b1, b2; |
854 HBITMAP pixmap; | 853 HBITMAP pixmap; |
855 HANDLE horig_obj; | 854 HANDLE horig_obj; |
871 case LEFT_TRUNCATION_BITMAP: | 870 case LEFT_TRUNCATION_BITMAP: |
872 wd = left_width; | 871 wd = left_width; |
873 h = left_height; | 872 h = left_height; |
874 pixmap = left_bmp; | 873 pixmap = left_bmp; |
875 break; | 874 break; |
876 | 875 |
877 case OVERLAY_ARROW_BITMAP: | 876 case OVERLAY_ARROW_BITMAP: |
878 wd = ov_width; | 877 wd = ov_width; |
879 h = ov_height; | 878 h = ov_height; |
880 pixmap = ov_bmp; | 879 pixmap = ov_bmp; |
881 break; | 880 break; |
882 | 881 |
883 case RIGHT_TRUNCATION_BITMAP: | 882 case RIGHT_TRUNCATION_BITMAP: |
884 wd = right_width; | 883 wd = right_width; |
885 h = right_height; | 884 h = right_height; |
886 pixmap = right_bmp; | 885 pixmap = right_bmp; |
887 break; | 886 break; |
889 case CONTINUED_LINE_BITMAP: | 888 case CONTINUED_LINE_BITMAP: |
890 wd = continued_width; | 889 wd = continued_width; |
891 h = continued_height; | 890 h = continued_height; |
892 pixmap = continued_bmp; | 891 pixmap = continued_bmp; |
893 break; | 892 break; |
894 | 893 |
895 case CONTINUATION_LINE_BITMAP: | 894 case CONTINUATION_LINE_BITMAP: |
896 wd = continuation_width; | 895 wd = continuation_width; |
897 h = continuation_height; | 896 h = continuation_height; |
898 pixmap = continuation_bmp; | 897 pixmap = continuation_bmp; |
899 break; | 898 break; |
957 } | 956 } |
958 | 957 |
959 if (b1 >= 0) | 958 if (b1 >= 0) |
960 { | 959 { |
961 int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 960 int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
962 | 961 |
963 w32_fill_area (f, hdc, face->background, | 962 w32_fill_area (f, hdc, face->background, |
964 b1, | 963 b1, |
965 WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, | 964 WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, |
966 row->y)), | 965 row->y)), |
967 b2, | 966 b2, |
1085 | 1084 |
1086 /* Set a nominal cursor position. | 1085 /* Set a nominal cursor position. |
1087 | 1086 |
1088 HPOS and VPOS are column/row positions in a window glyph matrix. X | 1087 HPOS and VPOS are column/row positions in a window glyph matrix. X |
1089 and Y are window text area relative pixel positions. | 1088 and Y are window text area relative pixel positions. |
1090 | 1089 |
1091 If this is done during an update, updated_window will contain the | 1090 If this is done during an update, updated_window will contain the |
1092 window that is being updated and the position is the future output | 1091 window that is being updated and the position is the future output |
1093 cursor position for that window. If updated_window is null, use | 1092 cursor position for that window. If updated_window is null, use |
1094 selected_window and display the cursor at the given position. */ | 1093 selected_window and display the cursor at the given position. */ |
1095 | 1094 |
1383 { | 1382 { |
1384 return font->double_byte_p; | 1383 return font->double_byte_p; |
1385 } | 1384 } |
1386 | 1385 |
1387 | 1386 |
1388 static BOOL | 1387 static BOOL |
1389 w32_use_unicode_for_codepage (codepage) | 1388 w32_use_unicode_for_codepage (codepage) |
1390 int codepage; | 1389 int codepage; |
1391 { | 1390 { |
1392 /* If the current codepage is supported, use Unicode for output. */ | 1391 /* If the current codepage is supported, use Unicode for output. */ |
1393 return (w32_enable_unicode_output | 1392 return (w32_enable_unicode_output |
1447 else if (font_info->encoding[charset]) | 1446 else if (font_info->encoding[charset]) |
1448 { | 1447 { |
1449 /* Fixed encoding scheme. See fontset.h for the meaning of the | 1448 /* Fixed encoding scheme. See fontset.h for the meaning of the |
1450 encoding numbers. */ | 1449 encoding numbers. */ |
1451 int enc = font_info->encoding[charset]; | 1450 int enc = font_info->encoding[charset]; |
1452 | 1451 |
1453 if ((enc == 1 || enc == 2) | 1452 if ((enc == 1 || enc == 2) |
1454 && CHARSET_DIMENSION (charset) == 2) | 1453 && CHARSET_DIMENSION (charset) == 2) |
1455 *char2b = BUILD_WCHAR_T (BYTE1 (*char2b) | 0x80, BYTE2 (*char2b)); | 1454 *char2b = BUILD_WCHAR_T (BYTE1 (*char2b) | 0x80, BYTE2 (*char2b)); |
1456 | 1455 |
1457 if (enc == 1 || enc == 3 | 1456 if (enc == 1 || enc == 3 |
1458 || (enc == 4 && CHARSET_DIMENSION (charset) == 1)) | 1457 || (enc == 4 && CHARSET_DIMENSION (charset) == 1)) |
1459 *char2b = BUILD_WCHAR_T (BYTE1 (*char2b), BYTE2 (*char2b) | 0x80); | 1458 *char2b = BUILD_WCHAR_T (BYTE1 (*char2b), BYTE2 (*char2b) | 0x80); |
1460 else if (enc == 4) | 1459 else if (enc == 4) |
1461 { | 1460 { |
1529 *char2b = BUILD_WCHAR_T (0, c); | 1528 *char2b = BUILD_WCHAR_T (0, c); |
1530 } | 1529 } |
1531 else | 1530 else |
1532 { | 1531 { |
1533 int c1, c2, charset; | 1532 int c1, c2, charset; |
1534 | 1533 |
1535 /* Split characters into bytes. If c2 is -1 afterwards, C is | 1534 /* Split characters into bytes. If c2 is -1 afterwards, C is |
1536 really a one-byte character so that byte1 is zero. */ | 1535 really a one-byte character so that byte1 is zero. */ |
1537 SPLIT_CHAR (c, charset, c1, c2); | 1536 SPLIT_CHAR (c, charset, c1, c2); |
1538 if (c2 > 0) | 1537 if (c2 > 0) |
1539 *char2b = BUILD_WCHAR_T (c1, c2); | 1538 *char2b = BUILD_WCHAR_T (c1, c2); |
1540 else | 1539 else |
1541 *char2b = BUILD_WCHAR_T (0, c1); | 1540 *char2b = BUILD_WCHAR_T (0, c1); |
1542 | 1541 |
1543 /* Maybe encode the character in *CHAR2B. */ | 1542 /* Maybe encode the character in *CHAR2B. */ |
1544 if (face->font != NULL) | 1543 if (face->font != NULL) |
1545 { | 1544 { |
1546 struct font_info *font_info | 1545 struct font_info *font_info |
1547 = FONT_INFO_FROM_ID (f, face->font_info_id); | 1546 = FONT_INFO_FROM_ID (f, face->font_info_id); |
1551 } | 1550 } |
1552 | 1551 |
1553 /* Make sure X resources of the face are allocated. */ | 1552 /* Make sure X resources of the face are allocated. */ |
1554 xassert (face != NULL); | 1553 xassert (face != NULL); |
1555 PREPARE_FACE_FOR_DISPLAY (f, face); | 1554 PREPARE_FACE_FOR_DISPLAY (f, face); |
1556 | 1555 |
1557 return face; | 1556 return face; |
1558 } | 1557 } |
1559 | 1558 |
1560 | 1559 |
1561 /* Get face and two-byte form of character glyph GLYPH on frame F. | 1560 /* Get face and two-byte form of character glyph GLYPH on frame F. |
1593 *char2b = BUILD_WCHAR_T (0, glyph->u.ch); | 1592 *char2b = BUILD_WCHAR_T (0, glyph->u.ch); |
1594 } | 1593 } |
1595 else | 1594 else |
1596 { | 1595 { |
1597 int c1, c2, charset; | 1596 int c1, c2, charset; |
1598 | 1597 |
1599 /* Split characters into bytes. If c2 is -1 afterwards, C is | 1598 /* Split characters into bytes. If c2 is -1 afterwards, C is |
1600 really a one-byte character so that byte1 is zero. */ | 1599 really a one-byte character so that byte1 is zero. */ |
1601 SPLIT_CHAR (glyph->u.ch, charset, c1, c2); | 1600 SPLIT_CHAR (glyph->u.ch, charset, c1, c2); |
1602 if (c2 > 0) | 1601 if (c2 > 0) |
1603 *char2b = BUILD_WCHAR_T (c1, c2); | 1602 *char2b = BUILD_WCHAR_T (c1, c2); |
1622 PREPARE_FACE_FOR_DISPLAY (f, face); | 1621 PREPARE_FACE_FOR_DISPLAY (f, face); |
1623 return face; | 1622 return face; |
1624 } | 1623 } |
1625 | 1624 |
1626 | 1625 |
1627 /* Store one glyph for IT->char_to_display in IT->glyph_row. | 1626 /* Store one glyph for IT->char_to_display in IT->glyph_row. |
1628 Called from x_produce_glyphs when IT->glyph_row is non-null. */ | 1627 Called from x_produce_glyphs when IT->glyph_row is non-null. */ |
1629 | 1628 |
1630 static INLINE void | 1629 static INLINE void |
1631 x_append_glyph (it) | 1630 x_append_glyph (it) |
1632 struct it *it; | 1631 struct it *it; |
1633 { | 1632 { |
1634 struct glyph *glyph; | 1633 struct glyph *glyph; |
1635 enum glyph_row_area area = it->area; | 1634 enum glyph_row_area area = it->area; |
1636 | 1635 |
1637 xassert (it->glyph_row); | 1636 xassert (it->glyph_row); |
1638 xassert (it->char_to_display != '\n' && it->char_to_display != '\t'); | 1637 xassert (it->char_to_display != '\n' && it->char_to_display != '\t'); |
1639 | 1638 |
1640 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; | 1639 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
1641 if (glyph < it->glyph_row->glyphs[area + 1]) | 1640 if (glyph < it->glyph_row->glyphs[area + 1]) |
1642 { | 1641 { |
1643 glyph->charpos = CHARPOS (it->position); | 1642 glyph->charpos = CHARPOS (it->position); |
1644 glyph->object = it->object; | 1643 glyph->object = it->object; |
1657 glyph->w32_font_type = UNKNOWN_FONT; | 1656 glyph->w32_font_type = UNKNOWN_FONT; |
1658 ++it->glyph_row->used[area]; | 1657 ++it->glyph_row->used[area]; |
1659 } | 1658 } |
1660 } | 1659 } |
1661 | 1660 |
1662 /* Store one glyph for the composition IT->cmp_id in IT->glyph_row. | 1661 /* Store one glyph for the composition IT->cmp_id in IT->glyph_row. |
1663 Called from x_produce_glyphs when IT->glyph_row is non-null. */ | 1662 Called from x_produce_glyphs when IT->glyph_row is non-null. */ |
1664 | 1663 |
1665 static INLINE void | 1664 static INLINE void |
1666 x_append_composite_glyph (it) | 1665 x_append_composite_glyph (it) |
1667 struct it *it; | 1666 struct it *it; |
1668 { | 1667 { |
1669 struct glyph *glyph; | 1668 struct glyph *glyph; |
1670 enum glyph_row_area area = it->area; | 1669 enum glyph_row_area area = it->area; |
1671 | 1670 |
1672 xassert (it->glyph_row); | 1671 xassert (it->glyph_row); |
1673 | 1672 |
1674 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; | 1673 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
1675 if (glyph < it->glyph_row->glyphs[area + 1]) | 1674 if (glyph < it->glyph_row->glyphs[area + 1]) |
1676 { | 1675 { |
1677 glyph->charpos = CHARPOS (it->position); | 1676 glyph->charpos = CHARPOS (it->position); |
1678 glyph->object = it->object; | 1677 glyph->object = it->object; |
1739 it->ascent = it->phys_ascent = image_ascent (img, face); | 1738 it->ascent = it->phys_ascent = image_ascent (img, face); |
1740 it->descent = it->phys_descent = img->height + 2 * img->vmargin - it->ascent; | 1739 it->descent = it->phys_descent = img->height + 2 * img->vmargin - it->ascent; |
1741 it->pixel_width = img->width + 2 * img->hmargin; | 1740 it->pixel_width = img->width + 2 * img->hmargin; |
1742 | 1741 |
1743 it->nglyphs = 1; | 1742 it->nglyphs = 1; |
1744 | 1743 |
1745 if (face->box != FACE_NO_BOX) | 1744 if (face->box != FACE_NO_BOX) |
1746 { | 1745 { |
1747 if (face->box_line_width > 0) | 1746 if (face->box_line_width > 0) |
1748 { | 1747 { |
1749 it->ascent += face->box_line_width; | 1748 it->ascent += face->box_line_width; |
1750 it->descent += face->box_line_width; | 1749 it->descent += face->box_line_width; |
1751 } | 1750 } |
1752 | 1751 |
1753 if (it->start_of_box_run_p) | 1752 if (it->start_of_box_run_p) |
1754 it->pixel_width += abs (face->box_line_width); | 1753 it->pixel_width += abs (face->box_line_width); |
1755 if (it->end_of_box_run_p) | 1754 if (it->end_of_box_run_p) |
1756 it->pixel_width += abs (face->box_line_width); | 1755 it->pixel_width += abs (face->box_line_width); |
1757 } | 1756 } |
1758 | 1757 |
1759 take_vertical_position_into_account (it); | 1758 take_vertical_position_into_account (it); |
1760 | 1759 |
1761 if (it->glyph_row) | 1760 if (it->glyph_row) |
1762 { | 1761 { |
1763 struct glyph *glyph; | 1762 struct glyph *glyph; |
1764 enum glyph_row_area area = it->area; | 1763 enum glyph_row_area area = it->area; |
1765 | 1764 |
1766 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; | 1765 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
1767 if (glyph < it->glyph_row->glyphs[area + 1]) | 1766 if (glyph < it->glyph_row->glyphs[area + 1]) |
1768 { | 1767 { |
1769 glyph->charpos = CHARPOS (it->position); | 1768 glyph->charpos = CHARPOS (it->position); |
1770 glyph->object = it->object; | 1769 glyph->object = it->object; |
1785 } | 1784 } |
1786 } | 1785 } |
1787 | 1786 |
1788 | 1787 |
1789 /* Append a stretch glyph to IT->glyph_row. OBJECT is the source | 1788 /* Append a stretch glyph to IT->glyph_row. OBJECT is the source |
1790 of the glyph, WIDTH and HEIGHT are the width and height of the | 1789 of the glyph, WIDTH and HEIGHT are the width and height of the |
1791 stretch. ASCENT is the percentage/100 of HEIGHT to use for the | 1790 stretch. ASCENT is the percentage/100 of HEIGHT to use for the |
1792 ascent of the glyph (0 <= ASCENT <= 1). */ | 1791 ascent of the glyph (0 <= ASCENT <= 1). */ |
1793 | 1792 |
1794 static void | 1793 static void |
1795 x_append_stretch_glyph (it, object, width, height, ascent) | 1794 x_append_stretch_glyph (it, object, width, height, ascent) |
1796 struct it *it; | 1795 struct it *it; |
1797 Lisp_Object object; | 1796 Lisp_Object object; |
1798 int width, height; | 1797 int width, height; |
1800 { | 1799 { |
1801 struct glyph *glyph; | 1800 struct glyph *glyph; |
1802 enum glyph_row_area area = it->area; | 1801 enum glyph_row_area area = it->area; |
1803 | 1802 |
1804 xassert (ascent >= 0 && ascent <= 1); | 1803 xassert (ascent >= 0 && ascent <= 1); |
1805 | 1804 |
1806 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; | 1805 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
1807 if (glyph < it->glyph_row->glyphs[area + 1]) | 1806 if (glyph < it->glyph_row->glyphs[area + 1]) |
1808 { | 1807 { |
1809 glyph->charpos = CHARPOS (it->position); | 1808 glyph->charpos = CHARPOS (it->position); |
1810 glyph->object = object; | 1809 glyph->object = object; |
1830 of the glyph property displayed. The value must be a list | 1829 of the glyph property displayed. The value must be a list |
1831 `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs | 1830 `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs |
1832 being recognized: | 1831 being recognized: |
1833 | 1832 |
1834 1. `:width WIDTH' specifies that the space should be WIDTH * | 1833 1. `:width WIDTH' specifies that the space should be WIDTH * |
1835 canonical char width wide. WIDTH may be an integer or floating | 1834 canonical char width wide. WIDTH may be an integer or floating |
1836 point number. | 1835 point number. |
1837 | 1836 |
1838 2. `:relative-width FACTOR' specifies that the width of the stretch | 1837 2. `:relative-width FACTOR' specifies that the width of the stretch |
1839 should be computed from the width of the first character having the | 1838 should be computed from the width of the first character having the |
1840 `glyph' property, and should be FACTOR times that width. | 1839 `glyph' property, and should be FACTOR times that width. |
1841 | 1840 |
1842 3. `:align-to HPOS' specifies that the space should be wide enough | 1841 3. `:align-to HPOS' specifies that the space should be wide enough |
1843 to reach HPOS, a value in canonical character units. | 1842 to reach HPOS, a value in canonical character units. |
1844 | 1843 |
1845 Exactly one of the above pairs must be present. | 1844 Exactly one of the above pairs must be present. |
1846 | 1845 |
1847 4. `:height HEIGHT' specifies that the height of the stretch produced | 1846 4. `:height HEIGHT' specifies that the height of the stretch produced |
1848 should be HEIGHT, measured in canonical character units. | 1847 should be HEIGHT, measured in canonical character units. |
1849 | 1848 |
1850 5. `:relative-height FACTOR' specifies that the height of the | 1849 5. `:relative-height FACTOR' specifies that the height of the |
1878 double width = 0, height = 0, ascent = 0; | 1877 double width = 0, height = 0, ascent = 0; |
1879 struct face *face = FACE_FROM_ID (it->f, it->face_id); | 1878 struct face *face = FACE_FROM_ID (it->f, it->face_id); |
1880 XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f); | 1879 XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f); |
1881 | 1880 |
1882 PREPARE_FACE_FOR_DISPLAY (it->f, face); | 1881 PREPARE_FACE_FOR_DISPLAY (it->f, face); |
1883 | 1882 |
1884 /* List should start with `space'. */ | 1883 /* List should start with `space'. */ |
1885 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace)); | 1884 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace)); |
1886 plist = XCDR (it->object); | 1885 plist = XCDR (it->object); |
1887 | 1886 |
1888 /* Compute the width of the stretch. */ | 1887 /* Compute the width of the stretch. */ |
1896 /* Relative width `:relative-width FACTOR' specified and valid. | 1895 /* Relative width `:relative-width FACTOR' specified and valid. |
1897 Compute the width of the characters having the `glyph' | 1896 Compute the width of the characters having the `glyph' |
1898 property. */ | 1897 property. */ |
1899 struct it it2; | 1898 struct it it2; |
1900 unsigned char *p = BYTE_POS_ADDR (IT_BYTEPOS (*it)); | 1899 unsigned char *p = BYTE_POS_ADDR (IT_BYTEPOS (*it)); |
1901 | 1900 |
1902 it2 = *it; | 1901 it2 = *it; |
1903 if (it->multibyte_p) | 1902 if (it->multibyte_p) |
1904 { | 1903 { |
1905 int maxlen = ((IT_BYTEPOS (*it) >= GPT ? ZV : GPT) | 1904 int maxlen = ((IT_BYTEPOS (*it) >= GPT ? ZV : GPT) |
1906 - IT_BYTEPOS (*it)); | 1905 - IT_BYTEPOS (*it)); |
1918 NUMVAL (prop) > 0) | 1917 NUMVAL (prop) > 0) |
1919 width = NUMVAL (prop) * CANON_X_UNIT (it->f) - it->current_x; | 1918 width = NUMVAL (prop) * CANON_X_UNIT (it->f) - it->current_x; |
1920 else | 1919 else |
1921 /* Nothing specified -> width defaults to canonical char width. */ | 1920 /* Nothing specified -> width defaults to canonical char width. */ |
1922 width = CANON_X_UNIT (it->f); | 1921 width = CANON_X_UNIT (it->f); |
1923 | 1922 |
1924 /* Compute height. */ | 1923 /* Compute height. */ |
1925 if (prop = Fplist_get (plist, QCheight), | 1924 if (prop = Fplist_get (plist, QCheight), |
1926 NUMVAL (prop) > 0) | 1925 NUMVAL (prop) > 0) |
1927 height = NUMVAL (prop) * CANON_Y_UNIT (it->f); | 1926 height = NUMVAL (prop) * CANON_Y_UNIT (it->f); |
1928 else if (prop = Fplist_get (plist, QCrelative_height), | 1927 else if (prop = Fplist_get (plist, QCrelative_height), |
1929 NUMVAL (prop) > 0) | 1928 NUMVAL (prop) > 0) |
1930 height = FONT_HEIGHT (font) * NUMVAL (prop); | 1929 height = FONT_HEIGHT (font) * NUMVAL (prop); |
1931 else | 1930 else |
1932 height = FONT_HEIGHT (font); | 1931 height = FONT_HEIGHT (font); |
1933 | 1932 |
1934 /* Compute percentage of height used for ascent. If | 1933 /* Compute percentage of height used for ascent. If |
1935 `:ascent ASCENT' is present and valid, use that. Otherwise, | 1934 `:ascent ASCENT' is present and valid, use that. Otherwise, |
1936 derive the ascent from the font in use. */ | 1935 derive the ascent from the font in use. */ |
1937 if (prop = Fplist_get (plist, QCascent), | 1936 if (prop = Fplist_get (plist, QCascent), |
1938 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100) | 1937 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100) |
1939 ascent = NUMVAL (prop) / 100.0; | 1938 ascent = NUMVAL (prop) / 100.0; |
1963 if (face->box_line_width > 0) | 1962 if (face->box_line_width > 0) |
1964 { | 1963 { |
1965 it->ascent += face->box_line_width; | 1964 it->ascent += face->box_line_width; |
1966 it->descent += face->box_line_width; | 1965 it->descent += face->box_line_width; |
1967 } | 1966 } |
1968 | 1967 |
1969 if (it->start_of_box_run_p) | 1968 if (it->start_of_box_run_p) |
1970 it->pixel_width += abs (face->box_line_width); | 1969 it->pixel_width += abs (face->box_line_width); |
1971 if (it->end_of_box_run_p) | 1970 if (it->end_of_box_run_p) |
1972 it->pixel_width += abs (face->box_line_width); | 1971 it->pixel_width += abs (face->box_line_width); |
1973 } | 1972 } |
1974 | 1973 |
1975 take_vertical_position_into_account (it); | 1974 take_vertical_position_into_account (it); |
1976 } | 1975 } |
1977 | 1976 |
1978 /* Return proper value to be used as baseline offset of font that has | 1977 /* Return proper value to be used as baseline offset of font that has |
1979 ASCENT and DESCENT to draw characters by the font at the vertical | 1978 ASCENT and DESCENT to draw characters by the font at the vertical |
2061 it->multibyte_p = 1; | 2060 it->multibyte_p = 1; |
2062 it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display); | 2061 it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display); |
2063 face = FACE_FROM_ID (it->f, it->face_id); | 2062 face = FACE_FROM_ID (it->f, it->face_id); |
2064 } | 2063 } |
2065 } | 2064 } |
2066 | 2065 |
2067 /* Get font to use. Encode IT->char_to_display. */ | 2066 /* Get font to use. Encode IT->char_to_display. */ |
2068 x_get_char_face_and_encoding (it->f, it->char_to_display, | 2067 x_get_char_face_and_encoding (it->f, it->char_to_display, |
2069 it->face_id, &char2b, | 2068 it->face_id, &char2b, |
2070 it->multibyte_p); | 2069 it->multibyte_p); |
2071 font = face->font; | 2070 font = face->font; |
2110 it->glyph_not_available_p = 1; | 2109 it->glyph_not_available_p = 1; |
2111 it->phys_ascent = FONT_BASE (font) + boff; | 2110 it->phys_ascent = FONT_BASE (font) + boff; |
2112 it->phys_descent = FONT_DESCENT (font) - boff; | 2111 it->phys_descent = FONT_DESCENT (font) - boff; |
2113 it->pixel_width = FONT_WIDTH (font); | 2112 it->pixel_width = FONT_WIDTH (font); |
2114 } | 2113 } |
2115 | 2114 |
2116 /* If this is a space inside a region of text with | 2115 /* If this is a space inside a region of text with |
2117 `space-width' property, change its width. */ | 2116 `space-width' property, change its width. */ |
2118 stretched_p = it->char_to_display == ' ' && !NILP (it->space_width); | 2117 stretched_p = it->char_to_display == ' ' && !NILP (it->space_width); |
2119 if (stretched_p) | 2118 if (stretched_p) |
2120 it->pixel_width *= XFLOATINT (it->space_width); | 2119 it->pixel_width *= XFLOATINT (it->space_width); |
2123 height. If character has a box line to the left and/or | 2122 height. If character has a box line to the left and/or |
2124 right, add the box line width to the character's width. */ | 2123 right, add the box line width to the character's width. */ |
2125 if (face->box != FACE_NO_BOX) | 2124 if (face->box != FACE_NO_BOX) |
2126 { | 2125 { |
2127 int thick = face->box_line_width; | 2126 int thick = face->box_line_width; |
2128 | 2127 |
2129 if (thick > 0) | 2128 if (thick > 0) |
2130 { | 2129 { |
2131 it->ascent += thick; | 2130 it->ascent += thick; |
2132 it->descent += thick; | 2131 it->descent += thick; |
2133 } | 2132 } |
2134 else | 2133 else |
2135 thick = -thick; | 2134 thick = -thick; |
2136 | 2135 |
2137 if (it->start_of_box_run_p) | 2136 if (it->start_of_box_run_p) |
2138 it->pixel_width += thick; | 2137 it->pixel_width += thick; |
2139 if (it->end_of_box_run_p) | 2138 if (it->end_of_box_run_p) |
2140 it->pixel_width += thick; | 2139 it->pixel_width += thick; |
2141 } | 2140 } |
2144 (1 pixel) and a 1 pixel margin to the character height. */ | 2143 (1 pixel) and a 1 pixel margin to the character height. */ |
2145 if (face->overline_p) | 2144 if (face->overline_p) |
2146 it->ascent += 2; | 2145 it->ascent += 2; |
2147 | 2146 |
2148 take_vertical_position_into_account (it); | 2147 take_vertical_position_into_account (it); |
2149 | 2148 |
2150 /* If we have to actually produce glyphs, do it. */ | 2149 /* If we have to actually produce glyphs, do it. */ |
2151 if (it->glyph_row) | 2150 if (it->glyph_row) |
2152 { | 2151 { |
2153 if (stretched_p) | 2152 if (stretched_p) |
2154 { | 2153 { |
2155 /* Translate a space with a `space-width' property | 2154 /* Translate a space with a `space-width' property |
2156 into a stretch glyph. */ | 2155 into a stretch glyph. */ |
2157 double ascent = (double) FONT_BASE (font) | 2156 double ascent = (double) FONT_BASE (font) |
2158 / FONT_HEIGHT (font); | 2157 / FONT_HEIGHT (font); |
2159 x_append_stretch_glyph (it, it->object, it->pixel_width, | 2158 x_append_stretch_glyph (it, it->object, it->pixel_width, |
2160 it->ascent + it->descent, ascent); | 2159 it->ascent + it->descent, ascent); |
2161 } | 2160 } |
2162 else | 2161 else |
2163 x_append_glyph (it); | 2162 x_append_glyph (it); |
2164 | 2163 |
2174 /* A newline has no width but we need the height of the line. */ | 2173 /* A newline has no width but we need the height of the line. */ |
2175 it->pixel_width = 0; | 2174 it->pixel_width = 0; |
2176 it->nglyphs = 0; | 2175 it->nglyphs = 0; |
2177 it->ascent = it->phys_ascent = FONT_BASE (font) + boff; | 2176 it->ascent = it->phys_ascent = FONT_BASE (font) + boff; |
2178 it->descent = it->phys_descent = FONT_DESCENT (font) - boff; | 2177 it->descent = it->phys_descent = FONT_DESCENT (font) - boff; |
2179 | 2178 |
2180 if (face->box != FACE_NO_BOX | 2179 if (face->box != FACE_NO_BOX |
2181 && face->box_line_width > 0) | 2180 && face->box_line_width > 0) |
2182 { | 2181 { |
2183 it->ascent += face->box_line_width; | 2182 it->ascent += face->box_line_width; |
2184 it->descent += face->box_line_width; | 2183 it->descent += face->box_line_width; |
2187 else if (it->char_to_display == '\t') | 2186 else if (it->char_to_display == '\t') |
2188 { | 2187 { |
2189 int tab_width = it->tab_width * CANON_X_UNIT (it->f); | 2188 int tab_width = it->tab_width * CANON_X_UNIT (it->f); |
2190 int x = it->current_x + it->continuation_lines_width; | 2189 int x = it->current_x + it->continuation_lines_width; |
2191 int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; | 2190 int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; |
2192 | 2191 |
2193 /* If the distance from the current position to the next tab | 2192 /* If the distance from the current position to the next tab |
2194 stop is less than a canonical character width, use the | 2193 stop is less than a canonical character width, use the |
2195 tab stop after that. */ | 2194 tab stop after that. */ |
2196 if (next_tab_x - x < CANON_X_UNIT (it->f)) | 2195 if (next_tab_x - x < CANON_X_UNIT (it->f)) |
2197 next_tab_x += tab_width; | 2196 next_tab_x += tab_width; |
2198 | 2197 |
2199 it->pixel_width = next_tab_x - x; | 2198 it->pixel_width = next_tab_x - x; |
2200 it->nglyphs = 1; | 2199 it->nglyphs = 1; |
2201 it->ascent = it->phys_ascent = FONT_BASE (font) + boff; | 2200 it->ascent = it->phys_ascent = FONT_BASE (font) + boff; |
2202 it->descent = it->phys_descent = FONT_DESCENT (font) - boff; | 2201 it->descent = it->phys_descent = FONT_DESCENT (font) - boff; |
2203 | 2202 |
2204 if (it->glyph_row) | 2203 if (it->glyph_row) |
2205 { | 2204 { |
2206 double ascent = (double) it->ascent / (it->ascent + it->descent); | 2205 double ascent = (double) it->ascent / (it->ascent + it->descent); |
2207 x_append_stretch_glyph (it, it->object, it->pixel_width, | 2206 x_append_stretch_glyph (it, it->object, it->pixel_width, |
2208 it->ascent + it->descent, ascent); | 2207 it->ascent + it->descent, ascent); |
2209 } | 2208 } |
2210 } | 2209 } |
2211 else | 2210 else |
2212 { | 2211 { |
2213 /* A multi-byte character. | 2212 /* A multi-byte character. |
2214 If we found a font, this font should give us the right | 2213 If we found a font, this font should give us the right |
2215 metrics. If we didn't find a font, use the frame's | 2214 metrics. If we didn't find a font, use the frame's |
2216 default font and calculate the width of the character | 2215 default font and calculate the width of the character |
2259 it->ascent += thick; | 2258 it->ascent += thick; |
2260 it->descent += thick; | 2259 it->descent += thick; |
2261 } | 2260 } |
2262 else | 2261 else |
2263 thick = - thick; | 2262 thick = - thick; |
2264 | 2263 |
2265 if (it->start_of_box_run_p) | 2264 if (it->start_of_box_run_p) |
2266 it->pixel_width += thick; | 2265 it->pixel_width += thick; |
2267 if (it->end_of_box_run_p) | 2266 if (it->end_of_box_run_p) |
2268 it->pixel_width += thick; | 2267 it->pixel_width += thick; |
2269 } | 2268 } |
2270 | 2269 |
2271 /* If face has an overline, add the height of the overline | 2270 /* If face has an overline, add the height of the overline |
2272 (1 pixel) and a 1 pixel margin to the character height. */ | 2271 (1 pixel) and a 1 pixel margin to the character height. */ |
2273 if (face->overline_p) | 2272 if (face->overline_p) |
2274 it->ascent += 2; | 2273 it->ascent += 2; |
2275 | 2274 |
2276 take_vertical_position_into_account (it); | 2275 take_vertical_position_into_account (it); |
2277 | 2276 |
2278 if (it->glyph_row) | 2277 if (it->glyph_row) |
2279 x_append_glyph (it); | 2278 x_append_glyph (it); |
2280 } | 2279 } |
2281 it->multibyte_p = saved_multibyte_p; | 2280 it->multibyte_p = saved_multibyte_p; |
2282 } | 2281 } |
2374 { | 2373 { |
2375 width = FONT_WIDTH (font); | 2374 width = FONT_WIDTH (font); |
2376 ascent = FONT_BASE (font); | 2375 ascent = FONT_BASE (font); |
2377 descent = FONT_DESCENT (font); | 2376 descent = FONT_DESCENT (font); |
2378 } | 2377 } |
2379 | 2378 |
2380 rightmost = width; | 2379 rightmost = width; |
2381 lowest = - descent + boff; | 2380 lowest = - descent + boff; |
2382 highest = ascent + boff; | 2381 highest = ascent + boff; |
2383 leftmost = 0; | 2382 leftmost = 0; |
2384 | 2383 |
2385 if (font_info | 2384 if (font_info |
2386 && font_info->default_ascent | 2385 && font_info->default_ascent |
2387 && CHAR_TABLE_P (Vuse_default_ascent) | 2386 && CHAR_TABLE_P (Vuse_default_ascent) |
2388 && !NILP (Faref (Vuse_default_ascent, | 2387 && !NILP (Faref (Vuse_default_ascent, |
2389 make_number (it->char_to_display)))) | 2388 make_number (it->char_to_display)))) |
2547 it->ascent += thick; | 2546 it->ascent += thick; |
2548 it->descent += thick; | 2547 it->descent += thick; |
2549 } | 2548 } |
2550 else | 2549 else |
2551 thick = - thick; | 2550 thick = - thick; |
2552 | 2551 |
2553 if (it->start_of_box_run_p) | 2552 if (it->start_of_box_run_p) |
2554 it->pixel_width += thick; | 2553 it->pixel_width += thick; |
2555 if (it->end_of_box_run_p) | 2554 if (it->end_of_box_run_p) |
2556 it->pixel_width += thick; | 2555 it->pixel_width += thick; |
2557 } | 2556 } |
2558 | 2557 |
2559 /* If face has an overline, add the height of the overline | 2558 /* If face has an overline, add the height of the overline |
2560 (1 pixel) and a 1 pixel margin to the character height. */ | 2559 (1 pixel) and a 1 pixel margin to the character height. */ |
2561 if (face->overline_p) | 2560 if (face->overline_p) |
2562 it->ascent += 2; | 2561 it->ascent += 2; |
2563 | 2562 |
2564 take_vertical_position_into_account (it); | 2563 take_vertical_position_into_account (it); |
2565 | 2564 |
2566 if (it->glyph_row) | 2565 if (it->glyph_row) |
2567 x_append_composite_glyph (it); | 2566 x_append_composite_glyph (it); |
2568 } | 2567 } |
2569 else if (it->what == IT_IMAGE) | 2568 else if (it->what == IT_IMAGE) |
2570 x_produce_image_glyph (it); | 2569 x_produce_image_glyph (it); |
2607 height = FONT_HEIGHT (face->font); | 2606 height = FONT_HEIGHT (face->font); |
2608 if (face->box_line_width > 0) | 2607 if (face->box_line_width > 0) |
2609 height += 2 * face->box_line_width; | 2608 height += 2 * face->box_line_width; |
2610 } | 2609 } |
2611 } | 2610 } |
2612 | 2611 |
2613 return height; | 2612 return height; |
2614 } | 2613 } |
2615 | 2614 |
2616 | 2615 |
2617 /*********************************************************************** | 2616 /*********************************************************************** |
2799 static int x_fill_glyph_string P_ ((struct glyph_string *, int, int, int, | 2798 static int x_fill_glyph_string P_ ((struct glyph_string *, int, int, int, |
2800 int)); | 2799 int)); |
2801 static void w32_init_glyph_string P_ ((struct glyph_string *, HDC hdc, | 2800 static void w32_init_glyph_string P_ ((struct glyph_string *, HDC hdc, |
2802 wchar_t *, struct window *, | 2801 wchar_t *, struct window *, |
2803 struct glyph_row *, | 2802 struct glyph_row *, |
2804 enum glyph_row_area, int, | 2803 enum glyph_row_area, int, |
2805 enum draw_glyphs_face)); | 2804 enum draw_glyphs_face)); |
2806 static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, | 2805 static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, |
2807 enum glyph_row_area, int, int, | 2806 enum glyph_row_area, int, int, |
2808 enum draw_glyphs_face, int)); | 2807 enum draw_glyphs_face, int)); |
2809 static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); | 2808 static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); |
2845 | 2844 |
2846 #if GLYPH_DEBUG | 2845 #if GLYPH_DEBUG |
2847 static void x_check_font P_ ((struct frame *, XFontStruct *)); | 2846 static void x_check_font P_ ((struct frame *, XFontStruct *)); |
2848 #endif | 2847 #endif |
2849 | 2848 |
2850 | 2849 |
2851 /* Append the list of glyph strings with head H and tail T to the list | 2850 /* Append the list of glyph strings with head H and tail T to the list |
2852 with head *HEAD and tail *TAIL. Set *HEAD and *TAIL to the result. */ | 2851 with head *HEAD and tail *TAIL. Set *HEAD and *TAIL to the result. */ |
2853 | 2852 |
2854 static INLINE void | 2853 static INLINE void |
2855 x_append_glyph_string_lists (head, tail, h, t) | 2854 x_append_glyph_string_lists (head, tail, h, t) |
2954 } | 2953 } |
2955 } | 2954 } |
2956 | 2955 |
2957 | 2956 |
2958 /* Set up S->gc of glyph string S for drawing text in mouse face. */ | 2957 /* Set up S->gc of glyph string S for drawing text in mouse face. */ |
2959 | 2958 |
2960 static void | 2959 static void |
2961 x_set_mouse_face_gc (s) | 2960 x_set_mouse_face_gc (s) |
2962 struct glyph_string *s; | 2961 struct glyph_string *s; |
2963 { | 2962 { |
2964 int face_id; | 2963 int face_id; |
2965 struct face *face; | 2964 struct face *face; |
2966 | 2965 |
2967 /* What face has to be used last for the mouse face? */ | 2966 /* What face has to be used last for the mouse face? */ |
2968 face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id; | 2967 face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id; |
2969 face = FACE_FROM_ID (s->f, face_id); | 2968 face = FACE_FROM_ID (s->f, face_id); |
2970 if (face == NULL) | 2969 if (face == NULL) |
2971 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); | 2970 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); |
2972 | 2971 |
2973 if (s->first_glyph->type == CHAR_GLYPH) | 2972 if (s->first_glyph->type == CHAR_GLYPH) |
2974 face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch); | 2973 face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch); |
2975 else | 2974 else |
2976 face_id = FACE_FOR_CHAR (s->f, face, 0); | 2975 face_id = FACE_FOR_CHAR (s->f, face, 0); |
2977 s->face = FACE_FROM_ID (s->f, face_id); | 2976 s->face = FACE_FROM_ID (s->f, face_id); |
2984 { | 2983 { |
2985 /* Otherwise construct scratch_cursor_gc with values from FACE | 2984 /* Otherwise construct scratch_cursor_gc with values from FACE |
2986 but font FONT. */ | 2985 but font FONT. */ |
2987 XGCValues xgcv; | 2986 XGCValues xgcv; |
2988 unsigned long mask; | 2987 unsigned long mask; |
2989 | 2988 |
2990 xgcv.background = s->face->background; | 2989 xgcv.background = s->face->background; |
2991 xgcv.foreground = s->face->foreground; | 2990 xgcv.foreground = s->face->foreground; |
2992 IF_DEBUG (x_check_font (s->f, s->font)); | 2991 IF_DEBUG (x_check_font (s->f, s->font)); |
2993 xgcv.font = s->font; | 2992 xgcv.font = s->font; |
2994 mask = GCForeground | GCBackground | GCFont; | 2993 mask = GCForeground | GCBackground | GCFont; |
2995 | 2994 |
2996 if (FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc) | 2995 if (FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc) |
2997 XChangeGC (NULL, FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc, | 2996 XChangeGC (NULL, FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc, |
2998 mask, &xgcv); | 2997 mask, &xgcv); |
2999 else | 2998 else |
3000 FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc | 2999 FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc |
3001 = XCreateGC (NULL, s->window, mask, &xgcv); | 3000 = XCreateGC (NULL, s->window, mask, &xgcv); |
3002 | 3001 |
3003 s->gc = FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc; | 3002 s->gc = FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc; |
3004 } | 3003 } |
3005 | 3004 |
3006 xassert (s->gc != 0); | 3005 xassert (s->gc != 0); |
3007 } | 3006 } |
3012 matrix was built, so there isn't much to do, here. */ | 3011 matrix was built, so there isn't much to do, here. */ |
3013 | 3012 |
3014 static INLINE void | 3013 static INLINE void |
3015 x_set_mode_line_face_gc (s) | 3014 x_set_mode_line_face_gc (s) |
3016 struct glyph_string *s; | 3015 struct glyph_string *s; |
3017 { | 3016 { |
3018 s->gc = s->face->gc; | 3017 s->gc = s->face->gc; |
3019 } | 3018 } |
3020 | 3019 |
3021 | 3020 |
3022 /* Set S->gc of glyph string S for drawing that glyph string. Set | 3021 /* Set S->gc of glyph string S for drawing that glyph string. Set |
3026 static INLINE void | 3025 static INLINE void |
3027 x_set_glyph_string_gc (s) | 3026 x_set_glyph_string_gc (s) |
3028 struct glyph_string *s; | 3027 struct glyph_string *s; |
3029 { | 3028 { |
3030 PREPARE_FACE_FOR_DISPLAY (s->f, s->face); | 3029 PREPARE_FACE_FOR_DISPLAY (s->f, s->face); |
3031 | 3030 |
3032 if (s->hl == DRAW_NORMAL_TEXT) | 3031 if (s->hl == DRAW_NORMAL_TEXT) |
3033 { | 3032 { |
3034 s->gc = s->face->gc; | 3033 s->gc = s->face->gc; |
3035 s->stippled_p = s->face->stipple != 0; | 3034 s->stippled_p = s->face->stipple != 0; |
3036 } | 3035 } |
3077 | 3076 |
3078 if (s->row->full_width_p) | 3077 if (s->row->full_width_p) |
3079 { | 3078 { |
3080 /* Draw full-width. X coordinates are relative to S->w->left. */ | 3079 /* Draw full-width. X coordinates are relative to S->w->left. */ |
3081 int canon_x = CANON_X_UNIT (s->f); | 3080 int canon_x = CANON_X_UNIT (s->f); |
3082 | 3081 |
3083 r->left = WINDOW_LEFT_MARGIN (s->w) * canon_x; | 3082 r->left = WINDOW_LEFT_MARGIN (s->w) * canon_x; |
3084 r_width = XFASTINT (s->w->width) * canon_x; | 3083 r_width = XFASTINT (s->w->width) * canon_x; |
3085 | 3084 |
3086 if (FRAME_HAS_VERTICAL_SCROLL_BARS (s->f)) | 3085 if (FRAME_HAS_VERTICAL_SCROLL_BARS (s->f)) |
3087 { | 3086 { |
3088 int width = FRAME_SCROLL_BAR_WIDTH (s->f) * canon_x; | 3087 int width = FRAME_SCROLL_BAR_WIDTH (s->f) * canon_x; |
3089 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f)) | 3088 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f)) |
3090 r->left -= width; | 3089 r->left -= width; |
3091 } | 3090 } |
3092 | 3091 |
3093 r->left += FRAME_INTERNAL_BORDER_WIDTH (s->f); | 3092 r->left += FRAME_INTERNAL_BORDER_WIDTH (s->f); |
3094 | 3093 |
3095 /* Unless displaying a mode or menu bar line, which are always | 3094 /* Unless displaying a mode or menu bar line, which are always |
3096 fully visible, clip to the visible part of the row. */ | 3095 fully visible, clip to the visible part of the row. */ |
3097 if (s->w->pseudo_window_p) | 3096 if (s->w->pseudo_window_p) |
3166 | 3165 |
3167 | 3166 |
3168 /* Compute overhangs and x-positions for glyph string S and its | 3167 /* Compute overhangs and x-positions for glyph string S and its |
3169 predecessors, or successors. X is the starting x-position for S. | 3168 predecessors, or successors. X is the starting x-position for S. |
3170 BACKWARD_P non-zero means process predecessors. */ | 3169 BACKWARD_P non-zero means process predecessors. */ |
3171 | 3170 |
3172 static void | 3171 static void |
3173 x_compute_overhangs_and_x (s, x, backward_p) | 3172 x_compute_overhangs_and_x (s, x, backward_p) |
3174 struct glyph_string *s; | 3173 struct glyph_string *s; |
3175 int x; | 3174 int x; |
3176 int backward_p; | 3175 int backward_p; |
3208 struct glyph *glyph; | 3207 struct glyph *glyph; |
3209 struct frame *f; | 3208 struct frame *f; |
3210 int *left, *right; | 3209 int *left, *right; |
3211 { | 3210 { |
3212 *left = *right = 0; | 3211 *left = *right = 0; |
3213 | 3212 |
3214 if (glyph->type == CHAR_GLYPH) | 3213 if (glyph->type == CHAR_GLYPH) |
3215 { | 3214 { |
3216 XFontStruct *font; | 3215 XFontStruct *font; |
3217 struct face *face; | 3216 struct face *face; |
3218 wchar_t char2b; | 3217 wchar_t char2b; |
3254 static int | 3253 static int |
3255 x_left_overwritten (s) | 3254 x_left_overwritten (s) |
3256 struct glyph_string *s; | 3255 struct glyph_string *s; |
3257 { | 3256 { |
3258 int k; | 3257 int k; |
3259 | 3258 |
3260 if (s->left_overhang) | 3259 if (s->left_overhang) |
3261 { | 3260 { |
3262 int x = 0, i; | 3261 int x = 0, i; |
3263 struct glyph *glyphs = s->row->glyphs[s->area]; | 3262 struct glyph *glyphs = s->row->glyphs[s->area]; |
3264 int first = s->first_glyph - glyphs; | 3263 int first = s->first_glyph - glyphs; |
3316 { | 3315 { |
3317 int x = 0, i; | 3316 int x = 0, i; |
3318 struct glyph *glyphs = s->row->glyphs[s->area]; | 3317 struct glyph *glyphs = s->row->glyphs[s->area]; |
3319 int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars); | 3318 int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars); |
3320 int end = s->row->used[s->area]; | 3319 int end = s->row->used[s->area]; |
3321 | 3320 |
3322 for (i = first; i < end && s->right_overhang > x; ++i) | 3321 for (i = first; i < end && s->right_overhang > x; ++i) |
3323 x += glyphs[i].pixel_width; | 3322 x += glyphs[i].pixel_width; |
3324 | 3323 |
3325 k = i; | 3324 k = i; |
3326 } | 3325 } |
3595 { | 3594 { |
3596 /* How far below the limit this color is (0 - 1, 1 being darker). */ | 3595 /* How far below the limit this color is (0 - 1, 1 being darker). */ |
3597 double dimness = 1 - (double)bright / HIGHLIGHT_COLOR_DARK_BOOST_LIMIT; | 3596 double dimness = 1 - (double)bright / HIGHLIGHT_COLOR_DARK_BOOST_LIMIT; |
3598 /* The additive adjustment. */ | 3597 /* The additive adjustment. */ |
3599 int min_delta = delta * dimness * factor / 2; | 3598 int min_delta = delta * dimness * factor / 2; |
3600 | 3599 |
3601 if (factor < 1) | 3600 if (factor < 1) |
3602 new = PALETTERGB (max (0, min (0xff, min_delta - GetRValue (*color))), | 3601 new = PALETTERGB (max (0, min (0xff, min_delta - GetRValue (*color))), |
3603 max (0, min (0xff, min_delta - GetGValue (*color))), | 3602 max (0, min (0xff, min_delta - GetGValue (*color))), |
3604 max (0, min (0xff, min_delta - GetBValue (*color)))); | 3603 max (0, min (0xff, min_delta - GetBValue (*color)))); |
3605 else | 3604 else |
3606 new = PALETTERGB (max (0, min (0xff, min_delta + GetRValue (*color))), | 3605 new = PALETTERGB (max (0, min (0xff, min_delta + GetRValue (*color))), |
3607 max (0, min (0xff, min_delta + GetGValue (*color))), | 3606 max (0, min (0xff, min_delta + GetGValue (*color))), |
3608 max (0, min (0xff, min_delta + GetBValue (*color)))); | 3607 max (0, min (0xff, min_delta + GetBValue (*color)))); |
3609 } | 3608 } |
3610 | 3609 |
3611 if (new == *color) | 3610 if (new == *color) |
3612 new = PALETTERGB (max (0, min (0xff, delta + GetRValue (*color))), | 3611 new = PALETTERGB (max (0, min (0xff, delta + GetRValue (*color))), |
3613 max (0, min (0xff, delta + GetGValue (*color))), | 3612 max (0, min (0xff, delta + GetGValue (*color))), |
3614 max (0, min (0xff, delta + GetBValue (*color)))); | 3613 max (0, min (0xff, delta + GetBValue (*color)))); |
3615 | 3614 |
3629 string S. RELIEF is a pointer to a struct relief containing the GC | 3628 string S. RELIEF is a pointer to a struct relief containing the GC |
3630 with which lines will be drawn. Use a color that is FACTOR or | 3629 with which lines will be drawn. Use a color that is FACTOR or |
3631 DELTA lighter or darker than the relief's background which is found | 3630 DELTA lighter or darker than the relief's background which is found |
3632 in S->f->output_data.x->relief_background. If such a color cannot | 3631 in S->f->output_data.x->relief_background. If such a color cannot |
3633 be allocated, use DEFAULT_PIXEL, instead. */ | 3632 be allocated, use DEFAULT_PIXEL, instead. */ |
3634 | 3633 |
3635 static void | 3634 static void |
3636 w32_setup_relief_color (f, relief, factor, delta, default_pixel) | 3635 w32_setup_relief_color (f, relief, factor, delta, default_pixel) |
3637 struct frame *f; | 3636 struct frame *f; |
3638 struct relief *relief; | 3637 struct relief *relief; |
3639 double factor; | 3638 double factor; |
3655 if (w32_alloc_lighter_color (f, &pixel, factor, delta)) | 3654 if (w32_alloc_lighter_color (f, &pixel, factor, delta)) |
3656 { | 3655 { |
3657 relief->allocated_p = 1; | 3656 relief->allocated_p = 1; |
3658 xgcv.foreground = relief->pixel = pixel; | 3657 xgcv.foreground = relief->pixel = pixel; |
3659 } | 3658 } |
3660 | 3659 |
3661 if (relief->gc == 0) | 3660 if (relief->gc == 0) |
3662 { | 3661 { |
3663 #if 0 /* TODO: stipple */ | 3662 #if 0 /* TODO: stipple */ |
3664 xgcv.stipple = dpyinfo->gray; | 3663 xgcv.stipple = dpyinfo->gray; |
3665 mask |= GCStipple; | 3664 mask |= GCStipple; |
3742 | 3741 |
3743 if (raised_p) | 3742 if (raised_p) |
3744 gc.foreground = f->output_data.w32->black_relief.gc->foreground; | 3743 gc.foreground = f->output_data.w32->black_relief.gc->foreground; |
3745 else | 3744 else |
3746 gc.foreground = f->output_data.w32->white_relief.gc->foreground; | 3745 gc.foreground = f->output_data.w32->white_relief.gc->foreground; |
3747 | 3746 |
3748 /* Bottom. */ | 3747 /* Bottom. */ |
3749 for (i = 0; i < width; ++i) | 3748 for (i = 0; i < width; ++i) |
3750 w32_fill_area (f, hdc, gc.foreground, | 3749 w32_fill_area (f, hdc, gc.foreground, |
3751 left_x + i * left_p, bottom_y - i, | 3750 left_x + i * left_p, bottom_y - i, |
3752 right_x - left_x - i * (left_p + right_p) + 1, 1); | 3751 right_x - left_x - i * (left_p + right_p) + 1, 1); |
3753 | 3752 |
3754 /* Right. */ | 3753 /* Right. */ |
3755 if (right_p) | 3754 if (right_p) |
3757 w32_fill_area (f, hdc, gc.foreground, | 3756 w32_fill_area (f, hdc, gc.foreground, |
3758 right_x - i, top_y + i + 1, 1, | 3757 right_x - i, top_y + i + 1, 1, |
3759 bottom_y - top_y - 2 * i - 1); | 3758 bottom_y - top_y - 2 * i - 1); |
3760 | 3759 |
3761 w32_set_clip_rectangle (hdc, NULL); | 3760 w32_set_clip_rectangle (hdc, NULL); |
3762 | 3761 |
3763 release_frame_dc (f, hdc); | 3762 release_frame_dc (f, hdc); |
3764 } | 3763 } |
3765 | 3764 |
3766 | 3765 |
3767 /* Draw a box on frame F inside the rectangle given by LEFT_X, TOP_Y, | 3766 /* Draw a box on frame F inside the rectangle given by LEFT_X, TOP_Y, |
3777 struct glyph_string *s; | 3776 struct glyph_string *s; |
3778 int left_x, top_y, right_x, bottom_y, width, left_p, right_p; | 3777 int left_x, top_y, right_x, bottom_y, width, left_p, right_p; |
3779 RECT *clip_rect; | 3778 RECT *clip_rect; |
3780 { | 3779 { |
3781 w32_set_clip_rectangle (s->hdc, clip_rect); | 3780 w32_set_clip_rectangle (s->hdc, clip_rect); |
3782 | 3781 |
3783 /* Top. */ | 3782 /* Top. */ |
3784 w32_fill_area (s->f, s->hdc, s->face->box_color, | 3783 w32_fill_area (s->f, s->hdc, s->face->box_color, |
3785 left_x, top_y, right_x - left_x + 1, width); | 3784 left_x, top_y, right_x - left_x + 1, width); |
3786 | 3785 |
3787 /* Left. */ | 3786 /* Left. */ |
3788 if (left_p) | 3787 if (left_p) |
3789 { | 3788 { |
3790 w32_fill_area (s->f, s->hdc, s->face->box_color, | 3789 w32_fill_area (s->f, s->hdc, s->face->box_color, |
3791 left_x, top_y, width, bottom_y - top_y + 1); | 3790 left_x, top_y, width, bottom_y - top_y + 1); |
3792 } | 3791 } |
3793 | 3792 |
3794 /* Bottom. */ | 3793 /* Bottom. */ |
3795 w32_fill_area (s->f, s->hdc, s->face->box_color, | 3794 w32_fill_area (s->f, s->hdc, s->face->box_color, |
3796 left_x, bottom_y - width + 1, right_x - left_x + 1, width); | 3795 left_x, bottom_y - width + 1, right_x - left_x + 1, width); |
3797 | 3796 |
3798 /* Right. */ | 3797 /* Right. */ |
3799 if (right_p) | 3798 if (right_p) |
3800 { | 3799 { |
3801 w32_fill_area (s->f, s->hdc, s->face->box_color, | 3800 w32_fill_area (s->f, s->hdc, s->face->box_color, |
3802 right_x - width + 1, top_y, width, bottom_y - top_y + 1); | 3801 right_x - width + 1, top_y, width, bottom_y - top_y + 1); |
3823 { | 3822 { |
3824 last_x += FRAME_X_RIGHT_FRINGE_WIDTH (s->f); | 3823 last_x += FRAME_X_RIGHT_FRINGE_WIDTH (s->f); |
3825 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f)) | 3824 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f)) |
3826 last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f); | 3825 last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f); |
3827 } | 3826 } |
3828 | 3827 |
3829 /* The glyph that may have a right box line. */ | 3828 /* The glyph that may have a right box line. */ |
3830 last_glyph = (s->cmp || s->img | 3829 last_glyph = (s->cmp || s->img |
3831 ? s->first_glyph | 3830 ? s->first_glyph |
3832 : s->first_glyph + s->nchars - 1); | 3831 : s->first_glyph + s->nchars - 1); |
3833 | 3832 |
3846 || s->prev->hl != s->hl))); | 3845 || s->prev->hl != s->hl))); |
3847 right_p = (last_glyph->right_box_line_p | 3846 right_p = (last_glyph->right_box_line_p |
3848 || (s->hl == DRAW_MOUSE_FACE | 3847 || (s->hl == DRAW_MOUSE_FACE |
3849 && (s->next == NULL | 3848 && (s->next == NULL |
3850 || s->next->hl != s->hl))); | 3849 || s->next->hl != s->hl))); |
3851 | 3850 |
3852 w32_get_glyph_string_clip_rect (s, &clip_rect); | 3851 w32_get_glyph_string_clip_rect (s, &clip_rect); |
3853 | 3852 |
3854 if (s->face->box == FACE_SIMPLE_BOX) | 3853 if (s->face->box == FACE_SIMPLE_BOX) |
3855 w32_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, | 3854 w32_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, |
3856 left_p, right_p, &clip_rect); | 3855 left_p, right_p, &clip_rect); |
3905 xgcv.clip_mask = s->img->mask; | 3904 xgcv.clip_mask = s->img->mask; |
3906 xgcv.clip_x_origin = x; | 3905 xgcv.clip_x_origin = x; |
3907 xgcv.clip_y_origin = y; | 3906 xgcv.clip_y_origin = y; |
3908 xgcv.function = GXcopy; | 3907 xgcv.function = GXcopy; |
3909 XChangeGC (s->display, s->gc, mask, &xgcv); | 3908 XChangeGC (s->display, s->gc, mask, &xgcv); |
3910 | 3909 |
3911 w32_get_glyph_string_clip_rect (s, &clip_rect); | 3910 w32_get_glyph_string_clip_rect (s, &clip_rect); |
3912 image_rect.x = x; | 3911 image_rect.x = x; |
3913 image_rect.y = y; | 3912 image_rect.y = y; |
3914 image_rect.width = s->img->width; | 3913 image_rect.width = s->img->width; |
3915 image_rect.height = s->img->height; | 3914 image_rect.height = s->img->height; |
3975 { | 3974 { |
3976 int x0, y0, x1, y1, thick, raised_p; | 3975 int x0, y0, x1, y1, thick, raised_p; |
3977 RECT r; | 3976 RECT r; |
3978 int x; | 3977 int x; |
3979 int y = s->ybase - image_ascent (s->img, s->face); | 3978 int y = s->ybase - image_ascent (s->img, s->face); |
3980 | 3979 |
3981 /* If first glyph of S has a left box line, start drawing it to the | 3980 /* If first glyph of S has a left box line, start drawing it to the |
3982 right of that line. */ | 3981 right of that line. */ |
3983 if (s->face->box != FACE_NO_BOX | 3982 if (s->face->box != FACE_NO_BOX |
3984 && s->first_glyph->left_box_line_p) | 3983 && s->first_glyph->left_box_line_p) |
3985 x = s->x + abs (s->face->box_line_width); | 3984 x = s->x + abs (s->face->box_line_width); |
3986 else | 3985 else |
3987 x = s->x; | 3986 x = s->x; |
3988 | 3987 |
3989 /* If there is a margin around the image, adjust x- and y-position | 3988 /* If there is a margin around the image, adjust x- and y-position |
3990 by that margin. */ | 3989 by that margin. */ |
3991 x += s->img->hmargin; | 3990 x += s->img->hmargin; |
3992 y += s->img->vmargin; | 3991 y += s->img->vmargin; |
3993 | 3992 |
3994 if (s->hl == DRAW_IMAGE_SUNKEN | 3993 if (s->hl == DRAW_IMAGE_SUNKEN |
3995 || s->hl == DRAW_IMAGE_RAISED) | 3994 || s->hl == DRAW_IMAGE_RAISED) |
3996 { | 3995 { |
3997 thick = tool_bar_button_relief >= 0 ? tool_bar_button_relief : DEFAULT_TOOL_BAR_BUTTON_RELIEF; | 3996 thick = tool_bar_button_relief >= 0 ? tool_bar_button_relief : DEFAULT_TOOL_BAR_BUTTON_RELIEF; |
3998 raised_p = s->hl == DRAW_IMAGE_RAISED; | 3997 raised_p = s->hl == DRAW_IMAGE_RAISED; |
4000 else | 3999 else |
4001 { | 4000 { |
4002 thick = abs (s->img->relief); | 4001 thick = abs (s->img->relief); |
4003 raised_p = s->img->relief > 0; | 4002 raised_p = s->img->relief > 0; |
4004 } | 4003 } |
4005 | 4004 |
4006 x0 = x - thick; | 4005 x0 = x - thick; |
4007 y0 = y - thick; | 4006 y0 = y - thick; |
4008 x1 = x + s->img->width + thick - 1; | 4007 x1 = x + s->img->width + thick - 1; |
4009 y1 = y + s->img->height + thick - 1; | 4008 y1 = y + s->img->height + thick - 1; |
4010 | 4009 |
4011 x_setup_relief_colors (s); | 4010 x_setup_relief_colors (s); |
4012 w32_get_glyph_string_clip_rect (s, &r); | 4011 w32_get_glyph_string_clip_rect (s, &r); |
4013 w32_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r); | 4012 w32_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r); |
4014 } | 4013 } |
4015 | 4014 |
4131 #endif | 4130 #endif |
4132 x_clear_glyph_string_rect (s, x, y, w, h); | 4131 x_clear_glyph_string_rect (s, x, y, w, h); |
4133 } | 4132 } |
4134 | 4133 |
4135 | 4134 |
4136 /* Draw image glyph string S. | 4135 /* Draw image glyph string S. |
4137 | 4136 |
4138 s->y | 4137 s->y |
4139 s->x +------------------------- | 4138 s->x +------------------------- |
4140 | s->face->box | 4139 | s->face->box |
4141 | | 4140 | |
4174 { | 4173 { |
4175 if (box_line_hwidth && s->first_glyph->left_box_line_p) | 4174 if (box_line_hwidth && s->first_glyph->left_box_line_p) |
4176 x = s->x + box_line_hwidth; | 4175 x = s->x + box_line_hwidth; |
4177 else | 4176 else |
4178 x = s->x; | 4177 x = s->x; |
4179 | 4178 |
4180 y = s->y + box_line_vwidth; | 4179 y = s->y + box_line_vwidth; |
4181 #if 0 /* TODO: image mask */ | 4180 #if 0 /* TODO: image mask */ |
4182 if (s->img->mask) | 4181 if (s->img->mask) |
4183 { | 4182 { |
4184 /* Create a pixmap as large as the glyph string. Fill it | 4183 /* Create a pixmap as large as the glyph string. Fill it |
4189 | 4188 |
4190 /* Create a pixmap as large as the glyph string. */ | 4189 /* Create a pixmap as large as the glyph string. */ |
4191 pixmap = XCreatePixmap (s->display, s->window, | 4190 pixmap = XCreatePixmap (s->display, s->window, |
4192 s->background_width, | 4191 s->background_width, |
4193 s->height, depth); | 4192 s->height, depth); |
4194 | 4193 |
4195 /* Don't clip in the following because we're working on the | 4194 /* Don't clip in the following because we're working on the |
4196 pixmap. */ | 4195 pixmap. */ |
4197 XSetClipMask (s->display, s->gc, None); | 4196 XSetClipMask (s->display, s->gc, None); |
4198 | 4197 |
4199 /* Fill the pixmap with the background color/stipple. */ | 4198 /* Fill the pixmap with the background color/stipple. */ |
4217 } | 4216 } |
4218 } | 4217 } |
4219 else | 4218 else |
4220 #endif | 4219 #endif |
4221 x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height); | 4220 x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height); |
4222 | 4221 |
4223 s->background_filled_p = 1; | 4222 s->background_filled_p = 1; |
4224 } | 4223 } |
4225 | 4224 |
4226 /* Draw the foreground. */ | 4225 /* Draw the foreground. */ |
4227 if (pixmap != 0) | 4226 if (pixmap != 0) |
4298 x_set_mouse_face_gc (s); | 4297 x_set_mouse_face_gc (s); |
4299 gc = s->gc; | 4298 gc = s->gc; |
4300 } | 4299 } |
4301 else | 4300 else |
4302 gc = s->face->gc; | 4301 gc = s->face->gc; |
4303 | 4302 |
4304 w32_get_glyph_string_clip_rect (s, &r); | 4303 w32_get_glyph_string_clip_rect (s, &r); |
4305 w32_set_clip_rectangle (hdc, &r); | 4304 w32_set_clip_rectangle (hdc, &r); |
4306 | 4305 |
4307 #if 0 /* TODO: stipple */ | 4306 #if 0 /* TODO: stipple */ |
4308 if (s->face->stipple) | 4307 if (s->face->stipple) |
4320 } | 4319 } |
4321 } | 4320 } |
4322 else if (!s->background_filled_p) | 4321 else if (!s->background_filled_p) |
4323 x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, | 4322 x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, |
4324 s->height); | 4323 s->height); |
4325 | 4324 |
4326 s->background_filled_p = 1; | 4325 s->background_filled_p = 1; |
4327 } | 4326 } |
4328 | 4327 |
4329 | 4328 |
4330 /* Draw glyph string S. */ | 4329 /* Draw glyph string S. */ |
4468 static int x_fill_composite_glyph_string P_ ((struct glyph_string *, | 4467 static int x_fill_composite_glyph_string P_ ((struct glyph_string *, |
4469 struct face **, int)); | 4468 struct face **, int)); |
4470 | 4469 |
4471 | 4470 |
4472 /* Fill glyph string S with composition components specified by S->cmp. | 4471 /* Fill glyph string S with composition components specified by S->cmp. |
4473 | 4472 |
4474 FACES is an array of faces for all components of this composition. | 4473 FACES is an array of faces for all components of this composition. |
4475 S->gidx is the index of the first component for S. | 4474 S->gidx is the index of the first component for S. |
4476 OVERLAPS_P non-zero means S should draw the foreground only, and | 4475 OVERLAPS_P non-zero means S should draw the foreground only, and |
4477 use its physical height for clipping. | 4476 use its physical height for clipping. |
4478 | 4477 |
4516 s->font = FRAME_FONT (s->f); | 4515 s->font = FRAME_FONT (s->f); |
4517 } | 4516 } |
4518 | 4517 |
4519 /* Adjust base line for subscript/superscript text. */ | 4518 /* Adjust base line for subscript/superscript text. */ |
4520 s->ybase += s->first_glyph->voffset; | 4519 s->ybase += s->first_glyph->voffset; |
4521 | 4520 |
4522 xassert (s->face && s->face->gc); | 4521 xassert (s->face && s->face->gc); |
4523 | 4522 |
4524 /* This glyph string must always be drawn with 16-bit functions. */ | 4523 /* This glyph string must always be drawn with 16-bit functions. */ |
4525 s->two_byte_p = 1; | 4524 s->two_byte_p = 1; |
4526 | 4525 |
4527 return s->gidx + s->nchars; | 4526 return s->gidx + s->nchars; |
4528 } | 4527 } |
4529 | 4528 |
4530 | 4529 |
4531 /* Fill glyph string S from a sequence of character glyphs. | 4530 /* Fill glyph string S from a sequence of character glyphs. |
4532 | 4531 |
4533 FACE_ID is the face id of the string. START is the index of the | 4532 FACE_ID is the face id of the string. START is the index of the |
4534 first glyph to consider, END is the index of the last + 1. | 4533 first glyph to consider, END is the index of the last + 1. |
4535 OVERLAPS_P non-zero means S should draw the foreground only, and | 4534 OVERLAPS_P non-zero means S should draw the foreground only, and |
4536 use its physical height for clipping. | 4535 use its physical height for clipping. |
4537 | 4536 |
4577 ++glyph; | 4576 ++glyph; |
4578 } | 4577 } |
4579 | 4578 |
4580 s->font = s->face->font; | 4579 s->font = s->face->font; |
4581 s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id); | 4580 s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id); |
4582 | 4581 |
4583 /* If the specified font could not be loaded, use the frame's font, | 4582 /* If the specified font could not be loaded, use the frame's font, |
4584 but record the fact that we couldn't load it in | 4583 but record the fact that we couldn't load it in |
4585 S->font_not_found_p so that we can draw rectangles for the | 4584 S->font_not_found_p so that we can draw rectangles for the |
4586 characters of the glyph string. */ | 4585 characters of the glyph string. */ |
4587 if (s->font == NULL || glyph_not_available_p) | 4586 if (s->font == NULL || glyph_not_available_p) |
4590 s->font = FRAME_FONT (s->f); | 4589 s->font = FRAME_FONT (s->f); |
4591 } | 4590 } |
4592 | 4591 |
4593 /* Adjust base line for subscript/superscript text. */ | 4592 /* Adjust base line for subscript/superscript text. */ |
4594 s->ybase += voffset; | 4593 s->ybase += voffset; |
4595 | 4594 |
4596 xassert (s->face && s->face->gc); | 4595 xassert (s->face && s->face->gc); |
4597 return glyph - s->row->glyphs[s->area]; | 4596 return glyph - s->row->glyphs[s->area]; |
4598 } | 4597 } |
4599 | 4598 |
4600 | 4599 |
4608 s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id); | 4607 s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id); |
4609 xassert (s->img); | 4608 xassert (s->img); |
4610 s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); | 4609 s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); |
4611 s->font = s->face->font; | 4610 s->font = s->face->font; |
4612 s->width = s->first_glyph->pixel_width; | 4611 s->width = s->first_glyph->pixel_width; |
4613 | 4612 |
4614 /* Adjust base line for subscript/superscript text. */ | 4613 /* Adjust base line for subscript/superscript text. */ |
4615 s->ybase += s->first_glyph->voffset; | 4614 s->ybase += s->first_glyph->voffset; |
4616 } | 4615 } |
4617 | 4616 |
4618 | 4617 |
4631 enum glyph_row_area area; | 4630 enum glyph_row_area area; |
4632 int start, end; | 4631 int start, end; |
4633 { | 4632 { |
4634 struct glyph *glyph, *last; | 4633 struct glyph *glyph, *last; |
4635 int voffset, face_id; | 4634 int voffset, face_id; |
4636 | 4635 |
4637 xassert (s->first_glyph->type == STRETCH_GLYPH); | 4636 xassert (s->first_glyph->type == STRETCH_GLYPH); |
4638 | 4637 |
4639 glyph = s->row->glyphs[s->area] + start; | 4638 glyph = s->row->glyphs[s->area] + start; |
4640 last = s->row->glyphs[s->area] + end; | 4639 last = s->row->glyphs[s->area] + end; |
4641 face_id = glyph->face_id; | 4640 face_id = glyph->face_id; |
4642 s->face = FACE_FROM_ID (s->f, face_id); | 4641 s->face = FACE_FROM_ID (s->f, face_id); |
4643 s->font = s->face->font; | 4642 s->font = s->face->font; |
4650 && glyph->type == STRETCH_GLYPH | 4649 && glyph->type == STRETCH_GLYPH |
4651 && glyph->voffset == voffset | 4650 && glyph->voffset == voffset |
4652 && glyph->face_id == face_id); | 4651 && glyph->face_id == face_id); |
4653 ++glyph) | 4652 ++glyph) |
4654 s->width += glyph->pixel_width; | 4653 s->width += glyph->pixel_width; |
4655 | 4654 |
4656 /* Adjust base line for subscript/superscript text. */ | 4655 /* Adjust base line for subscript/superscript text. */ |
4657 s->ybase += voffset; | 4656 s->ybase += voffset; |
4658 | 4657 |
4659 xassert (s->face); | 4658 xassert (s->face); |
4660 return glyph - s->row->glyphs[s->area]; | 4659 return glyph - s->row->glyphs[s->area]; |
4666 x_init_glyph_string because it must be allocated via `alloca'. W | 4665 x_init_glyph_string because it must be allocated via `alloca'. W |
4667 is the window on which S is drawn. ROW and AREA are the glyph row | 4666 is the window on which S is drawn. ROW and AREA are the glyph row |
4668 and area within the row from which S is constructed. START is the | 4667 and area within the row from which S is constructed. START is the |
4669 index of the first glyph structure covered by S. HL is a | 4668 index of the first glyph structure covered by S. HL is a |
4670 face-override for drawing S. */ | 4669 face-override for drawing S. */ |
4671 | 4670 |
4672 static void | 4671 static void |
4673 w32_init_glyph_string (s, hdc, char2b, w, row, area, start, hl) | 4672 w32_init_glyph_string (s, hdc, char2b, w, row, area, start, hl) |
4674 struct glyph_string *s; | 4673 struct glyph_string *s; |
4675 HDC hdc; | 4674 HDC hdc; |
4676 wchar_t *char2b; | 4675 wchar_t *char2b; |
4694 s->y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | 4693 s->y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); |
4695 | 4694 |
4696 /* Display the internal border below the tool-bar window. */ | 4695 /* Display the internal border below the tool-bar window. */ |
4697 if (s->w == XWINDOW (s->f->tool_bar_window)) | 4696 if (s->w == XWINDOW (s->f->tool_bar_window)) |
4698 s->y -= s->f->output_data.w32->internal_border_width; | 4697 s->y -= s->f->output_data.w32->internal_border_width; |
4699 | 4698 |
4700 s->ybase = s->y + row->ascent; | 4699 s->ybase = s->y + row->ascent; |
4701 } | 4700 } |
4702 | 4701 |
4703 | 4702 |
4704 /* Set background width of glyph string S. START is the index of the | 4703 /* Set background width of glyph string S. START is the index of the |
4712 int last_x; | 4711 int last_x; |
4713 { | 4712 { |
4714 /* If the face of this glyph string has to be drawn to the end of | 4713 /* If the face of this glyph string has to be drawn to the end of |
4715 the drawing area, set S->extends_to_end_of_line_p. */ | 4714 the drawing area, set S->extends_to_end_of_line_p. */ |
4716 struct face *default_face = FACE_FROM_ID (s->f, DEFAULT_FACE_ID); | 4715 struct face *default_face = FACE_FROM_ID (s->f, DEFAULT_FACE_ID); |
4717 | 4716 |
4718 if (start == s->row->used[s->area] | 4717 if (start == s->row->used[s->area] |
4719 && s->area == TEXT_AREA | 4718 && s->area == TEXT_AREA |
4720 && ((s->hl == DRAW_NORMAL_TEXT | 4719 && ((s->hl == DRAW_NORMAL_TEXT |
4721 && (s->row->fill_line_p | 4720 && (s->row->fill_line_p |
4722 || s->face->background != default_face->background | 4721 || s->face->background != default_face->background |
4724 || s->row->mouse_face_p)) | 4723 || s->row->mouse_face_p)) |
4725 || s->hl == DRAW_MOUSE_FACE | 4724 || s->hl == DRAW_MOUSE_FACE |
4726 || ((s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN) | 4725 || ((s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN) |
4727 && s->row->fill_line_p))) | 4726 && s->row->fill_line_p))) |
4728 s->extends_to_end_of_line_p = 1; | 4727 s->extends_to_end_of_line_p = 1; |
4729 | 4728 |
4730 /* If S extends its face to the end of the line, set its | 4729 /* If S extends its face to the end of the line, set its |
4731 background_width to the distance to the right edge of the drawing | 4730 background_width to the distance to the right edge of the drawing |
4732 area. */ | 4731 area. */ |
4733 if (s->extends_to_end_of_line_p) | 4732 if (s->extends_to_end_of_line_p) |
4734 s->background_width = last_x - s->x + 1; | 4733 s->background_width = last_x - s->x + 1; |
4803 s->x = (X); \ | 4802 s->x = (X); \ |
4804 START = x_fill_glyph_string (s, face_id, START, END, \ | 4803 START = x_fill_glyph_string (s, face_id, START, END, \ |
4805 OVERLAPS_P); \ | 4804 OVERLAPS_P); \ |
4806 } \ | 4805 } \ |
4807 while (0) | 4806 while (0) |
4808 | 4807 |
4809 | 4808 |
4810 /* Add a glyph string for a composite sequence to the list of strings | 4809 /* Add a glyph string for a composite sequence to the list of strings |
4811 between HEAD and TAIL. START is the index of the first glyph in | 4810 between HEAD and TAIL. START is the index of the first glyph in |
4812 row area AREA of glyph row ROW that is part of the new glyph | 4811 row area AREA of glyph row ROW that is part of the new glyph |
4813 string. END is the index of the last glyph in that glyph row area. | 4812 string. END is the index of the last glyph in that glyph row area. |
4928 | 4927 |
4929 If OVERLAPS_P is non-zero, draw only the foreground of characters | 4928 If OVERLAPS_P is non-zero, draw only the foreground of characters |
4930 and clip to the physical height of ROW. | 4929 and clip to the physical height of ROW. |
4931 | 4930 |
4932 Value is the x-position reached, relative to AREA of W. */ | 4931 Value is the x-position reached, relative to AREA of W. */ |
4933 | 4932 |
4934 static int | 4933 static int |
4935 x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | 4934 x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) |
4936 struct window *w; | 4935 struct window *w; |
4937 int x; | 4936 int x; |
4938 struct glyph_row *row; | 4937 struct glyph_row *row; |
5010 x_compute_glyph_string_overhangs (s); | 5009 x_compute_glyph_string_overhangs (s); |
5011 | 5010 |
5012 /* Prepend glyph strings for glyphs in front of the first glyph | 5011 /* Prepend glyph strings for glyphs in front of the first glyph |
5013 string that are overwritten because of the first glyph | 5012 string that are overwritten because of the first glyph |
5014 string's left overhang. The background of all strings | 5013 string's left overhang. The background of all strings |
5015 prepended must be drawn because the first glyph string | 5014 prepended must be drawn because the first glyph string |
5016 draws over it. */ | 5015 draws over it. */ |
5017 i = x_left_overwritten (head); | 5016 i = x_left_overwritten (head); |
5018 if (i >= 0) | 5017 if (i >= 0) |
5019 { | 5018 { |
5020 j = i; | 5019 j = i; |
5088 completely. */ | 5087 completely. */ |
5089 && !overlaps_p) | 5088 && !overlaps_p) |
5090 { | 5089 { |
5091 int x0 = head ? head->x : x; | 5090 int x0 = head ? head->x : x; |
5092 int x1 = tail ? tail->x + tail->background_width : x; | 5091 int x1 = tail ? tail->x + tail->background_width : x; |
5093 | 5092 |
5094 x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0); | 5093 x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0); |
5095 x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1); | 5094 x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1); |
5096 | 5095 |
5097 if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0) | 5096 if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0) |
5098 { | 5097 { |
5099 int left_area_width = window_box_width (w, LEFT_MARGIN_AREA); | 5098 int left_area_width = window_box_width (w, LEFT_MARGIN_AREA); |
5100 x0 -= left_area_width; | 5099 x0 -= left_area_width; |
5101 x1 -= left_area_width; | 5100 x1 -= left_area_width; |
5129 struct window *w; | 5128 struct window *w; |
5130 struct glyph_row *row; | 5129 struct glyph_row *row; |
5131 enum glyph_row_area area; | 5130 enum glyph_row_area area; |
5132 { | 5131 { |
5133 int i, x; | 5132 int i, x; |
5134 | 5133 |
5135 BLOCK_INPUT; | 5134 BLOCK_INPUT; |
5136 | 5135 |
5137 if (area == LEFT_MARGIN_AREA) | 5136 if (area == LEFT_MARGIN_AREA) |
5138 x = 0; | 5137 x = 0; |
5139 else if (area == TEXT_AREA) | 5138 else if (area == TEXT_AREA) |
5140 x = row->x + window_box_width (w, LEFT_MARGIN_AREA); | 5139 x = row->x + window_box_width (w, LEFT_MARGIN_AREA); |
5141 else | 5140 else |
5163 { | 5162 { |
5164 x += row->glyphs[area][i].pixel_width; | 5163 x += row->glyphs[area][i].pixel_width; |
5165 ++i; | 5164 ++i; |
5166 } | 5165 } |
5167 } | 5166 } |
5168 | 5167 |
5169 UNBLOCK_INPUT; | 5168 UNBLOCK_INPUT; |
5170 } | 5169 } |
5171 | 5170 |
5172 | 5171 |
5173 /* Output LEN glyphs starting at START at the nominal cursor position. | 5172 /* Output LEN glyphs starting at START at the nominal cursor position. |
5183 { | 5182 { |
5184 int x, hpos; | 5183 int x, hpos; |
5185 | 5184 |
5186 xassert (updated_window && updated_row); | 5185 xassert (updated_window && updated_row); |
5187 BLOCK_INPUT; | 5186 BLOCK_INPUT; |
5188 | 5187 |
5189 /* Write glyphs. */ | 5188 /* Write glyphs. */ |
5190 | 5189 |
5191 hpos = start - updated_row->glyphs[updated_area]; | 5190 hpos = start - updated_row->glyphs[updated_area]; |
5192 x = x_draw_glyphs (updated_window, output_cursor.x, | 5191 x = x_draw_glyphs (updated_window, output_cursor.x, |
5193 updated_row, updated_area, | 5192 updated_row, updated_area, |
5194 hpos, hpos + len, | 5193 hpos, hpos + len, |
5195 DRAW_NORMAL_TEXT, 0); | 5194 DRAW_NORMAL_TEXT, 0); |
5196 | 5195 |
5197 UNBLOCK_INPUT; | 5196 UNBLOCK_INPUT; |
5198 | 5197 |
5199 /* Advance the output cursor. */ | 5198 /* Advance the output cursor. */ |
5200 output_cursor.hpos += len; | 5199 output_cursor.hpos += len; |
5201 output_cursor.x = x; | 5200 output_cursor.x = x; |
5202 } | 5201 } |
5203 | 5202 |
5292 { | 5291 { |
5293 struct frame *f; | 5292 struct frame *f; |
5294 struct window *w = updated_window; | 5293 struct window *w = updated_window; |
5295 int max_x, min_y, max_y; | 5294 int max_x, min_y, max_y; |
5296 int from_x, from_y, to_y; | 5295 int from_x, from_y, to_y; |
5297 | 5296 |
5298 xassert (updated_window && updated_row); | 5297 xassert (updated_window && updated_row); |
5299 f = XFRAME (w->frame); | 5298 f = XFRAME (w->frame); |
5300 | 5299 |
5301 if (updated_row->full_width_p) | 5300 if (updated_row->full_width_p) |
5302 { | 5301 { |
5303 max_x = XFASTINT (w->width) * CANON_X_UNIT (f); | 5302 max_x = XFASTINT (w->width) * CANON_X_UNIT (f); |
5304 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f) | 5303 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
5305 && !w->pseudo_window_p) | 5304 && !w->pseudo_window_p) |
5317 to_x = max_x; | 5316 to_x = max_x; |
5318 else | 5317 else |
5319 to_x = min (to_x, max_x); | 5318 to_x = min (to_x, max_x); |
5320 | 5319 |
5321 to_y = min (max_y, output_cursor.y + updated_row->height); | 5320 to_y = min (max_y, output_cursor.y + updated_row->height); |
5322 | 5321 |
5323 /* Notice if the cursor will be cleared by this operation. */ | 5322 /* Notice if the cursor will be cleared by this operation. */ |
5324 if (!updated_row->full_width_p) | 5323 if (!updated_row->full_width_p) |
5325 notice_overwritten_cursor (w, updated_area, | 5324 notice_overwritten_cursor (w, updated_area, |
5326 output_cursor.x, -1, | 5325 output_cursor.x, -1, |
5327 updated_row->y, | 5326 updated_row->y, |
5338 else | 5337 else |
5339 { | 5338 { |
5340 from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x); | 5339 from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x); |
5341 to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x); | 5340 to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x); |
5342 } | 5341 } |
5343 | 5342 |
5344 min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 5343 min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
5345 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y)); | 5344 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y)); |
5346 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y); | 5345 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y); |
5347 | 5346 |
5348 /* Prevent inadvertently clearing to end of the X window. */ | 5347 /* Prevent inadvertently clearing to end of the X window. */ |
5349 if (to_x > from_x && to_y > from_y) | 5348 if (to_x > from_x && to_y > from_y) |
5350 { | 5349 { |
5351 HDC hdc; | 5350 HDC hdc; |
5352 BLOCK_INPUT; | 5351 BLOCK_INPUT; |
5409 if (FRAME_W32_P (f) && visible_bell) | 5408 if (FRAME_W32_P (f) && visible_bell) |
5410 { | 5409 { |
5411 int i; | 5410 int i; |
5412 HWND hwnd = FRAME_W32_WINDOW (SELECTED_FRAME ()); | 5411 HWND hwnd = FRAME_W32_WINDOW (SELECTED_FRAME ()); |
5413 | 5412 |
5414 for (i = 0; i < 5; i++) | 5413 for (i = 0; i < 5; i++) |
5415 { | 5414 { |
5416 FlashWindow (hwnd, TRUE); | 5415 FlashWindow (hwnd, TRUE); |
5417 Sleep (10); | 5416 Sleep (10); |
5418 } | 5417 } |
5419 FlashWindow (hwnd, FALSE); | 5418 FlashWindow (hwnd, FALSE); |
5507 height = run->height; | 5506 height = run->height; |
5508 expect_dirty = CreateRectRgn (x, y, x + width, to_y); | 5507 expect_dirty = CreateRectRgn (x, y, x + width, to_y); |
5509 } | 5508 } |
5510 | 5509 |
5511 BLOCK_INPUT; | 5510 BLOCK_INPUT; |
5512 | 5511 |
5513 /* Cursor off. Will be switched on again in x_update_window_end. */ | 5512 /* Cursor off. Will be switched on again in x_update_window_end. */ |
5514 updated_window = w; | 5513 updated_window = w; |
5515 x_clear_cursor (w); | 5514 x_clear_cursor (w); |
5516 | 5515 |
5517 { | 5516 { |
5545 | 5544 |
5546 | 5545 |
5547 /*********************************************************************** | 5546 /*********************************************************************** |
5548 Exposure Events | 5547 Exposure Events |
5549 ***********************************************************************/ | 5548 ***********************************************************************/ |
5550 | 5549 |
5551 /* Redisplay an exposed area of frame F. X and Y are the upper-left | 5550 /* Redisplay an exposed area of frame F. X and Y are the upper-left |
5552 corner of the exposed rectangle. W and H are width and height of | 5551 corner of the exposed rectangle. W and H are width and height of |
5553 the exposed area. All are pixel values. W or H zero means redraw | 5552 the exposed area. All are pixel values. W or H zero means redraw |
5554 the entire frame. */ | 5553 the entire frame. */ |
5555 | 5554 |
5696 && x + first->pixel_width < r->left) | 5695 && x + first->pixel_width < r->left) |
5697 { | 5696 { |
5698 x += first->pixel_width; | 5697 x += first->pixel_width; |
5699 ++first; | 5698 ++first; |
5700 } | 5699 } |
5701 | 5700 |
5702 /* Find the last one. */ | 5701 /* Find the last one. */ |
5703 last = first; | 5702 last = first; |
5704 first_x = x; | 5703 first_x = x; |
5705 while (last < end | 5704 while (last < end |
5706 && x < r->right) | 5705 && x < r->right) |
5728 struct window *w; | 5727 struct window *w; |
5729 struct glyph_row *row; | 5728 struct glyph_row *row; |
5730 RECT *r; | 5729 RECT *r; |
5731 { | 5730 { |
5732 xassert (row->enabled_p); | 5731 xassert (row->enabled_p); |
5733 | 5732 |
5734 if (row->mode_line_p || w->pseudo_window_p) | 5733 if (row->mode_line_p || w->pseudo_window_p) |
5735 x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA], | 5734 x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA], |
5736 DRAW_NORMAL_TEXT, 0); | 5735 DRAW_NORMAL_TEXT, 0); |
5737 else | 5736 else |
5738 { | 5737 { |
5786 struct window *w; | 5785 struct window *w; |
5787 struct glyph_row *first_overlapping_row; | 5786 struct glyph_row *first_overlapping_row; |
5788 struct glyph_row *last_overlapping_row; | 5787 struct glyph_row *last_overlapping_row; |
5789 { | 5788 { |
5790 struct glyph_row *row; | 5789 struct glyph_row *row; |
5791 | 5790 |
5792 for (row = first_overlapping_row; row <= last_overlapping_row; ++row) | 5791 for (row = first_overlapping_row; row <= last_overlapping_row; ++row) |
5793 if (row->overlapping_p) | 5792 if (row->overlapping_p) |
5794 { | 5793 { |
5795 xassert (row->enabled_p && !row->mode_line_p); | 5794 xassert (row->enabled_p && !row->mode_line_p); |
5796 | 5795 |
5797 if (row->used[LEFT_MARGIN_AREA]) | 5796 if (row->used[LEFT_MARGIN_AREA]) |
5798 x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA); | 5797 x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA); |
5799 | 5798 |
5800 if (row->used[TEXT_AREA]) | 5799 if (row->used[TEXT_AREA]) |
5801 x_fix_overlapping_area (w, row, TEXT_AREA); | 5800 x_fix_overlapping_area (w, row, TEXT_AREA); |
5802 | 5801 |
5803 if (row->used[RIGHT_MARGIN_AREA]) | 5802 if (row->used[RIGHT_MARGIN_AREA]) |
5804 x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA); | 5803 x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA); |
5805 } | 5804 } |
5806 } | 5805 } |
5807 | 5806 |
5886 { | 5885 { |
5887 if (first_overlapping_row == NULL) | 5886 if (first_overlapping_row == NULL) |
5888 first_overlapping_row = row; | 5887 first_overlapping_row = row; |
5889 last_overlapping_row = row; | 5888 last_overlapping_row = row; |
5890 } | 5889 } |
5891 | 5890 |
5892 if (expose_line (w, row, &r)) | 5891 if (expose_line (w, row, &r)) |
5893 mouse_face_overwritten_p = 1; | 5892 mouse_face_overwritten_p = 1; |
5894 } | 5893 } |
5895 | 5894 |
5896 if (y1 >= yb) | 5895 if (y1 >= yb) |
5910 if (!w->pseudo_window_p) | 5909 if (!w->pseudo_window_p) |
5911 { | 5910 { |
5912 /* Fix the display of overlapping rows. */ | 5911 /* Fix the display of overlapping rows. */ |
5913 if (first_overlapping_row) | 5912 if (first_overlapping_row) |
5914 expose_overlaps (w, first_overlapping_row, last_overlapping_row); | 5913 expose_overlaps (w, first_overlapping_row, last_overlapping_row); |
5915 | 5914 |
5916 /* Draw border between windows. */ | 5915 /* Draw border between windows. */ |
5917 x_draw_vertical_border (w); | 5916 x_draw_vertical_border (w); |
5918 | 5917 |
5919 /* Turn the cursor on again. */ | 5918 /* Turn the cursor on again. */ |
5920 if (cursor_cleared_p) | 5919 if (cursor_cleared_p) |
6150 } | 6149 } |
6151 | 6150 |
6152 /* Parse a button MESSAGE. The button index is returned in PBUTTON, and | 6151 /* Parse a button MESSAGE. The button index is returned in PBUTTON, and |
6153 the state in PUP. XBUTTON provides extra information for extended mouse | 6152 the state in PUP. XBUTTON provides extra information for extended mouse |
6154 button messages. Returns FALSE if unable to parse the message. */ | 6153 button messages. Returns FALSE if unable to parse the message. */ |
6155 BOOL | 6154 BOOL |
6156 parse_button (message, xbutton, pbutton, pup) | 6155 parse_button (message, xbutton, pbutton, pup) |
6157 int message; | 6156 int message; |
6158 int xbutton; | 6157 int xbutton; |
6159 int * pbutton; | 6158 int * pbutton; |
6160 int * pup; | 6159 int * pup; |
6161 { | 6160 { |
6162 int button = 0; | 6161 int button = 0; |
6163 int up = 0; | 6162 int up = 0; |
6164 | 6163 |
6165 switch (message) | 6164 switch (message) |
6166 { | 6165 { |
6167 case WM_LBUTTONDOWN: | 6166 case WM_LBUTTONDOWN: |
6168 button = 0; | 6167 button = 0; |
6169 up = 0; | 6168 up = 0; |
6209 up = 1; | 6208 up = 1; |
6210 break; | 6209 break; |
6211 default: | 6210 default: |
6212 return (FALSE); | 6211 return (FALSE); |
6213 } | 6212 } |
6214 | 6213 |
6215 if (pup) *pup = up; | 6214 if (pup) *pup = up; |
6216 if (pbutton) *pbutton = button; | 6215 if (pbutton) *pbutton = button; |
6217 | 6216 |
6218 return (TRUE); | 6217 return (TRUE); |
6219 } | 6218 } |
6220 | 6219 |
6221 | 6220 |
6222 /* Prepare a mouse-event in *RESULT for placement in the input queue. | 6221 /* Prepare a mouse-event in *RESULT for placement in the input queue. |
6475 if (w->pseudo_window_p) | 6474 if (w->pseudo_window_p) |
6476 break; | 6475 break; |
6477 else if (!buffer_only_p || BUFFERP (glyph->object)) | 6476 else if (!buffer_only_p || BUFFERP (glyph->object)) |
6478 break; | 6477 break; |
6479 } | 6478 } |
6480 | 6479 |
6481 x0 += glyph->pixel_width; | 6480 x0 += glyph->pixel_width; |
6482 ++glyph; | 6481 ++glyph; |
6483 } | 6482 } |
6484 | 6483 |
6485 if (glyph == end) | 6484 if (glyph == end) |
6538 if (row->enabled_p) | 6537 if (row->enabled_p) |
6539 { | 6538 { |
6540 struct glyph *glyph, *end; | 6539 struct glyph *glyph, *end; |
6541 Lisp_Object help, map; | 6540 Lisp_Object help, map; |
6542 int x0; | 6541 int x0; |
6543 | 6542 |
6544 /* Find the glyph under X. */ | 6543 /* Find the glyph under X. */ |
6545 glyph = row->glyphs[TEXT_AREA]; | 6544 glyph = row->glyphs[TEXT_AREA]; |
6546 end = glyph + row->used[TEXT_AREA]; | 6545 end = glyph + row->used[TEXT_AREA]; |
6547 x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f) | 6546 x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f) |
6548 + FRAME_X_LEFT_FRINGE_WIDTH (f)); | 6547 + FRAME_X_LEFT_FRINGE_WIDTH (f)); |
6549 | 6548 |
6550 while (glyph < end | 6549 while (glyph < end |
6551 && x >= x0 + glyph->pixel_width) | 6550 && x >= x0 + glyph->pixel_width) |
6552 { | 6551 { |
6553 x0 += glyph->pixel_width; | 6552 x0 += glyph->pixel_width; |
6554 ++glyph; | 6553 ++glyph; |
6902 { | 6901 { |
6903 /* A string which doesn't have mouse-face, but | 6902 /* A string which doesn't have mouse-face, but |
6904 the text ``under'' it might have. */ | 6903 the text ``under'' it might have. */ |
6905 struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); | 6904 struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); |
6906 int start = MATRIX_ROW_START_CHARPOS (r); | 6905 int start = MATRIX_ROW_START_CHARPOS (r); |
6907 | 6906 |
6908 pos = string_buffer_position (w, object, start); | 6907 pos = string_buffer_position (w, object, start); |
6909 if (pos > 0) | 6908 if (pos > 0) |
6910 mouse_face = get_char_property_and_overlay (make_number (pos), | 6909 mouse_face = get_char_property_and_overlay (make_number (pos), |
6911 Qmouse_face, | 6910 Qmouse_face, |
6912 w->buffer, | 6911 w->buffer, |
6926 &dpyinfo->mouse_face_beg_col, | 6925 &dpyinfo->mouse_face_beg_col, |
6927 &dpyinfo->mouse_face_beg_row, | 6926 &dpyinfo->mouse_face_beg_row, |
6928 &dpyinfo->mouse_face_beg_x, | 6927 &dpyinfo->mouse_face_beg_x, |
6929 &dpyinfo->mouse_face_beg_y, | 6928 &dpyinfo->mouse_face_beg_y, |
6930 object); | 6929 object); |
6931 | 6930 |
6932 dpyinfo->mouse_face_past_end | 6931 dpyinfo->mouse_face_past_end |
6933 = !fast_find_position (w, XFASTINT (after), | 6932 = !fast_find_position (w, XFASTINT (after), |
6934 &dpyinfo->mouse_face_end_col, | 6933 &dpyinfo->mouse_face_end_col, |
6935 &dpyinfo->mouse_face_end_row, | 6934 &dpyinfo->mouse_face_end_row, |
6936 &dpyinfo->mouse_face_end_x, | 6935 &dpyinfo->mouse_face_end_x, |
6958 /* Check overlays first. */ | 6957 /* Check overlays first. */ |
6959 help = overlay = Qnil; | 6958 help = overlay = Qnil; |
6960 for (i = noverlays - 1; i >= 0 && NILP (help); --i) | 6959 for (i = noverlays - 1; i >= 0 && NILP (help); --i) |
6961 { | 6960 { |
6962 overlay = overlay_vec[i]; | 6961 overlay = overlay_vec[i]; |
6963 help = Foverlay_get (overlay, Qhelp_echo); | 6962 help = Foverlay_get (overlay, Qhelp_echo); |
6964 } | 6963 } |
6965 | 6964 |
6966 if (!NILP (help)) | 6965 if (!NILP (help)) |
6967 { | 6966 { |
6968 help_echo = help; | 6967 help_echo = help; |
7005 else if (BUFFERP (object) | 7004 else if (BUFFERP (object) |
7006 && charpos >= BEGV | 7005 && charpos >= BEGV |
7007 && charpos < ZV) | 7006 && charpos < ZV) |
7008 help = Fget_text_property (make_number (charpos), Qhelp_echo, | 7007 help = Fget_text_property (make_number (charpos), Qhelp_echo, |
7009 object); | 7008 object); |
7010 | 7009 |
7011 if (!NILP (help)) | 7010 if (!NILP (help)) |
7012 { | 7011 { |
7013 help_echo = help; | 7012 help_echo = help; |
7014 help_echo_window = window; | 7013 help_echo_window = window; |
7015 help_echo_object = object; | 7014 help_echo_object = object; |
7092 || *hpos >= dpyinfo->mouse_face_beg_col) | 7091 || *hpos >= dpyinfo->mouse_face_beg_col) |
7093 && (*vpos < dpyinfo->mouse_face_end_row | 7092 && (*vpos < dpyinfo->mouse_face_end_row |
7094 || *hpos < dpyinfo->mouse_face_end_col | 7093 || *hpos < dpyinfo->mouse_face_end_col |
7095 || dpyinfo->mouse_face_past_end)) | 7094 || dpyinfo->mouse_face_past_end)) |
7096 return 0; | 7095 return 0; |
7097 | 7096 |
7098 return 1; | 7097 return 1; |
7099 } | 7098 } |
7100 | 7099 |
7101 | 7100 |
7102 /* Handle mouse button event on the tool-bar of frame F, at | 7101 /* Handle mouse button event on the tool-bar of frame F, at |
7113 int hpos, vpos, prop_idx; | 7112 int hpos, vpos, prop_idx; |
7114 struct glyph *glyph; | 7113 struct glyph *glyph; |
7115 Lisp_Object enabled_p; | 7114 Lisp_Object enabled_p; |
7116 int x = XFASTINT (button_event->x); | 7115 int x = XFASTINT (button_event->x); |
7117 int y = XFASTINT (button_event->y); | 7116 int y = XFASTINT (button_event->y); |
7118 | 7117 |
7119 /* If not on the highlighted tool-bar item, return. */ | 7118 /* If not on the highlighted tool-bar item, return. */ |
7120 frame_to_window_pixel_xy (w, &x, &y); | 7119 frame_to_window_pixel_xy (w, &x, &y); |
7121 if (x_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0) | 7120 if (x_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0) |
7122 return; | 7121 return; |
7123 | 7122 |
7124 /* If item is disabled, do nothing. */ | 7123 /* If item is disabled, do nothing. */ |
7125 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); | 7124 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); |
7126 if (NILP (enabled_p)) | 7125 if (NILP (enabled_p)) |
7127 return; | 7126 return; |
7128 | 7127 |
7129 if (button_event->modifiers & down_modifier) | 7128 if (button_event->modifiers & down_modifier) |
7130 { | 7129 { |
7131 /* Show item in pressed state. */ | 7130 /* Show item in pressed state. */ |
7132 show_mouse_face (dpyinfo, DRAW_IMAGE_SUNKEN); | 7131 show_mouse_face (dpyinfo, DRAW_IMAGE_SUNKEN); |
7133 dpyinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN; | 7132 dpyinfo->mouse_face_image_state = DRAW_IMAGE_SUNKEN; |
7200 else if (rc == 0) | 7199 else if (rc == 0) |
7201 /* On same tool-bar item as before. */ | 7200 /* On same tool-bar item as before. */ |
7202 goto set_help_echo; | 7201 goto set_help_echo; |
7203 | 7202 |
7204 clear_mouse_face (dpyinfo); | 7203 clear_mouse_face (dpyinfo); |
7205 | 7204 |
7206 /* Mouse is down, but on different tool-bar item? */ | 7205 /* Mouse is down, but on different tool-bar item? */ |
7207 mouse_down_p = (dpyinfo->grabbed | 7206 mouse_down_p = (dpyinfo->grabbed |
7208 && f == last_mouse_frame | 7207 && f == last_mouse_frame |
7209 && FRAME_LIVE_P (f)); | 7208 && FRAME_LIVE_P (f)); |
7210 if (mouse_down_p | 7209 if (mouse_down_p |
7211 && last_tool_bar_item != prop_idx) | 7210 && last_tool_bar_item != prop_idx) |
7212 return; | 7211 return; |
7213 | 7212 |
7214 dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; | 7213 dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; |
7215 draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; | 7214 draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; |
7216 | 7215 |
7217 /* If tool-bar item is not enabled, don't highlight it. */ | 7216 /* If tool-bar item is not enabled, don't highlight it. */ |
7218 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); | 7217 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); |
7219 if (!NILP (enabled_p)) | 7218 if (!NILP (enabled_p)) |
7220 { | 7219 { |
7221 /* Compute the x-position of the glyph. In front and past the | 7220 /* Compute the x-position of the glyph. In front and past the |
7222 image is a space. We include this is the highlighted area. */ | 7221 image is a space. We include this is the highlighted area. */ |
7223 row = MATRIX_ROW (w->current_matrix, vpos); | 7222 row = MATRIX_ROW (w->current_matrix, vpos); |
7224 for (i = x = 0; i < hpos; ++i) | 7223 for (i = x = 0; i < hpos; ++i) |
7225 x += row->glyphs[TEXT_AREA][i].pixel_width; | 7224 x += row->glyphs[TEXT_AREA][i].pixel_width; |
7226 | 7225 |
7227 /* Record this as the current active region. */ | 7226 /* Record this as the current active region. */ |
7228 dpyinfo->mouse_face_beg_col = hpos; | 7227 dpyinfo->mouse_face_beg_col = hpos; |
7229 dpyinfo->mouse_face_beg_row = vpos; | 7228 dpyinfo->mouse_face_beg_row = vpos; |
7230 dpyinfo->mouse_face_beg_x = x; | 7229 dpyinfo->mouse_face_beg_x = x; |
7231 dpyinfo->mouse_face_beg_y = row->y; | 7230 dpyinfo->mouse_face_beg_y = row->y; |
7232 dpyinfo->mouse_face_past_end = 0; | 7231 dpyinfo->mouse_face_past_end = 0; |
7233 | 7232 |
7234 dpyinfo->mouse_face_end_col = hpos + 1; | 7233 dpyinfo->mouse_face_end_col = hpos + 1; |
7235 dpyinfo->mouse_face_end_row = vpos; | 7234 dpyinfo->mouse_face_end_row = vpos; |
7236 dpyinfo->mouse_face_end_x = x + glyph->pixel_width; | 7235 dpyinfo->mouse_face_end_x = x + glyph->pixel_width; |
7237 dpyinfo->mouse_face_end_y = row->y; | 7236 dpyinfo->mouse_face_end_y = row->y; |
7238 dpyinfo->mouse_face_window = window; | 7237 dpyinfo->mouse_face_window = window; |
7239 dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; | 7238 dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; |
7240 | 7239 |
7241 /* Display it as active. */ | 7240 /* Display it as active. */ |
7242 show_mouse_face (dpyinfo, draw); | 7241 show_mouse_face (dpyinfo, draw); |
7243 dpyinfo->mouse_face_image_state = draw; | 7242 dpyinfo->mouse_face_image_state = draw; |
7244 } | 7243 } |
7245 | 7244 |
7246 set_help_echo: | 7245 set_help_echo: |
7247 | 7246 |
7248 /* Set help_echo to a help string.to display for this tool-bar item. | 7247 /* Set help_echo to a help string.to display for this tool-bar item. |
7249 w32_read_socket does the rest. */ | 7248 w32_read_socket does the rest. */ |
7250 help_echo_object = help_echo_window = Qnil; | 7249 help_echo_object = help_echo_window = Qnil; |
7251 help_echo_pos = -1; | 7250 help_echo_pos = -1; |
7252 help_echo = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_HELP); | 7251 help_echo = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_HELP); |
7264 having STOP as object. */ | 7263 having STOP as object. */ |
7265 | 7264 |
7266 #if 0 /* This is a version of fast_find_position that's more correct | 7265 #if 0 /* This is a version of fast_find_position that's more correct |
7267 in the presence of hscrolling, for example. I didn't install | 7266 in the presence of hscrolling, for example. I didn't install |
7268 it right away because the problem fixed is minor, it failed | 7267 it right away because the problem fixed is minor, it failed |
7269 in 20.x as well, and I think it's too risky to install | 7268 in 20.x as well, and I think it's too risky to install |
7270 so near the release of 21.1. 2001-09-25 gerd. */ | 7269 so near the release of 21.1. 2001-09-25 gerd. */ |
7271 | 7270 |
7272 static int | 7271 static int |
7273 fast_find_position (w, charpos, hpos, vpos, x, y, stop) | 7272 fast_find_position (w, charpos, hpos, vpos, x, y, stop) |
7274 struct window *w; | 7273 struct window *w; |
7297 } | 7296 } |
7298 | 7297 |
7299 *x = row->x; | 7298 *x = row->x; |
7300 *y = row->y; | 7299 *y = row->y; |
7301 *vpos = MATRIX_ROW_VPOS (row, w->current_matrix); | 7300 *vpos = MATRIX_ROW_VPOS (row, w->current_matrix); |
7302 | 7301 |
7303 glyph = row->glyphs[TEXT_AREA]; | 7302 glyph = row->glyphs[TEXT_AREA]; |
7304 end = glyph + row->used[TEXT_AREA]; | 7303 end = glyph + row->used[TEXT_AREA]; |
7305 | 7304 |
7306 /* Skip over glyphs not having an object at the start of the row. | 7305 /* Skip over glyphs not having an object at the start of the row. |
7307 These are special glyphs like truncation marks on terminal | 7306 These are special glyphs like truncation marks on terminal |
7308 frames. */ | 7307 frames. */ |
7309 if (row->displays_text_p) | 7308 if (row->displays_text_p) |
7310 while (glyph < end | 7309 while (glyph < end |
7502 if (right_p) | 7501 if (right_p) |
7503 { | 7502 { |
7504 *x += best_glyph->pixel_width; | 7503 *x += best_glyph->pixel_width; |
7505 ++*hpos; | 7504 ++*hpos; |
7506 } | 7505 } |
7507 | 7506 |
7508 *y = best_row->y; | 7507 *y = best_row->y; |
7509 *vpos = best_row - w->current_matrix->rows; | 7508 *vpos = best_row - w->current_matrix->rows; |
7510 } | 7509 } |
7511 | 7510 |
7512 return best_glyph != NULL; | 7511 return best_glyph != NULL; |
7521 struct w32_display_info *dpyinfo; | 7520 struct w32_display_info *dpyinfo; |
7522 enum draw_glyphs_face draw; | 7521 enum draw_glyphs_face draw; |
7523 { | 7522 { |
7524 struct window *w = XWINDOW (dpyinfo->mouse_face_window); | 7523 struct window *w = XWINDOW (dpyinfo->mouse_face_window); |
7525 struct frame *f = XFRAME (WINDOW_FRAME (w)); | 7524 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
7526 | 7525 |
7527 if (/* If window is in the process of being destroyed, don't bother | 7526 if (/* If window is in the process of being destroyed, don't bother |
7528 to do anything. */ | 7527 to do anything. */ |
7529 w->current_matrix != NULL | 7528 w->current_matrix != NULL |
7530 /* Don't update mouse highlight if hidden */ | 7529 /* Don't update mouse highlight if hidden */ |
7531 && (draw != DRAW_MOUSE_FACE || !dpyinfo->mouse_face_hidden) | 7530 && (draw != DRAW_MOUSE_FACE || !dpyinfo->mouse_face_hidden) |
7536 int phys_cursor_on_p = w->phys_cursor_on_p; | 7535 int phys_cursor_on_p = w->phys_cursor_on_p; |
7537 struct glyph_row *row, *first, *last; | 7536 struct glyph_row *row, *first, *last; |
7538 | 7537 |
7539 first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); | 7538 first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); |
7540 last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); | 7539 last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); |
7541 | 7540 |
7542 for (row = first; row <= last && row->enabled_p; ++row) | 7541 for (row = first; row <= last && row->enabled_p; ++row) |
7543 { | 7542 { |
7544 int start_hpos, end_hpos, start_x; | 7543 int start_hpos, end_hpos, start_x; |
7545 | 7544 |
7546 /* For all but the first row, the highlight starts at column 0. */ | 7545 /* For all but the first row, the highlight starts at column 0. */ |
7560 else | 7559 else |
7561 end_hpos = row->used[TEXT_AREA]; | 7560 end_hpos = row->used[TEXT_AREA]; |
7562 | 7561 |
7563 if (end_hpos > start_hpos) | 7562 if (end_hpos > start_hpos) |
7564 { | 7563 { |
7565 x_draw_glyphs (w, start_x, row, TEXT_AREA, | 7564 x_draw_glyphs (w, start_x, row, TEXT_AREA, |
7566 start_hpos, end_hpos, draw, 0); | 7565 start_hpos, end_hpos, draw, 0); |
7567 | 7566 |
7568 row->mouse_face_p | 7567 row->mouse_face_p |
7569 = draw == DRAW_MOUSE_FACE || draw == DRAW_IMAGE_RAISED; | 7568 = draw == DRAW_MOUSE_FACE || draw == DRAW_IMAGE_RAISED; |
7570 } | 7569 } |
7802 /* Clear the mouse-moved flag for every frame on this display. */ | 7801 /* Clear the mouse-moved flag for every frame on this display. */ |
7803 FOR_EACH_FRAME (tail, frame) | 7802 FOR_EACH_FRAME (tail, frame) |
7804 XFRAME (frame)->mouse_moved = 0; | 7803 XFRAME (frame)->mouse_moved = 0; |
7805 | 7804 |
7806 last_mouse_scroll_bar = Qnil; | 7805 last_mouse_scroll_bar = Qnil; |
7807 | 7806 |
7808 GetCursorPos (&pt); | 7807 GetCursorPos (&pt); |
7809 | 7808 |
7810 /* Now we have a position on the root; find the innermost window | 7809 /* Now we have a position on the root; find the innermost window |
7811 containing the pointer. */ | 7810 containing the pointer. */ |
7812 { | 7811 { |
7979 | 7978 |
7980 | 7979 |
7981 /************************************************************************ | 7980 /************************************************************************ |
7982 Scroll bars, general | 7981 Scroll bars, general |
7983 ************************************************************************/ | 7982 ************************************************************************/ |
7984 | 7983 |
7985 HWND | 7984 HWND |
7986 my_create_scrollbar (f, bar) | 7985 my_create_scrollbar (f, bar) |
7987 struct frame * f; | 7986 struct frame * f; |
7988 struct scroll_bar * bar; | 7987 struct scroll_bar * bar; |
7989 { | 7988 { |
7990 return (HWND) SendMessage (FRAME_W32_WINDOW (f), | 7989 return (HWND) SendMessage (FRAME_W32_WINDOW (f), |
7991 WM_EMACS_CREATESCROLLBAR, (WPARAM) f, | 7990 WM_EMACS_CREATESCROLLBAR, (WPARAM) f, |
7992 (LPARAM) bar); | 7991 (LPARAM) bar); |
7993 } | 7992 } |
7994 | 7993 |
7995 /*#define ATTACH_THREADS*/ | 7994 /*#define ATTACH_THREADS*/ |
7996 | 7995 |
8026 void | 8025 void |
8027 my_set_focus (f, hwnd) | 8026 my_set_focus (f, hwnd) |
8028 struct frame * f; | 8027 struct frame * f; |
8029 HWND hwnd; | 8028 HWND hwnd; |
8030 { | 8029 { |
8031 SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS, | 8030 SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS, |
8032 (WPARAM) hwnd, 0); | 8031 (WPARAM) hwnd, 0); |
8033 } | 8032 } |
8034 | 8033 |
8035 void | 8034 void |
8036 my_set_foreground_window (hwnd) | 8035 my_set_foreground_window (hwnd) |
8042 void | 8041 void |
8043 my_destroy_window (f, hwnd) | 8042 my_destroy_window (f, hwnd) |
8044 struct frame * f; | 8043 struct frame * f; |
8045 HWND hwnd; | 8044 HWND hwnd; |
8046 { | 8045 { |
8047 SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW, | 8046 SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW, |
8048 (WPARAM) hwnd, 0); | 8047 (WPARAM) hwnd, 0); |
8049 } | 8048 } |
8050 | 8049 |
8051 /* Create a scroll bar and return the scroll bar vector for it. W is | 8050 /* Create a scroll bar and return the scroll bar vector for it. W is |
8052 the Emacs window on which to create the scroll bar. TOP, LEFT, | 8051 the Emacs window on which to create the scroll bar. TOP, LEFT, |
8169 else | 8168 else |
8170 sb_width = width; | 8169 sb_width = width; |
8171 | 8170 |
8172 /* Compute the left edge of the scroll bar. */ | 8171 /* Compute the left edge of the scroll bar. */ |
8173 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) | 8172 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) |
8174 sb_left = left + width - sb_width - (width - sb_width) / 2; | 8173 sb_left = left + width - sb_width - (width - sb_width) / 2; |
8175 else | 8174 else |
8176 sb_left = left + (width - sb_width) / 2; | 8175 sb_left = left + (width - sb_width) / 2; |
8177 | 8176 |
8178 /* Does the scroll bar exist yet? */ | 8177 /* Does the scroll bar exist yet? */ |
8179 if (NILP (w->vertical_scroll_bar)) | 8178 if (NILP (w->vertical_scroll_bar)) |
8190 | 8189 |
8191 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); | 8190 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); |
8192 } | 8191 } |
8193 else | 8192 else |
8194 { | 8193 { |
8195 /* It may just need to be moved and resized. */ | 8194 /* It may just need to be moved and resized. */ |
8196 HWND hwnd; | 8195 HWND hwnd; |
8197 | 8196 |
8198 bar = XSCROLL_BAR (w->vertical_scroll_bar); | 8197 bar = XSCROLL_BAR (w->vertical_scroll_bar); |
8199 hwnd = SCROLL_BAR_W32_WINDOW (bar); | 8198 hwnd = SCROLL_BAR_W32_WINDOW (bar); |
8200 | 8199 |
8412 | 8411 |
8413 bar->dragging = Qnil; | 8412 bar->dragging = Qnil; |
8414 | 8413 |
8415 | 8414 |
8416 last_mouse_scroll_bar_pos = msg->msg.wParam; | 8415 last_mouse_scroll_bar_pos = msg->msg.wParam; |
8417 | 8416 |
8418 switch (LOWORD (msg->msg.wParam)) | 8417 switch (LOWORD (msg->msg.wParam)) |
8419 { | 8418 { |
8420 case SB_LINEDOWN: | 8419 case SB_LINEDOWN: |
8421 emacs_event->part = scroll_bar_down_arrow; | 8420 emacs_event->part = scroll_bar_down_arrow; |
8422 break; | 8421 break; |
8612 Events representing keys are stored in buffer BUFP, | 8611 Events representing keys are stored in buffer BUFP, |
8613 which can hold up to NUMCHARS characters. | 8612 which can hold up to NUMCHARS characters. |
8614 We return the number of characters stored into the buffer, | 8613 We return the number of characters stored into the buffer, |
8615 thus pretending to be `read'. | 8614 thus pretending to be `read'. |
8616 | 8615 |
8617 EXPECTED is nonzero if the caller knows input is available. | 8616 EXPECTED is nonzero if the caller knows input is available. |
8618 | 8617 |
8619 Some of these messages are reposted back to the message queue since the | 8618 Some of these messages are reposted back to the message queue since the |
8620 system calls the windows proc directly in a context where we cannot return | 8619 system calls the windows proc directly in a context where we cannot return |
8621 the data nor can we guarantee the state we are in. So if we dispatch them | 8620 the data nor can we guarantee the state we are in. So if we dispatch them |
8622 we will get into an infinite loop. To prevent this from ever happening we | 8621 we will get into an infinite loop. To prevent this from ever happening we |
8623 will set a variable to indicate we are in the read_socket call and indicate | 8622 will set a variable to indicate we are in the read_socket call and indicate |
8624 which message we are processing since the windows proc gets called | 8623 which message we are processing since the windows proc gets called |
8625 recursively with different messages by the system. | 8624 recursively with different messages by the system. |
8626 */ | 8625 */ |
8627 | 8626 |
8628 int | 8627 int |
8629 w32_read_socket (sd, bufp, numchars, expected) | 8628 w32_read_socket (sd, bufp, numchars, expected) |
8660 switch (msg.msg.message) | 8659 switch (msg.msg.message) |
8661 { | 8660 { |
8662 case WM_PAINT: | 8661 case WM_PAINT: |
8663 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 8662 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
8664 | 8663 |
8665 if (f) | 8664 if (f) |
8666 { | 8665 { |
8667 if (msg.rect.right == msg.rect.left || | 8666 if (msg.rect.right == msg.rect.left || |
8668 msg.rect.bottom == msg.rect.top) | 8667 msg.rect.bottom == msg.rect.top) |
8669 { | 8668 { |
8670 /* We may get paint messages even though the client | 8669 /* We may get paint messages even though the client |
8720 | 8719 |
8721 if (f) | 8720 if (f) |
8722 { | 8721 { |
8723 if (numchars == 0) | 8722 if (numchars == 0) |
8724 abort (); | 8723 abort (); |
8725 | 8724 |
8726 bufp->kind = LANGUAGE_CHANGE_EVENT; | 8725 bufp->kind = LANGUAGE_CHANGE_EVENT; |
8727 XSETFRAME (bufp->frame_or_window, f); | 8726 XSETFRAME (bufp->frame_or_window, f); |
8728 bufp->arg = Qnil; | 8727 bufp->arg = Qnil; |
8729 bufp->code = msg.msg.wParam; | 8728 bufp->code = msg.msg.wParam; |
8730 bufp->modifiers = msg.msg.lParam & 0xffff; | 8729 bufp->modifiers = msg.msg.lParam & 0xffff; |
8735 break; | 8734 break; |
8736 | 8735 |
8737 case WM_KEYDOWN: | 8736 case WM_KEYDOWN: |
8738 case WM_SYSKEYDOWN: | 8737 case WM_SYSKEYDOWN: |
8739 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 8738 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
8740 | 8739 |
8741 if (f && !f->iconified) | 8740 if (f && !f->iconified) |
8742 { | 8741 { |
8743 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) | 8742 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) |
8744 { | 8743 { |
8745 dpyinfo->mouse_face_hidden = 1; | 8744 dpyinfo->mouse_face_hidden = 1; |
8762 break; | 8761 break; |
8763 | 8762 |
8764 case WM_SYSCHAR: | 8763 case WM_SYSCHAR: |
8765 case WM_CHAR: | 8764 case WM_CHAR: |
8766 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 8765 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
8767 | 8766 |
8768 if (f && !f->iconified) | 8767 if (f && !f->iconified) |
8769 { | 8768 { |
8770 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) | 8769 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) |
8771 { | 8770 { |
8772 dpyinfo->mouse_face_hidden = 1; | 8771 dpyinfo->mouse_face_hidden = 1; |
8796 if (dpyinfo->grabbed && last_mouse_frame | 8795 if (dpyinfo->grabbed && last_mouse_frame |
8797 && FRAME_LIVE_P (last_mouse_frame)) | 8796 && FRAME_LIVE_P (last_mouse_frame)) |
8798 f = last_mouse_frame; | 8797 f = last_mouse_frame; |
8799 else | 8798 else |
8800 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 8799 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
8801 | 8800 |
8802 if (dpyinfo->mouse_face_hidden) | 8801 if (dpyinfo->mouse_face_hidden) |
8803 { | 8802 { |
8804 dpyinfo->mouse_face_hidden = 0; | 8803 dpyinfo->mouse_face_hidden = 0; |
8805 clear_mouse_face (dpyinfo); | 8804 clear_mouse_face (dpyinfo); |
8806 } | 8805 } |
8849 int tool_bar_p = 0; | 8848 int tool_bar_p = 0; |
8850 int button; | 8849 int button; |
8851 int up; | 8850 int up; |
8852 | 8851 |
8853 emacs_event.kind = NO_EVENT; | 8852 emacs_event.kind = NO_EVENT; |
8854 | 8853 |
8855 if (dpyinfo->grabbed && last_mouse_frame | 8854 if (dpyinfo->grabbed && last_mouse_frame |
8856 && FRAME_LIVE_P (last_mouse_frame)) | 8855 && FRAME_LIVE_P (last_mouse_frame)) |
8857 f = last_mouse_frame; | 8856 f = last_mouse_frame; |
8858 else | 8857 else |
8859 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 8858 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
8860 | 8859 |
8861 if (f) | 8860 if (f) |
8862 { | 8861 { |
8863 construct_mouse_click (&emacs_event, &msg, f); | 8862 construct_mouse_click (&emacs_event, &msg, f); |
8864 | 8863 |
8865 /* Is this in the tool-bar? */ | 8864 /* Is this in the tool-bar? */ |
8866 if (WINDOWP (f->tool_bar_window) | 8865 if (WINDOWP (f->tool_bar_window) |
8867 && XFASTINT (XWINDOW (f->tool_bar_window)->height)) | 8866 && XFASTINT (XWINDOW (f->tool_bar_window)->height)) |
8868 { | 8867 { |
8869 Lisp_Object window; | 8868 Lisp_Object window; |
8891 bufp++; | 8890 bufp++; |
8892 count++; | 8891 count++; |
8893 numchars--; | 8892 numchars--; |
8894 } | 8893 } |
8895 } | 8894 } |
8896 | 8895 |
8897 parse_button (msg.msg.message, HIWORD (msg.msg.wParam), | 8896 parse_button (msg.msg.message, HIWORD (msg.msg.wParam), |
8898 &button, &up); | 8897 &button, &up); |
8899 | 8898 |
8900 if (up) | 8899 if (up) |
8901 { | 8900 { |
8915 if (!tool_bar_p) | 8914 if (!tool_bar_p) |
8916 last_tool_bar_item = -1; | 8915 last_tool_bar_item = -1; |
8917 } | 8916 } |
8918 break; | 8917 break; |
8919 } | 8918 } |
8920 | 8919 |
8921 case WM_MOUSEWHEEL: | 8920 case WM_MOUSEWHEEL: |
8922 if (dpyinfo->grabbed && last_mouse_frame | 8921 if (dpyinfo->grabbed && last_mouse_frame |
8923 && FRAME_LIVE_P (last_mouse_frame)) | 8922 && FRAME_LIVE_P (last_mouse_frame)) |
8924 f = last_mouse_frame; | 8923 f = last_mouse_frame; |
8925 else | 8924 else |
8926 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 8925 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
8927 | 8926 |
8928 if (f) | 8927 if (f) |
8929 { | 8928 { |
8930 if ((!dpyinfo->w32_focus_frame | 8929 if ((!dpyinfo->w32_focus_frame |
8931 || f == dpyinfo->w32_focus_frame) | 8930 || f == dpyinfo->w32_focus_frame) |
8932 && (numchars >= 1)) | 8931 && (numchars >= 1)) |
8933 { | 8932 { |
8934 construct_mouse_wheel (bufp, &msg, f); | 8933 construct_mouse_wheel (bufp, &msg, f); |
8935 bufp++; | 8934 bufp++; |
8953 | 8952 |
8954 case WM_VSCROLL: | 8953 case WM_VSCROLL: |
8955 { | 8954 { |
8956 struct scroll_bar *bar = | 8955 struct scroll_bar *bar = |
8957 x_window_to_scroll_bar ((HWND)msg.msg.lParam); | 8956 x_window_to_scroll_bar ((HWND)msg.msg.lParam); |
8958 | 8957 |
8959 if (bar && numchars >= 1) | 8958 if (bar && numchars >= 1) |
8960 { | 8959 { |
8961 if (w32_scroll_bar_handle_click (bar, &msg, bufp)) | 8960 if (w32_scroll_bar_handle_click (bar, &msg, bufp)) |
8962 { | 8961 { |
8963 bufp++; | 8962 bufp++; |
8965 numchars--; | 8964 numchars--; |
8966 } | 8965 } |
8967 } | 8966 } |
8968 break; | 8967 break; |
8969 } | 8968 } |
8970 | 8969 |
8971 case WM_WINDOWPOSCHANGED: | 8970 case WM_WINDOWPOSCHANGED: |
8972 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 8971 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
8973 if (f) | 8972 if (f) |
8974 { | 8973 { |
8975 x_check_fullscreen_move(f); | 8974 x_check_fullscreen_move(f); |
8988 check_visibility = 1; | 8987 check_visibility = 1; |
8989 break; | 8988 break; |
8990 | 8989 |
8991 case WM_MOVE: | 8990 case WM_MOVE: |
8992 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 8991 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
8993 | 8992 |
8994 if (f && !f->async_iconified) | 8993 if (f && !f->async_iconified) |
8995 { | 8994 { |
8996 int x, y; | 8995 int x, y; |
8997 | 8996 |
8998 x_real_positions (f, &x, &y); | 8997 x_real_positions (f, &x, &y); |
9030 check_visibility = 1; | 9029 check_visibility = 1; |
9031 break; | 9030 break; |
9032 | 9031 |
9033 case WM_SIZE: | 9032 case WM_SIZE: |
9034 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 9033 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
9035 | 9034 |
9036 /* Inform lisp of whether frame has been iconified etc. */ | 9035 /* Inform lisp of whether frame has been iconified etc. */ |
9037 if (f) | 9036 if (f) |
9038 { | 9037 { |
9039 switch (msg.msg.wParam) | 9038 switch (msg.msg.wParam) |
9040 { | 9039 { |
9041 case SIZE_MINIMIZED: | 9040 case SIZE_MINIMIZED: |
9042 f->async_visible = 0; | 9041 f->async_visible = 0; |
9043 f->async_iconified = 1; | 9042 f->async_iconified = 1; |
9044 | 9043 |
9045 bufp->kind = ICONIFY_EVENT; | 9044 bufp->kind = ICONIFY_EVENT; |
9046 XSETFRAME (bufp->frame_or_window, f); | 9045 XSETFRAME (bufp->frame_or_window, f); |
9047 bufp->arg = Qnil; | 9046 bufp->arg = Qnil; |
9048 bufp++; | 9047 bufp++; |
9049 count++; | 9048 count++; |
9052 | 9051 |
9053 case SIZE_MAXIMIZED: | 9052 case SIZE_MAXIMIZED: |
9054 case SIZE_RESTORED: | 9053 case SIZE_RESTORED: |
9055 f->async_visible = 1; | 9054 f->async_visible = 1; |
9056 f->async_iconified = 0; | 9055 f->async_iconified = 0; |
9057 | 9056 |
9058 /* wait_reading_process_input will notice this and update | 9057 /* wait_reading_process_input will notice this and update |
9059 the frame's display structures. */ | 9058 the frame's display structures. */ |
9060 SET_FRAME_GARBAGED (f); | 9059 SET_FRAME_GARBAGED (f); |
9061 | 9060 |
9062 if (f->iconified) | 9061 if (f->iconified) |
9063 { | 9062 { |
9064 int x, y; | 9063 int x, y; |
9065 | 9064 |
9066 /* Reset top and left positions of the Window | 9065 /* Reset top and left positions of the Window |
9094 RECT rect; | 9093 RECT rect; |
9095 int rows; | 9094 int rows; |
9096 int columns; | 9095 int columns; |
9097 int width; | 9096 int width; |
9098 int height; | 9097 int height; |
9099 | 9098 |
9100 GetClientRect (msg.msg.hwnd, &rect); | 9099 GetClientRect (msg.msg.hwnd, &rect); |
9101 | 9100 |
9102 height = rect.bottom - rect.top; | 9101 height = rect.bottom - rect.top; |
9103 width = rect.right - rect.left; | 9102 width = rect.right - rect.left; |
9104 | 9103 |
9105 rows = PIXEL_TO_CHAR_HEIGHT (f, height); | 9104 rows = PIXEL_TO_CHAR_HEIGHT (f, height); |
9106 columns = PIXEL_TO_CHAR_WIDTH (f, width); | 9105 columns = PIXEL_TO_CHAR_WIDTH (f, width); |
9107 | 9106 |
9108 /* TODO: Clip size to the screen dimensions. */ | 9107 /* TODO: Clip size to the screen dimensions. */ |
9109 | 9108 |
9110 /* Even if the number of character rows and columns has | 9109 /* Even if the number of character rows and columns has |
9111 not changed, the font size may have changed, so we need | 9110 not changed, the font size may have changed, so we need |
9112 to check the pixel dimensions as well. */ | 9111 to check the pixel dimensions as well. */ |
9113 | 9112 |
9114 if (columns != f->width | 9113 if (columns != f->width |
9115 || rows != f->height | 9114 || rows != f->height |
9116 || width != f->output_data.w32->pixel_width | 9115 || width != f->output_data.w32->pixel_width |
9117 || height != f->output_data.w32->pixel_height) | 9116 || height != f->output_data.w32->pixel_height) |
9118 { | 9117 { |
9155 Qnil, frame, Qnil, Qnil, 0); | 9154 Qnil, frame, Qnil, Qnil, 0); |
9156 bufp += n, count += n, numchars -= n; | 9155 bufp += n, count += n, numchars -= n; |
9157 } | 9156 } |
9158 } | 9157 } |
9159 break; | 9158 break; |
9160 | 9159 |
9161 case WM_SETFOCUS: | 9160 case WM_SETFOCUS: |
9162 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd); | 9161 f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd); |
9163 | 9162 |
9164 dpyinfo->w32_focus_event_frame = f; | 9163 dpyinfo->w32_focus_event_frame = f; |
9165 | 9164 |
9166 if (f) | 9165 if (f) |
9167 x_new_focus_frame (dpyinfo, f); | 9166 x_new_focus_frame (dpyinfo, f); |
9168 | 9167 |
9169 | 9168 |
9170 dpyinfo->grabbed = 0; | 9169 dpyinfo->grabbed = 0; |
9212 check_visibility = 1; | 9211 check_visibility = 1; |
9213 break; | 9212 break; |
9214 | 9213 |
9215 case WM_CLOSE: | 9214 case WM_CLOSE: |
9216 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 9215 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
9217 | 9216 |
9218 if (f) | 9217 if (f) |
9219 { | 9218 { |
9220 if (numchars == 0) | 9219 if (numchars == 0) |
9221 abort (); | 9220 abort (); |
9222 | 9221 |
9223 bufp->kind = DELETE_WINDOW_EVENT; | 9222 bufp->kind = DELETE_WINDOW_EVENT; |
9224 XSETFRAME (bufp->frame_or_window, f); | 9223 XSETFRAME (bufp->frame_or_window, f); |
9225 bufp->arg = Qnil; | 9224 bufp->arg = Qnil; |
9226 bufp++; | 9225 bufp++; |
9227 count++; | 9226 count++; |
9229 } | 9228 } |
9230 break; | 9229 break; |
9231 | 9230 |
9232 case WM_INITMENU: | 9231 case WM_INITMENU: |
9233 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 9232 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
9234 | 9233 |
9235 if (f) | 9234 if (f) |
9236 { | 9235 { |
9237 if (numchars == 0) | 9236 if (numchars == 0) |
9238 abort (); | 9237 abort (); |
9239 | 9238 |
9240 bufp->kind = MENU_BAR_ACTIVATE_EVENT; | 9239 bufp->kind = MENU_BAR_ACTIVATE_EVENT; |
9241 XSETFRAME (bufp->frame_or_window, f); | 9240 XSETFRAME (bufp->frame_or_window, f); |
9242 bufp->arg = Qnil; | 9241 bufp->arg = Qnil; |
9243 bufp++; | 9242 bufp++; |
9244 count++; | 9243 count++; |
9260 break; | 9259 break; |
9261 | 9260 |
9262 case WM_DISPLAYCHANGE: | 9261 case WM_DISPLAYCHANGE: |
9263 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 9262 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
9264 | 9263 |
9265 if (f) | 9264 if (f) |
9266 { | 9265 { |
9267 dpyinfo->width = (short) LOWORD (msg.msg.lParam); | 9266 dpyinfo->width = (short) LOWORD (msg.msg.lParam); |
9268 dpyinfo->height = (short) HIWORD (msg.msg.lParam); | 9267 dpyinfo->height = (short) HIWORD (msg.msg.lParam); |
9269 dpyinfo->n_cbits = msg.msg.wParam; | 9268 dpyinfo->n_cbits = msg.msg.wParam; |
9270 DebPrint (("display change: %d %d\n", dpyinfo->width, | 9269 DebPrint (("display change: %d %d\n", dpyinfo->width, |
9271 dpyinfo->height)); | 9270 dpyinfo->height)); |
9272 } | 9271 } |
9273 | 9272 |
9274 check_visibility = 1; | 9273 check_visibility = 1; |
9275 break; | 9274 break; |
9276 | 9275 |
9277 default: | 9276 default: |
9278 /* Check for messages registered at runtime. */ | 9277 /* Check for messages registered at runtime. */ |
9279 if (msg.msg.message == msh_mousewheel) | 9278 if (msg.msg.message == msh_mousewheel) |
9280 { | 9279 { |
9281 if (dpyinfo->grabbed && last_mouse_frame | 9280 if (dpyinfo->grabbed && last_mouse_frame |
9282 && FRAME_LIVE_P (last_mouse_frame)) | 9281 && FRAME_LIVE_P (last_mouse_frame)) |
9283 f = last_mouse_frame; | 9282 f = last_mouse_frame; |
9284 else | 9283 else |
9285 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 9284 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
9286 | 9285 |
9287 if (f) | 9286 if (f) |
9288 { | 9287 { |
9289 if ((!dpyinfo->w32_focus_frame | 9288 if ((!dpyinfo->w32_focus_frame |
9290 || f == dpyinfo->w32_focus_frame) | 9289 || f == dpyinfo->w32_focus_frame) |
9291 && (numchars >= 1)) | 9290 && (numchars >= 1)) |
9292 { | 9291 { |
9293 construct_mouse_wheel (bufp, &msg, f); | 9292 construct_mouse_wheel (bufp, &msg, f); |
9294 bufp++; | 9293 bufp++; |
9641 | 9640 |
9642 /* No cursor displayed or row invalidated => nothing to do on the | 9641 /* No cursor displayed or row invalidated => nothing to do on the |
9643 screen. */ | 9642 screen. */ |
9644 if (w->phys_cursor_type == NO_CURSOR) | 9643 if (w->phys_cursor_type == NO_CURSOR) |
9645 goto mark_cursor_off; | 9644 goto mark_cursor_off; |
9646 | 9645 |
9647 /* VPOS >= active_glyphs->nrows means that window has been resized. | 9646 /* VPOS >= active_glyphs->nrows means that window has been resized. |
9648 Don't bother to erase the cursor. */ | 9647 Don't bother to erase the cursor. */ |
9649 if (vpos >= active_glyphs->nrows) | 9648 if (vpos >= active_glyphs->nrows) |
9650 goto mark_cursor_off; | 9649 goto mark_cursor_off; |
9651 | 9650 |
9652 /* If row containing cursor is marked invalid, there is nothing we | 9651 /* If row containing cursor is marked invalid, there is nothing we |
9653 can do. */ | 9652 can do. */ |
9654 cursor_row = MATRIX_ROW (active_glyphs, vpos); | 9653 cursor_row = MATRIX_ROW (active_glyphs, vpos); |
9655 if (!cursor_row->enabled_p) | 9654 if (!cursor_row->enabled_p) |
9656 goto mark_cursor_off; | 9655 goto mark_cursor_off; |
9657 | 9656 |
9658 /* If row is completely invisible, don't attempt to delete a cursor which | 9657 /* If row is completely invisible, don't attempt to delete a cursor which |
9659 isn't there. This may happen if cursor is at top of window, and | 9658 isn't there. This may happen if cursor is at top of window, and |
9660 we switch to a buffer with a header line in that window. */ | 9659 we switch to a buffer with a header line in that window. */ |
9661 if (cursor_row->visible_height <= 0) | 9660 if (cursor_row->visible_height <= 0) |
9662 goto mark_cursor_off; | 9661 goto mark_cursor_off; |
9663 | 9662 |
9664 /* This can happen when the new row is shorter than the old one. | 9663 /* This can happen when the new row is shorter than the old one. |
9665 In this case, either x_draw_glyphs or clear_end_of_line | 9664 In this case, either x_draw_glyphs or clear_end_of_line |
9666 should have cleared the cursor. Note that we wouldn't be | 9665 should have cleared the cursor. Note that we wouldn't be |
9667 able to erase the cursor in this case because we don't have a | 9666 able to erase the cursor in this case because we don't have a |
9668 cursor glyph at hand. */ | 9667 cursor glyph at hand. */ |
9704 cursor_row->y)), | 9703 cursor_row->y)), |
9705 cursor_glyph->pixel_width, | 9704 cursor_glyph->pixel_width, |
9706 cursor_row->visible_height); | 9705 cursor_row->visible_height); |
9707 release_frame_dc (f, hdc); | 9706 release_frame_dc (f, hdc); |
9708 } | 9707 } |
9709 | 9708 |
9710 /* Erase the cursor by redrawing the character underneath it. */ | 9709 /* Erase the cursor by redrawing the character underneath it. */ |
9711 if (mouse_face_here_p) | 9710 if (mouse_face_here_p) |
9712 hl = DRAW_MOUSE_FACE; | 9711 hl = DRAW_MOUSE_FACE; |
9713 else | 9712 else |
9714 hl = DRAW_NORMAL_TEXT; | 9713 hl = DRAW_NORMAL_TEXT; |
9727 struct window *w; | 9726 struct window *w; |
9728 { | 9727 { |
9729 struct w32_display_info *dpyinfo | 9728 struct w32_display_info *dpyinfo |
9730 = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame)); | 9729 = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame)); |
9731 int in_mouse_face = 0; | 9730 int in_mouse_face = 0; |
9732 | 9731 |
9733 if (WINDOWP (dpyinfo->mouse_face_window) | 9732 if (WINDOWP (dpyinfo->mouse_face_window) |
9734 && XWINDOW (dpyinfo->mouse_face_window) == w) | 9733 && XWINDOW (dpyinfo->mouse_face_window) == w) |
9735 { | 9734 { |
9736 int hpos = w->phys_cursor.hpos; | 9735 int hpos = w->phys_cursor.hpos; |
9737 int vpos = w->phys_cursor.vpos; | 9736 int vpos = w->phys_cursor.vpos; |
9782 return; | 9781 return; |
9783 | 9782 |
9784 current_glyphs = w->current_matrix; | 9783 current_glyphs = w->current_matrix; |
9785 glyph_row = MATRIX_ROW (current_glyphs, vpos); | 9784 glyph_row = MATRIX_ROW (current_glyphs, vpos); |
9786 glyph = glyph_row->glyphs[TEXT_AREA] + hpos; | 9785 glyph = glyph_row->glyphs[TEXT_AREA] + hpos; |
9787 | 9786 |
9788 /* If cursor row is not enabled, we don't really know where to | 9787 /* If cursor row is not enabled, we don't really know where to |
9789 display the cursor. */ | 9788 display the cursor. */ |
9790 if (!glyph_row->enabled_p) | 9789 if (!glyph_row->enabled_p) |
9791 { | 9790 { |
9792 w->phys_cursor_on_p = 0; | 9791 w->phys_cursor_on_p = 0; |
9793 return; | 9792 return; |
9817 still not be visible, or it has only been partly erased. */ | 9816 still not be visible, or it has only been partly erased. */ |
9818 if (on) | 9817 if (on) |
9819 { | 9818 { |
9820 w->phys_cursor_ascent = glyph_row->ascent; | 9819 w->phys_cursor_ascent = glyph_row->ascent; |
9821 w->phys_cursor_height = glyph_row->height; | 9820 w->phys_cursor_height = glyph_row->height; |
9822 | 9821 |
9823 /* Set phys_cursor_.* before x_draw_.* is called because some | 9822 /* Set phys_cursor_.* before x_draw_.* is called because some |
9824 of them may need the information. */ | 9823 of them may need the information. */ |
9825 w->phys_cursor.x = x; | 9824 w->phys_cursor.x = x; |
9826 w->phys_cursor.y = glyph_row->y; | 9825 w->phys_cursor.y = glyph_row->y; |
9827 w->phys_cursor.hpos = hpos; | 9826 w->phys_cursor.hpos = hpos; |
10254 } | 10253 } |
10255 | 10254 |
10256 { | 10255 { |
10257 RECT rt; | 10256 RECT rt; |
10258 rt.left = rt.right = rt.top = rt.bottom = 0; | 10257 rt.left = rt.right = rt.top = rt.bottom = 0; |
10259 | 10258 |
10260 BLOCK_INPUT; | 10259 BLOCK_INPUT; |
10261 AdjustWindowRect(&rt, f->output_data.w32->dwStyle, | 10260 AdjustWindowRect(&rt, f->output_data.w32->dwStyle, |
10262 FRAME_EXTERNAL_MENU_BAR (f)); | 10261 FRAME_EXTERNAL_MENU_BAR (f)); |
10263 UNBLOCK_INPUT; | 10262 UNBLOCK_INPUT; |
10264 | 10263 |
10334 struct frame *f; | 10333 struct frame *f; |
10335 { | 10334 { |
10336 if (f->output_data.w32->want_fullscreen & FULLSCREEN_BOTH) | 10335 if (f->output_data.w32->want_fullscreen & FULLSCREEN_BOTH) |
10337 { | 10336 { |
10338 int width, height, ign; | 10337 int width, height, ign; |
10339 | 10338 |
10340 x_real_positions (f, &f->output_data.w32->left_pos, | 10339 x_real_positions (f, &f->output_data.w32->left_pos, |
10341 &f->output_data.w32->top_pos); | 10340 &f->output_data.w32->top_pos); |
10342 | 10341 |
10343 x_fullscreen_adjust (f, &width, &height, &ign, &ign); | 10342 x_fullscreen_adjust (f, &width, &height, &ign, &ign); |
10344 | 10343 |
10345 /* We do not need to move the window, it shall be taken care of | 10344 /* We do not need to move the window, it shall be taken care of |
10346 when setting WM manager hints. | 10345 when setting WM manager hints. |
10347 If the frame is visible already, the position is checked by | 10346 If the frame is visible already, the position is checked by |
10348 x_check_fullscreen_move. */ | 10347 x_check_fullscreen_move. */ |
10349 if (f->width != width || f->height != height) | 10348 if (f->width != width || f->height != height) |
10375 | 10374 |
10376 if (f->output_data.w32->want_fullscreen & FULLSCREEN_HEIGHT) | 10375 if (f->output_data.w32->want_fullscreen & FULLSCREEN_HEIGHT) |
10377 expect_top = 0; | 10376 expect_top = 0; |
10378 if (f->output_data.w32->want_fullscreen & FULLSCREEN_WIDTH) | 10377 if (f->output_data.w32->want_fullscreen & FULLSCREEN_WIDTH) |
10379 expect_left = 0; | 10378 expect_left = 0; |
10380 | 10379 |
10381 if (expect_top != f->output_data.w32->top_pos | 10380 if (expect_top != f->output_data.w32->top_pos |
10382 || expect_left != f->output_data.w32->left_pos) | 10381 || expect_left != f->output_data.w32->left_pos) |
10383 x_set_offset (f, expect_left, expect_top, 1); | 10382 x_set_offset (f, expect_left, expect_top, 1); |
10384 | 10383 |
10385 /* Just do this once */ | 10384 /* Just do this once */ |
10403 { | 10402 { |
10404 int newwidth = f->width, newheight = f->height; | 10403 int newwidth = f->width, newheight = f->height; |
10405 | 10404 |
10406 *top_pos = f->output_data.w32->top_pos; | 10405 *top_pos = f->output_data.w32->top_pos; |
10407 *left_pos = f->output_data.w32->left_pos; | 10406 *left_pos = f->output_data.w32->left_pos; |
10408 | 10407 |
10409 if (f->output_data.w32->want_fullscreen & FULLSCREEN_HEIGHT) | 10408 if (f->output_data.w32->want_fullscreen & FULLSCREEN_HEIGHT) |
10410 { | 10409 { |
10411 int ph; | 10410 int ph; |
10412 | 10411 |
10413 ph = FRAME_X_DISPLAY_INFO (f)->height; | 10412 ph = FRAME_X_DISPLAY_INFO (f)->height; |
10414 newheight = PIXEL_TO_CHAR_HEIGHT (f, ph); | 10413 newheight = PIXEL_TO_CHAR_HEIGHT (f, ph); |
10415 ph = CHAR_TO_PIXEL_HEIGHT (f, newheight) | 10414 ph = CHAR_TO_PIXEL_HEIGHT (f, newheight) |
10416 - f->output_data.w32->y_pixels_diff; | 10415 - f->output_data.w32->y_pixels_diff; |
10417 newheight = PIXEL_TO_CHAR_HEIGHT (f, ph); | 10416 newheight = PIXEL_TO_CHAR_HEIGHT (f, ph); |
10419 } | 10418 } |
10420 | 10419 |
10421 if (f->output_data.w32->want_fullscreen & FULLSCREEN_WIDTH) | 10420 if (f->output_data.w32->want_fullscreen & FULLSCREEN_WIDTH) |
10422 { | 10421 { |
10423 int pw; | 10422 int pw; |
10424 | 10423 |
10425 pw = FRAME_X_DISPLAY_INFO (f)->width; | 10424 pw = FRAME_X_DISPLAY_INFO (f)->width; |
10426 newwidth = PIXEL_TO_CHAR_WIDTH (f, pw); | 10425 newwidth = PIXEL_TO_CHAR_WIDTH (f, pw); |
10427 pw = CHAR_TO_PIXEL_WIDTH (f, newwidth) | 10426 pw = CHAR_TO_PIXEL_WIDTH (f, newwidth) |
10428 - f->output_data.w32->x_pixels_diff; | 10427 - f->output_data.w32->x_pixels_diff; |
10429 newwidth = PIXEL_TO_CHAR_WIDTH (f, pw); | 10428 newwidth = PIXEL_TO_CHAR_WIDTH (f, pw); |
10445 struct frame *f; | 10444 struct frame *f; |
10446 int change_gravity; | 10445 int change_gravity; |
10447 int cols, rows; | 10446 int cols, rows; |
10448 { | 10447 { |
10449 int pixelwidth, pixelheight; | 10448 int pixelwidth, pixelheight; |
10450 | 10449 |
10451 BLOCK_INPUT; | 10450 BLOCK_INPUT; |
10452 | 10451 |
10453 check_frame_size (f, &rows, &cols); | 10452 check_frame_size (f, &rows, &cols); |
10454 f->output_data.w32->vertical_scroll_bar_extra | 10453 f->output_data.w32->vertical_scroll_bar_extra |
10455 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) | 10454 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
10456 ? 0 | 10455 ? 0 |
10457 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); | 10456 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); |
10458 | 10457 |
10459 x_compute_fringe_widths (f, 0); | 10458 x_compute_fringe_widths (f, 0); |
10460 | 10459 |
10461 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); | 10460 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); |
10462 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); | 10461 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); |
10463 | 10462 |
10464 f->output_data.w32->win_gravity = NorthWestGravity; | 10463 f->output_data.w32->win_gravity = NorthWestGravity; |
10465 x_wm_set_size_hint (f, (long) 0, 0); | 10464 x_wm_set_size_hint (f, (long) 0, 0); |
10466 | 10465 |
10467 { | 10466 { |
10468 RECT rect; | 10467 RECT rect; |
10469 | 10468 |
10470 rect.left = rect.top = 0; | 10469 rect.left = rect.top = 0; |
10471 rect.right = pixelwidth; | 10470 rect.right = pixelwidth; |
10472 rect.bottom = pixelheight; | 10471 rect.bottom = pixelheight; |
10473 | 10472 |
10474 AdjustWindowRect(&rect, f->output_data.w32->dwStyle, | 10473 AdjustWindowRect(&rect, f->output_data.w32->dwStyle, |
10475 FRAME_EXTERNAL_MENU_BAR (f)); | 10474 FRAME_EXTERNAL_MENU_BAR (f)); |
10476 | 10475 |
10477 my_set_window_pos (FRAME_W32_WINDOW (f), | 10476 my_set_window_pos (FRAME_W32_WINDOW (f), |
10478 NULL, | 10477 NULL, |
10479 0, 0, | 10478 0, 0, |
10480 rect.right - rect.left, | 10479 rect.right - rect.left, |
10481 rect.bottom - rect.top, | 10480 rect.bottom - rect.top, |
10482 SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); | 10481 SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); |
10483 } | 10482 } |
10484 | 10483 |
10485 /* Now, strictly speaking, we can't be sure that this is accurate, | 10484 /* Now, strictly speaking, we can't be sure that this is accurate, |
10486 but the window manager will get around to dealing with the size | 10485 but the window manager will get around to dealing with the size |
10487 change request eventually, and we'll hear how it went when the | 10486 change request eventually, and we'll hear how it went when the |
10488 ConfigureNotify event gets here. | 10487 ConfigureNotify event gets here. |
10489 | 10488 |
10490 We could just not bother storing any of this information here, | 10489 We could just not bother storing any of this information here, |
10491 and let the ConfigureNotify event set everything up, but that | 10490 and let the ConfigureNotify event set everything up, but that |
10492 might be kind of confusing to the Lisp code, since size changes | 10491 might be kind of confusing to the Lisp code, since size changes |
10493 wouldn't be reported in the frame parameters until some random | 10492 wouldn't be reported in the frame parameters until some random |
10494 point in the future when the ConfigureNotify event arrives. | 10493 point in the future when the ConfigureNotify event arrives. |
10507 | 10506 |
10508 /* If cursor was outside the new size, mark it as off. */ | 10507 /* If cursor was outside the new size, mark it as off. */ |
10509 mark_window_cursors_off (XWINDOW (f->root_window)); | 10508 mark_window_cursors_off (XWINDOW (f->root_window)); |
10510 | 10509 |
10511 /* Clear out any recollection of where the mouse highlighting was, | 10510 /* Clear out any recollection of where the mouse highlighting was, |
10512 since it might be in a place that's outside the new frame size. | 10511 since it might be in a place that's outside the new frame size. |
10513 Actually checking whether it is outside is a pain in the neck, | 10512 Actually checking whether it is outside is a pain in the neck, |
10514 so don't try--just let the highlighting be done afresh with new size. */ | 10513 so don't try--just let the highlighting be done afresh with new size. */ |
10515 cancel_mouse_face (f); | 10514 cancel_mouse_face (f); |
10516 | 10515 |
10517 UNBLOCK_INPUT; | 10516 UNBLOCK_INPUT; |
10759 struct frame *f; | 10758 struct frame *f; |
10760 { | 10759 { |
10761 /* Don't keep the highlight on an invisible frame. */ | 10760 /* Don't keep the highlight on an invisible frame. */ |
10762 if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f) | 10761 if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f) |
10763 FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0; | 10762 FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0; |
10764 | 10763 |
10765 BLOCK_INPUT; | 10764 BLOCK_INPUT; |
10766 | 10765 |
10767 my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE); | 10766 my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE); |
10768 | 10767 |
10769 /* We can't distinguish this from iconification | 10768 /* We can't distinguish this from iconification |
10770 just by the event that we get from the server. | 10769 just by the event that we get from the server. |
10771 So we can't win using the usual strategy of letting | 10770 So we can't win using the usual strategy of letting |
10772 FRAME_SAMPLE_VISIBILITY set this. So do it by hand, | 10771 FRAME_SAMPLE_VISIBILITY set this. So do it by hand, |
10773 and synchronize with the server to make sure we agree. */ | 10772 and synchronize with the server to make sure we agree. */ |
10774 f->visible = 0; | 10773 f->visible = 0; |
10775 FRAME_ICONIFIED_P (f) = 0; | 10774 FRAME_ICONIFIED_P (f) = 0; |
10776 f->async_visible = 0; | 10775 f->async_visible = 0; |
10777 f->async_iconified = 0; | 10776 f->async_iconified = 0; |
10778 | 10777 |
10779 UNBLOCK_INPUT; | 10778 UNBLOCK_INPUT; |
10780 } | 10779 } |
10781 | 10780 |
10782 /* Change window state from mapped to iconified. */ | 10781 /* Change window state from mapped to iconified. */ |
10783 | 10782 |
10817 | 10816 |
10818 BLOCK_INPUT; | 10817 BLOCK_INPUT; |
10819 | 10818 |
10820 if (FRAME_W32_WINDOW (f)) | 10819 if (FRAME_W32_WINDOW (f)) |
10821 my_destroy_window (f, FRAME_W32_WINDOW (f)); | 10820 my_destroy_window (f, FRAME_W32_WINDOW (f)); |
10822 | 10821 |
10823 free_frame_menubar (f); | 10822 free_frame_menubar (f); |
10824 | 10823 |
10825 unload_color (f, f->output_data.x->foreground_pixel); | 10824 unload_color (f, f->output_data.x->foreground_pixel); |
10826 unload_color (f, f->output_data.x->background_pixel); | 10825 unload_color (f, f->output_data.x->background_pixel); |
10827 unload_color (f, f->output_data.w32->cursor_pixel); | 10826 unload_color (f, f->output_data.w32->cursor_pixel); |
10833 if (f->output_data.w32->black_relief.allocated_p) | 10832 if (f->output_data.w32->black_relief.allocated_p) |
10834 unload_color (f, f->output_data.w32->black_relief.pixel); | 10833 unload_color (f, f->output_data.w32->black_relief.pixel); |
10835 | 10834 |
10836 if (FRAME_FACE_CACHE (f)) | 10835 if (FRAME_FACE_CACHE (f)) |
10837 free_frame_faces (f); | 10836 free_frame_faces (f); |
10838 | 10837 |
10839 xfree (f->output_data.w32); | 10838 xfree (f->output_data.w32); |
10840 f->output_data.w32 = NULL; | 10839 f->output_data.w32 = NULL; |
10841 | 10840 |
10842 if (f == dpyinfo->w32_focus_frame) | 10841 if (f == dpyinfo->w32_focus_frame) |
10843 dpyinfo->w32_focus_frame = 0; | 10842 dpyinfo->w32_focus_frame = 0; |
10844 if (f == dpyinfo->w32_focus_event_frame) | 10843 if (f == dpyinfo->w32_focus_event_frame) |
10845 dpyinfo->w32_focus_event_frame = 0; | 10844 dpyinfo->w32_focus_event_frame = 0; |
10846 if (f == dpyinfo->x_highlight_frame) | 10845 if (f == dpyinfo->x_highlight_frame) |
10942 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 10941 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
10943 | 10942 |
10944 xassert (font != NULL); | 10943 xassert (font != NULL); |
10945 | 10944 |
10946 for (i = 0; i < dpyinfo->n_fonts; i++) | 10945 for (i = 0; i < dpyinfo->n_fonts; i++) |
10947 if (dpyinfo->font_table[i].name | 10946 if (dpyinfo->font_table[i].name |
10948 && font == dpyinfo->font_table[i].font) | 10947 && font == dpyinfo->font_table[i].font) |
10949 break; | 10948 break; |
10950 | 10949 |
10951 xassert (i < dpyinfo->n_fonts); | 10950 xassert (i < dpyinfo->n_fonts); |
10952 } | 10951 } |
10986 int i; | 10985 int i; |
10987 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 10986 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
10988 XFontStruct *font; | 10987 XFontStruct *font; |
10989 int old_width = dpyinfo->smallest_char_width; | 10988 int old_width = dpyinfo->smallest_char_width; |
10990 int old_height = dpyinfo->smallest_font_height; | 10989 int old_height = dpyinfo->smallest_font_height; |
10991 | 10990 |
10992 dpyinfo->smallest_font_height = 100000; | 10991 dpyinfo->smallest_font_height = 100000; |
10993 dpyinfo->smallest_char_width = 100000; | 10992 dpyinfo->smallest_char_width = 100000; |
10994 | 10993 |
10995 for (i = 0; i < dpyinfo->n_fonts; ++i) | 10994 for (i = 0; i < dpyinfo->n_fonts; ++i) |
10996 if (dpyinfo->font_table[i].name) | 10995 if (dpyinfo->font_table[i].name) |
10997 { | 10996 { |
10998 struct font_info *fontp = dpyinfo->font_table + i; | 10997 struct font_info *fontp = dpyinfo->font_table + i; |
10999 int w, h; | 10998 int w, h; |
11000 | 10999 |
11001 font = (XFontStruct *) fontp->font; | 11000 font = (XFontStruct *) fontp->font; |
11002 xassert (font != (XFontStruct *) ~0); | 11001 xassert (font != (XFontStruct *) ~0); |
11003 x_font_min_bounds (font, &w, &h); | 11002 x_font_min_bounds (font, &w, &h); |
11004 | 11003 |
11005 dpyinfo->smallest_font_height = min (dpyinfo->smallest_font_height, h); | 11004 dpyinfo->smallest_font_height = min (dpyinfo->smallest_font_height, h); |
11006 dpyinfo->smallest_char_width = min (dpyinfo->smallest_char_width, w); | 11005 dpyinfo->smallest_char_width = min (dpyinfo->smallest_char_width, w); |
11007 } | 11006 } |
11008 | 11007 |
11009 xassert (dpyinfo->smallest_char_width > 0 | 11008 xassert (dpyinfo->smallest_char_width > 0 |
11039 | 11038 |
11040 /* Put it on w32_display_name_list. */ | 11039 /* Put it on w32_display_name_list. */ |
11041 w32_display_name_list = Fcons (Fcons (display_name, Qnil), | 11040 w32_display_name_list = Fcons (Fcons (display_name, Qnil), |
11042 w32_display_name_list); | 11041 w32_display_name_list); |
11043 dpyinfo->name_list_element = XCAR (w32_display_name_list); | 11042 dpyinfo->name_list_element = XCAR (w32_display_name_list); |
11044 | 11043 |
11045 dpyinfo->w32_id_name | 11044 dpyinfo->w32_id_name |
11046 = (char *) xmalloc (SCHARS (Vinvocation_name) | 11045 = (char *) xmalloc (SCHARS (Vinvocation_name) |
11047 + SCHARS (Vsystem_name) | 11046 + SCHARS (Vsystem_name) |
11048 + 2); | 11047 + 2); |
11049 sprintf (dpyinfo->w32_id_name, "%s@%s", | 11048 sprintf (dpyinfo->w32_id_name, "%s@%s", |
11077 char *xrm_option; | 11076 char *xrm_option; |
11078 char *resource_name; | 11077 char *resource_name; |
11079 { | 11078 { |
11080 struct w32_display_info *dpyinfo; | 11079 struct w32_display_info *dpyinfo; |
11081 HDC hdc; | 11080 HDC hdc; |
11082 | 11081 |
11083 BLOCK_INPUT; | 11082 BLOCK_INPUT; |
11084 | 11083 |
11085 if (!w32_initialized) | 11084 if (!w32_initialized) |
11086 { | 11085 { |
11087 w32_initialize (); | 11086 w32_initialize (); |
11088 w32_initialized = 1; | 11087 w32_initialized = 1; |
11089 } | 11088 } |
11090 | 11089 |
11091 { | 11090 { |
11092 int argc = 0; | 11091 int argc = 0; |
11093 char *argv[3]; | 11092 char *argv[3]; |
11094 | 11093 |
11095 argv[0] = ""; | 11094 argv[0] = ""; |
11098 { | 11097 { |
11099 argv[argc++] = "-xrm"; | 11098 argv[argc++] = "-xrm"; |
11100 argv[argc++] = xrm_option; | 11099 argv[argc++] = xrm_option; |
11101 } | 11100 } |
11102 } | 11101 } |
11103 | 11102 |
11104 w32_initialize_display_info (display_name); | 11103 w32_initialize_display_info (display_name); |
11105 | 11104 |
11106 dpyinfo = &one_w32_display_info; | 11105 dpyinfo = &one_w32_display_info; |
11107 | 11106 |
11108 /* Put this display on the chain. */ | 11107 /* Put this display on the chain. */ |
11109 dpyinfo->next = x_display_list; | 11108 dpyinfo->next = x_display_list; |
11110 x_display_list = dpyinfo; | 11109 x_display_list = dpyinfo; |
11111 | 11110 |
11112 hdc = GetDC (GetDesktopWindow ()); | 11111 hdc = GetDC (GetDesktopWindow ()); |
11113 | 11112 |
11114 dpyinfo->height = GetDeviceCaps (hdc, VERTRES); | 11113 dpyinfo->height = GetDeviceCaps (hdc, VERTRES); |
11115 dpyinfo->width = GetDeviceCaps (hdc, HORZRES); | 11114 dpyinfo->width = GetDeviceCaps (hdc, HORZRES); |
11116 dpyinfo->root_window = GetDesktopWindow (); | 11115 dpyinfo->root_window = GetDesktopWindow (); |
11289 /* Create the window thread - it will terminate itself or when the app terminates */ | 11288 /* Create the window thread - it will terminate itself or when the app terminates */ |
11290 | 11289 |
11291 init_crit (); | 11290 init_crit (); |
11292 | 11291 |
11293 dwMainThreadId = GetCurrentThreadId (); | 11292 dwMainThreadId = GetCurrentThreadId (); |
11294 DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), | 11293 DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), |
11295 GetCurrentProcess (), &hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS); | 11294 GetCurrentProcess (), &hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS); |
11296 | 11295 |
11297 /* Wait for thread to start */ | 11296 /* Wait for thread to start */ |
11298 | 11297 |
11299 { | 11298 { |
11300 MSG msg; | 11299 MSG msg; |
11301 | 11300 |
11302 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); | 11301 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); |
11303 | 11302 |
11304 hWindowsThread = CreateThread (NULL, 0, | 11303 hWindowsThread = CreateThread (NULL, 0, |
11305 (LPTHREAD_START_ROUTINE) w32_msg_worker, | 11304 (LPTHREAD_START_ROUTINE) w32_msg_worker, |
11306 0, 0, &dwWindowsThreadId); | 11305 0, 0, &dwWindowsThreadId); |
11307 | 11306 |
11308 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); | 11307 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
11309 } | 11308 } |
11310 | 11309 |
11311 /* It is desirable that mainThread should have the same notion of | 11310 /* It is desirable that mainThread should have the same notion of |
11312 focus window and active window as windowsThread. Unfortunately, the | 11311 focus window and active window as windowsThread. Unfortunately, the |
11313 following call to AttachThreadInput, which should do precisely what | 11312 following call to AttachThreadInput, which should do precisely what |
11314 we need, causes major problems when Emacs is linked as a console | 11313 we need, causes major problems when Emacs is linked as a console |
11315 program. Unfortunately, we have good reasons for doing that, so | 11314 program. Unfortunately, we have good reasons for doing that, so |
11385 | 11384 |
11386 DEFVAR_LISP ("w32-recognize-altgr", | 11385 DEFVAR_LISP ("w32-recognize-altgr", |
11387 &Vw32_recognize_altgr, | 11386 &Vw32_recognize_altgr, |
11388 doc: /* Recognize right-alt and left-ctrl as AltGr. | 11387 doc: /* Recognize right-alt and left-ctrl as AltGr. |
11389 When nil, the right-alt and left-ctrl key combination is | 11388 When nil, the right-alt and left-ctrl key combination is |
11390 interpreted normally. */); | 11389 interpreted normally. */); |
11391 Vw32_recognize_altgr = Qt; | 11390 Vw32_recognize_altgr = Qt; |
11392 | 11391 |
11393 DEFVAR_BOOL ("w32-enable-unicode-output", | 11392 DEFVAR_BOOL ("w32-enable-unicode-output", |
11394 &w32_enable_unicode_output, | 11393 &w32_enable_unicode_output, |
11395 doc: /* Enable the use of Unicode for text output if non-nil. | 11394 doc: /* Enable the use of Unicode for text output if non-nil. |
11418 doc: /* Flag to make the system caret visible. | 11417 doc: /* Flag to make the system caret visible. |
11419 When this is non-nil, Emacs will indicate the position of point by | 11418 When this is non-nil, Emacs will indicate the position of point by |
11420 using the system caret instead of drawing its own cursor. Some screen | 11419 using the system caret instead of drawing its own cursor. Some screen |
11421 reader software does not track the system cursor properly when it is | 11420 reader software does not track the system cursor properly when it is |
11422 invisible, and gets confused by Emacs drawing its own cursor, so this | 11421 invisible, and gets confused by Emacs drawing its own cursor, so this |
11423 variable is initialized to t when Emacs detects that screen reader | 11422 variable is initialized to t when Emacs detects that screen reader |
11424 software is running as it starts up. | 11423 software is running as it starts up. |
11425 | 11424 |
11426 When this variable is set, other variables affecting the appearance of | 11425 When this variable is set, other variables affecting the appearance of |
11427 the cursor have no effect. */); | 11426 the cursor have no effect. */); |
11428 | 11427 |