diff options
| author | Kim F. Storm | 2003-03-12 12:10:19 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2003-03-12 12:10:19 +0000 |
| commit | b6ae15325f1926c435bb32226b681fa9511db4ff (patch) | |
| tree | 5216a08f205c09d869350384891c1910c0ee18c2 /src | |
| parent | f4e1400d40a45059b6cc54b67787da1792630e02 (diff) | |
| download | emacs-b6ae15325f1926c435bb32226b681fa9511db4ff.tar.gz emacs-b6ae15325f1926c435bb32226b681fa9511db4ff.zip | |
Remove generic fringe code.
(w32_draw_fringe_bitmap): Only perform actual fringe drawing.
(w32_redisplay_interface): Add w32_draw_fringe_bitmap member.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32term.c | 442 |
1 files changed, 70 insertions, 372 deletions
diff --git a/src/w32term.c b/src/w32term.c index c74eb90cdfc..b5b919fa31f 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -64,91 +64,10 @@ Boston, MA 02111-1307, USA. */ | |||
| 64 | 64 | ||
| 65 | /* Fringe bitmaps. */ | 65 | /* Fringe bitmaps. */ |
| 66 | 66 | ||
| 67 | enum fringe_bitmap_type | 67 | static HBITMAP fringe_bmp[MAX_FRINGE_BITMAPS]; |
| 68 | { | ||
| 69 | NO_FRINGE_BITMAP, | ||
| 70 | LEFT_TRUNCATION_BITMAP, | ||
| 71 | RIGHT_TRUNCATION_BITMAP, | ||
| 72 | OVERLAY_ARROW_BITMAP, | ||
| 73 | CONTINUED_LINE_BITMAP, | ||
| 74 | CONTINUATION_LINE_BITMAP, | ||
| 75 | ZV_LINE_BITMAP | ||
| 76 | }; | ||
| 77 | |||
| 78 | /* Bitmaps are all unsigned short, as Windows requires bitmap data to | ||
| 79 | be Word aligned. For some reason they are horizontally reflected | ||
| 80 | compared to how they appear on X, so changes in xterm.c should be | ||
| 81 | reflected here. */ | ||
| 82 | |||
| 83 | /* Bitmap drawn to indicate lines not displaying text if | ||
| 84 | `indicate-empty-lines' is non-nil. */ | ||
| 85 | |||
| 86 | #define zv_width 8 | ||
| 87 | #define zv_height 72 | ||
| 88 | #define zv_period 3 | ||
| 89 | static unsigned short zv_bits[] = { | ||
| 90 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 91 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 92 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 93 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 94 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 95 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 96 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 97 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00}; | ||
| 98 | static HBITMAP zv_bmp; | ||
| 99 | |||
| 100 | /* An arrow like this: `<-'. */ | ||
| 101 | |||
| 102 | #define left_width 8 | ||
| 103 | #define left_height 8 | ||
| 104 | static unsigned short left_bits[] = { | ||
| 105 | 0x18, 0x30, 0x60, 0xfc, 0xfc, 0x60, 0x30, 0x18}; | ||
| 106 | static HBITMAP left_bmp; | ||
| 107 | |||
| 108 | /* Right truncation arrow bitmap `->'. */ | ||
| 109 | |||
| 110 | #define right_width 8 | ||
| 111 | #define right_height 8 | ||
| 112 | static unsigned short right_bits[] = { | ||
| 113 | 0x18, 0x0c, 0x06, 0x3f, 0x3f, 0x06, 0x0c, 0x18}; | ||
| 114 | static HBITMAP right_bmp; | ||
| 115 | |||
| 116 | /* Marker for continued lines. */ | ||
| 117 | |||
| 118 | #define continued_width 8 | ||
| 119 | #define continued_height 8 | ||
| 120 | static unsigned short continued_bits[] = { | ||
| 121 | 0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e}; | ||
| 122 | static HBITMAP continued_bmp; | ||
| 123 | |||
| 124 | /* Marker for continuation lines. */ | ||
| 125 | |||
| 126 | #define continuation_width 8 | ||
| 127 | #define continuation_height 8 | ||
| 128 | static unsigned short continuation_bits[] = { | ||
| 129 | 0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c}; | ||
| 130 | static HBITMAP continuation_bmp; | ||
| 131 | |||
| 132 | /* Overlay arrow bitmap. */ | ||
| 133 | |||
| 134 | #if 0 | ||
| 135 | /* A bomb. */ | ||
| 136 | #define ov_width 8 | ||
| 137 | #define ov_height 8 | ||
| 138 | static unsigned short ov_bits[] = { | ||
| 139 | 0x0c, 0x10, 0x3c, 0x7e, 0x5e, 0x5e, 0x46, 0x3c}; | ||
| 140 | #else | ||
| 141 | /* A triangular arrow. */ | ||
| 142 | #define ov_width 8 | ||
| 143 | #define ov_height 8 | ||
| 144 | static unsigned short ov_bits[] = { | ||
| 145 | 0xc0, 0xf0, 0xf8, 0xfc, 0xfc, 0xf8, 0xf0, 0xc0}; | ||
| 146 | #endif | ||
| 147 | static HBITMAP ov_bmp; | ||
| 148 | 68 | ||
| 149 | extern Lisp_Object Qhelp_echo; | 69 | extern Lisp_Object Qhelp_echo; |
| 150 | 70 | ||
| 151 | |||
| 152 | /* Non-nil means Emacs uses toolkit scroll bars. */ | 71 | /* Non-nil means Emacs uses toolkit scroll bars. */ |
| 153 | 72 | ||
| 154 | Lisp_Object Vx_toolkit_scroll_bars; | 73 | Lisp_Object Vx_toolkit_scroll_bars; |
| @@ -422,14 +341,9 @@ static void x_update_window_cursor P_ ((struct window *, int)); | |||
| 422 | static void x_erase_phys_cursor P_ ((struct window *)); | 341 | static void x_erase_phys_cursor P_ ((struct window *)); |
| 423 | void x_display_cursor P_ ((struct window *w, int, int, int, int, int)); | 342 | void x_display_cursor P_ ((struct window *w, int, int, int, int, int)); |
| 424 | void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int)); | 343 | void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int)); |
| 425 | static void w32_draw_fringe_bitmap P_ ((struct window *, HDC hdc, | ||
| 426 | struct glyph_row *, | ||
| 427 | enum fringe_bitmap_type, int left_p)); | ||
| 428 | static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, | 344 | static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, |
| 429 | HDC, int)); | 345 | HDC, int)); |
| 430 | static int x_phys_cursor_in_rect_p P_ ((struct window *, RECT *)); | 346 | static int x_phys_cursor_in_rect_p P_ ((struct window *, RECT *)); |
| 431 | static void x_draw_row_fringe_bitmaps P_ ((struct window *, | ||
| 432 | struct glyph_row *)); | ||
| 433 | static void notice_overwritten_cursor P_ ((struct window *, | 347 | static void notice_overwritten_cursor P_ ((struct window *, |
| 434 | enum glyph_row_area, | 348 | enum glyph_row_area, |
| 435 | int, int, int, int)); | 349 | int, int, int, int)); |
| @@ -808,7 +722,7 @@ x_after_update_window_line (desired_row) | |||
| 808 | if (!desired_row->mode_line_p && !w->pseudo_window_p) | 722 | if (!desired_row->mode_line_p && !w->pseudo_window_p) |
| 809 | { | 723 | { |
| 810 | BLOCK_INPUT; | 724 | BLOCK_INPUT; |
| 811 | x_draw_row_fringe_bitmaps (w, desired_row); | 725 | draw_row_fringe_bitmaps (w, desired_row); |
| 812 | UNBLOCK_INPUT; | 726 | UNBLOCK_INPUT; |
| 813 | } | 727 | } |
| 814 | 728 | ||
| @@ -851,206 +765,49 @@ x_after_update_window_line (desired_row) | |||
| 851 | drawn. */ | 765 | drawn. */ |
| 852 | 766 | ||
| 853 | static void | 767 | static void |
| 854 | w32_draw_fringe_bitmap (w, hdc, row, which, left_p) | 768 | w32_draw_fringe_bitmap (w, row, p) |
| 855 | struct window *w; | 769 | struct window *w; |
| 856 | HDC hdc; | ||
| 857 | struct glyph_row *row; | 770 | struct glyph_row *row; |
| 858 | enum fringe_bitmap_type which; | 771 | struct draw_fringe_bitmap_params *p; |
| 859 | int left_p; | ||
| 860 | { | 772 | { |
| 861 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 773 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 862 | HDC compat_hdc; | 774 | HDC hdc; |
| 863 | int x, y, wd, h, dy; | 775 | struct face *face = p->face; |
| 864 | int b1, b2; | 776 | |
| 865 | HBITMAP pixmap; | 777 | hdc = get_frame_dc (f); |
| 866 | HANDLE horig_obj; | ||
| 867 | struct face *face; | ||
| 868 | 778 | ||
| 869 | /* Must clip because of partially visible lines. */ | 779 | /* Must clip because of partially visible lines. */ |
| 870 | w32_clip_to_row (w, row, hdc, 1); | 780 | w32_clip_to_row (w, row, hdc, 1); |
| 871 | 781 | ||
| 872 | /* Convert row to frame coordinates. */ | 782 | if (p->bx >= 0) |
| 873 | y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | ||
| 874 | |||
| 875 | switch (which) | ||
| 876 | { | 783 | { |
| 877 | case NO_FRINGE_BITMAP: | ||
| 878 | wd = 0; | ||
| 879 | h = 0; | ||
| 880 | break; | ||
| 881 | |||
| 882 | case LEFT_TRUNCATION_BITMAP: | ||
| 883 | wd = left_width; | ||
| 884 | h = left_height; | ||
| 885 | pixmap = left_bmp; | ||
| 886 | break; | ||
| 887 | |||
| 888 | case OVERLAY_ARROW_BITMAP: | ||
| 889 | wd = ov_width; | ||
| 890 | h = ov_height; | ||
| 891 | pixmap = ov_bmp; | ||
| 892 | break; | ||
| 893 | |||
| 894 | case RIGHT_TRUNCATION_BITMAP: | ||
| 895 | wd = right_width; | ||
| 896 | h = right_height; | ||
| 897 | pixmap = right_bmp; | ||
| 898 | break; | ||
| 899 | |||
| 900 | case CONTINUED_LINE_BITMAP: | ||
| 901 | wd = continued_width; | ||
| 902 | h = continued_height; | ||
| 903 | pixmap = continued_bmp; | ||
| 904 | break; | ||
| 905 | |||
| 906 | case CONTINUATION_LINE_BITMAP: | ||
| 907 | wd = continuation_width; | ||
| 908 | h = continuation_height; | ||
| 909 | pixmap = continuation_bmp; | ||
| 910 | break; | ||
| 911 | |||
| 912 | case ZV_LINE_BITMAP: | ||
| 913 | wd = zv_width; | ||
| 914 | h = zv_height - (y % zv_period); | ||
| 915 | pixmap = zv_bmp; | ||
| 916 | break; | ||
| 917 | |||
| 918 | default: | ||
| 919 | abort (); | ||
| 920 | } | ||
| 921 | |||
| 922 | /* Clip bitmap if too high. */ | ||
| 923 | if (h > row->height) | ||
| 924 | h = row->height; | ||
| 925 | |||
| 926 | /* Set dy to the offset in the row to start drawing the bitmap. */ | ||
| 927 | dy = (row->height - h) / 2; | ||
| 928 | |||
| 929 | /* Draw the bitmap. */ | ||
| 930 | face = FACE_FROM_ID (f, FRINGE_FACE_ID); | ||
| 931 | PREPARE_FACE_FOR_DISPLAY (f, face); | ||
| 932 | |||
| 933 | /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill | ||
| 934 | the fringe. */ | ||
| 935 | b1 = -1; | ||
| 936 | if (left_p) | ||
| 937 | { | ||
| 938 | if (wd > FRAME_X_LEFT_FRINGE_WIDTH (f)) | ||
| 939 | wd = FRAME_X_LEFT_FRINGE_WIDTH (f); | ||
| 940 | x = (WINDOW_TO_FRAME_PIXEL_X (w, 0) | ||
| 941 | - wd | ||
| 942 | - (FRAME_X_LEFT_FRINGE_WIDTH (f) - wd) / 2); | ||
| 943 | if (wd < FRAME_X_LEFT_FRINGE_WIDTH (f) || row->height > h) | ||
| 944 | { | ||
| 945 | /* If W has a vertical border to its left, don't draw over it. */ | ||
| 946 | int border = ((XFASTINT (w->left) > 0 | ||
| 947 | && !FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | ||
| 948 | ? 1 : 0); | ||
| 949 | b1 = (window_box_left (w, -1) | ||
| 950 | - FRAME_X_LEFT_FRINGE_WIDTH (f) | ||
| 951 | + border); | ||
| 952 | b2 = (FRAME_X_LEFT_FRINGE_WIDTH (f) - border); | ||
| 953 | } | ||
| 954 | } | ||
| 955 | else | ||
| 956 | { | ||
| 957 | if (wd > FRAME_X_RIGHT_FRINGE_WIDTH (f)) | ||
| 958 | wd = FRAME_X_RIGHT_FRINGE_WIDTH (f); | ||
| 959 | x = (window_box_right (w, -1) | ||
| 960 | + (FRAME_X_RIGHT_FRINGE_WIDTH (f) - wd) / 2); | ||
| 961 | /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill | ||
| 962 | the fringe. */ | ||
| 963 | if (wd < FRAME_X_RIGHT_FRINGE_WIDTH (f) || row->height > h) | ||
| 964 | { | ||
| 965 | b1 = window_box_right (w, -1); | ||
| 966 | b2 = FRAME_X_RIGHT_FRINGE_WIDTH (f); | ||
| 967 | } | ||
| 968 | } | ||
| 969 | |||
| 970 | if (b1 >= 0) | ||
| 971 | { | ||
| 972 | int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | ||
| 973 | |||
| 974 | w32_fill_area (f, hdc, face->background, | 784 | w32_fill_area (f, hdc, face->background, |
| 975 | b1, | 785 | p->bx, p->by, p->nx, p->ny); |
| 976 | WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, | ||
| 977 | row->y)), | ||
| 978 | b2, | ||
| 979 | row->visible_height); | ||
| 980 | } | 786 | } |
| 981 | 787 | ||
| 982 | if (which == NO_FRINGE_BITMAP) | 788 | if (p->which != NO_FRINGE_BITMAP) |
| 983 | return; | 789 | { |
| 984 | 790 | HBITMAP pixmap = fringe_bmp[p->which]; | |
| 985 | compat_hdc = CreateCompatibleDC (hdc); | 791 | HDC compat_hdc; |
| 986 | SaveDC (hdc); | 792 | HANDLE horig_obj; |
| 987 | |||
| 988 | horig_obj = SelectObject (compat_hdc, pixmap); | ||
| 989 | SetTextColor (hdc, face->background); | ||
| 990 | SetBkColor (hdc, face->foreground); | ||
| 991 | |||
| 992 | BitBlt (hdc, x, y + dy, wd, h, compat_hdc, 0, | ||
| 993 | (which == ZV_LINE_BITMAP ? (row->y % zv_period) : 0), | ||
| 994 | SRCCOPY); | ||
| 995 | |||
| 996 | SelectObject (compat_hdc, horig_obj); | ||
| 997 | DeleteDC (compat_hdc); | ||
| 998 | RestoreDC (hdc, -1); | ||
| 999 | } | ||
| 1000 | |||
| 1001 | |||
| 1002 | /* Draw fringe bitmaps for glyph row ROW on window W. Call this | ||
| 1003 | function with input blocked. */ | ||
| 1004 | |||
| 1005 | static void | ||
| 1006 | x_draw_row_fringe_bitmaps (w, row) | ||
| 1007 | struct window *w; | ||
| 1008 | struct glyph_row *row; | ||
| 1009 | { | ||
| 1010 | struct frame *f = XFRAME (w->frame); | ||
| 1011 | enum fringe_bitmap_type bitmap; | ||
| 1012 | HDC hdc; | ||
| 1013 | |||
| 1014 | xassert (interrupt_input_blocked); | ||
| 1015 | 793 | ||
| 1016 | /* If row is completely invisible, because of vscrolling, we | 794 | compat_hdc = CreateCompatibleDC (hdc); |
| 1017 | don't have to draw anything. */ | 795 | SaveDC (hdc); |
| 1018 | if (row->visible_height <= 0) | ||
| 1019 | return; | ||
| 1020 | 796 | ||
| 1021 | hdc = get_frame_dc (f); | 797 | horig_obj = SelectObject (compat_hdc, pixmap); |
| 798 | SetTextColor (hdc, face->background); | ||
| 799 | SetBkColor (hdc, face->foreground); | ||
| 1022 | 800 | ||
| 1023 | if (FRAME_X_LEFT_FRINGE_WIDTH (f) != 0) | 801 | BitBlt (hdc, p->x, p->y, p->wd, p->h, |
| 1024 | { | 802 | compat_hdc, 0, p->dh, |
| 1025 | /* Decide which bitmap to draw in the left fringe. */ | 803 | SRCCOPY); |
| 1026 | if (row->overlay_arrow_p) | ||
| 1027 | bitmap = OVERLAY_ARROW_BITMAP; | ||
| 1028 | else if (row->truncated_on_left_p) | ||
| 1029 | bitmap = LEFT_TRUNCATION_BITMAP; | ||
| 1030 | else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) | ||
| 1031 | bitmap = CONTINUATION_LINE_BITMAP; | ||
| 1032 | else if (row->indicate_empty_line_p) | ||
| 1033 | bitmap = ZV_LINE_BITMAP; | ||
| 1034 | else | ||
| 1035 | bitmap = NO_FRINGE_BITMAP; | ||
| 1036 | 804 | ||
| 1037 | w32_draw_fringe_bitmap (w, hdc, row, bitmap, 1); | 805 | SelectObject (compat_hdc, horig_obj); |
| 806 | DeleteDC (compat_hdc); | ||
| 807 | RestoreDC (hdc, -1); | ||
| 1038 | } | 808 | } |
| 1039 | 809 | ||
| 1040 | if (FRAME_X_RIGHT_FRINGE_WIDTH (f) != 0) | 810 | w32_set_clip_rectangle (hdc, NULL); |
| 1041 | { | ||
| 1042 | /* Decide which bitmap to draw in the right fringe. */ | ||
| 1043 | if (row->truncated_on_right_p) | ||
| 1044 | bitmap = RIGHT_TRUNCATION_BITMAP; | ||
| 1045 | else if (row->continued_p) | ||
| 1046 | bitmap = CONTINUED_LINE_BITMAP; | ||
| 1047 | else if (row->indicate_empty_line_p && FRAME_X_LEFT_FRINGE_WIDTH (f) == 0) | ||
| 1048 | bitmap = ZV_LINE_BITMAP; | ||
| 1049 | else | ||
| 1050 | bitmap = NO_FRINGE_BITMAP; | ||
| 1051 | |||
| 1052 | w32_draw_fringe_bitmap (w, hdc, row, bitmap, 0); | ||
| 1053 | } | ||
| 1054 | 811 | ||
| 1055 | release_frame_dc (f, hdc); | 812 | release_frame_dc (f, hdc); |
| 1056 | } | 813 | } |
| @@ -5755,7 +5512,7 @@ expose_line (w, row, r) | |||
| 5755 | expose_area (w, row, r, TEXT_AREA); | 5512 | expose_area (w, row, r, TEXT_AREA); |
| 5756 | if (row->used[RIGHT_MARGIN_AREA]) | 5513 | if (row->used[RIGHT_MARGIN_AREA]) |
| 5757 | expose_area (w, row, r, RIGHT_MARGIN_AREA); | 5514 | expose_area (w, row, r, RIGHT_MARGIN_AREA); |
| 5758 | x_draw_row_fringe_bitmaps (w, row); | 5515 | draw_row_fringe_bitmaps (w, row); |
| 5759 | } | 5516 | } |
| 5760 | 5517 | ||
| 5761 | return row->mouse_face_p; | 5518 | return row->mouse_face_p; |
| @@ -10190,90 +9947,6 @@ x_new_fontset (f, fontsetname) | |||
| 10190 | return build_string (fontsetname); | 9947 | return build_string (fontsetname); |
| 10191 | } | 9948 | } |
| 10192 | 9949 | ||
| 10193 | /* Compute actual fringe widths */ | ||
| 10194 | |||
| 10195 | void | ||
| 10196 | x_compute_fringe_widths (f, redraw) | ||
| 10197 | struct frame *f; | ||
| 10198 | int redraw; | ||
| 10199 | { | ||
| 10200 | int o_left = f->output_data.w32->left_fringe_width; | ||
| 10201 | int o_right = f->output_data.w32->right_fringe_width; | ||
| 10202 | int o_cols = f->output_data.w32->fringe_cols; | ||
| 10203 | |||
| 10204 | Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist); | ||
| 10205 | Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist); | ||
| 10206 | int left_fringe_width, right_fringe_width; | ||
| 10207 | |||
| 10208 | if (!NILP (left_fringe)) | ||
| 10209 | left_fringe = Fcdr (left_fringe); | ||
| 10210 | if (!NILP (right_fringe)) | ||
| 10211 | right_fringe = Fcdr (right_fringe); | ||
| 10212 | |||
| 10213 | left_fringe_width = ((NILP (left_fringe) || !INTEGERP (left_fringe)) ? 8 : | ||
| 10214 | XINT (left_fringe)); | ||
| 10215 | right_fringe_width = ((NILP (right_fringe) || !INTEGERP (right_fringe)) ? 8 : | ||
| 10216 | XINT (right_fringe)); | ||
| 10217 | |||
| 10218 | if (left_fringe_width || right_fringe_width) | ||
| 10219 | { | ||
| 10220 | int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width; | ||
| 10221 | int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width; | ||
| 10222 | int conf_wid = left_wid + right_wid; | ||
| 10223 | int font_wid = FONT_WIDTH (f->output_data.w32->font); | ||
| 10224 | int cols = (left_wid + right_wid + font_wid-1) / font_wid; | ||
| 10225 | int real_wid = cols * font_wid; | ||
| 10226 | if (left_wid && right_wid) | ||
| 10227 | { | ||
| 10228 | if (left_fringe_width < 0) | ||
| 10229 | { | ||
| 10230 | /* Left fringe width is fixed, adjust right fringe if necessary */ | ||
| 10231 | f->output_data.w32->left_fringe_width = left_wid; | ||
| 10232 | f->output_data.w32->right_fringe_width = real_wid - left_wid; | ||
| 10233 | } | ||
| 10234 | else if (right_fringe_width < 0) | ||
| 10235 | { | ||
| 10236 | /* Right fringe width is fixed, adjust left fringe if necessary */ | ||
| 10237 | f->output_data.w32->left_fringe_width = real_wid - right_wid; | ||
| 10238 | f->output_data.w32->right_fringe_width = right_wid; | ||
| 10239 | } | ||
| 10240 | else | ||
| 10241 | { | ||
| 10242 | /* Adjust both fringes with an equal amount. | ||
| 10243 | Note that we are doing integer arithmetic here, so don't | ||
| 10244 | lose a pixel if the total width is an odd number. */ | ||
| 10245 | int fill = real_wid - conf_wid; | ||
| 10246 | f->output_data.w32->left_fringe_width = left_wid + fill/2; | ||
| 10247 | f->output_data.w32->right_fringe_width = right_wid + fill - fill/2; | ||
| 10248 | } | ||
| 10249 | } | ||
| 10250 | else if (left_fringe_width) | ||
| 10251 | { | ||
| 10252 | f->output_data.w32->left_fringe_width = real_wid; | ||
| 10253 | f->output_data.w32->right_fringe_width = 0; | ||
| 10254 | } | ||
| 10255 | else | ||
| 10256 | { | ||
| 10257 | f->output_data.w32->left_fringe_width = 0; | ||
| 10258 | f->output_data.w32->right_fringe_width = real_wid; | ||
| 10259 | } | ||
| 10260 | f->output_data.w32->fringe_cols = cols; | ||
| 10261 | f->output_data.w32->fringes_extra = real_wid; | ||
| 10262 | } | ||
| 10263 | else | ||
| 10264 | { | ||
| 10265 | f->output_data.w32->left_fringe_width = 0; | ||
| 10266 | f->output_data.w32->right_fringe_width = 0; | ||
| 10267 | f->output_data.w32->fringe_cols = 0; | ||
| 10268 | f->output_data.w32->fringes_extra = 0; | ||
| 10269 | } | ||
| 10270 | |||
| 10271 | if (redraw && FRAME_VISIBLE_P (f)) | ||
| 10272 | if (o_left != f->output_data.w32->left_fringe_width || | ||
| 10273 | o_right != f->output_data.w32->right_fringe_width || | ||
| 10274 | o_cols != f->output_data.w32->fringe_cols) | ||
| 10275 | redraw_frame (f); | ||
| 10276 | } | ||
| 10277 | 9950 | ||
| 10278 | /*********************************************************************** | 9951 | /*********************************************************************** |
| 10279 | TODO: W32 Input Methods | 9952 | TODO: W32 Input Methods |
| @@ -10517,7 +10190,7 @@ x_set_window_size (f, change_gravity, cols, rows) | |||
| 10517 | ? 0 | 10190 | ? 0 |
| 10518 | : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); | 10191 | : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); |
| 10519 | 10192 | ||
| 10520 | x_compute_fringe_widths (f, 0); | 10193 | compute_fringe_widths (f, 0); |
| 10521 | 10194 | ||
| 10522 | pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); | 10195 | pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); |
| 10523 | pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); | 10196 | pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); |
| @@ -11238,15 +10911,39 @@ w32_term_init (display_name, xrm_option, resource_name) | |||
| 11238 | w32_defined_color (0, "black", &color, 1); | 10911 | w32_defined_color (0, "black", &color, 1); |
| 11239 | } | 10912 | } |
| 11240 | 10913 | ||
| 11241 | /* Create Row Bitmaps and store them for later use. */ | 10914 | /* Create Fringe Bitmaps and store them for later use. |
| 11242 | left_bmp = CreateBitmap (left_width, left_height, 1, 1, left_bits); | 10915 | |
| 11243 | ov_bmp = CreateBitmap (ov_width, ov_height, 1, 1, ov_bits); | 10916 | On W32, bitmaps are all unsigned short, as Windows requires |
| 11244 | right_bmp = CreateBitmap (right_width, right_height, 1, 1, right_bits); | 10917 | bitmap data to be Word aligned. For some reason they are |
| 11245 | continued_bmp = CreateBitmap (continued_width, continued_height, 1, | 10918 | horizontally reflected compared to how they appear on X, so we |
| 11246 | 1, continued_bits); | 10919 | need to bitswap and convert to unsigned shorts before creating |
| 11247 | continuation_bmp = CreateBitmap (continuation_width, continuation_height, | 10920 | the bitmaps. */ |
| 11248 | 1, 1, continuation_bits); | 10921 | { |
| 11249 | zv_bmp = CreateBitmap (zv_width, zv_height, 1, 1, zv_bits); | 10922 | int i, j; |
| 10923 | |||
| 10924 | for (i = NO_FRINGE_BITMAP + 1; i < MAX_FRINGE_BITMAPS; i++) | ||
| 10925 | { | ||
| 10926 | int h = fringe_bitmaps[i].height; | ||
| 10927 | int wd = fringe_bitmaps[i].width; | ||
| 10928 | unsigned short *w32bits | ||
| 10929 | = (unsigned short *)alloca (h * sizeof (unsigned short)); | ||
| 10930 | unsigned short *wb = w32bits; | ||
| 10931 | unsigned char *bits = fringe_bitmaps[i].bits; | ||
| 10932 | for (j = 0; j < h; j++) | ||
| 10933 | { | ||
| 10934 | static unsigned char swap_nibble[16] | ||
| 10935 | = { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */ | ||
| 10936 | 0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */ | ||
| 10937 | 0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */ | ||
| 10938 | 0x3, 0xb, 0x7, 0xf }; /* 0011 1011 0111 1111 */ | ||
| 10939 | |||
| 10940 | unsigned char b = *bits++; | ||
| 10941 | *wb++ = (unsigned short)((swap_nibble[b & 0xf]<<4) | ||
| 10942 | | (swap_nibble[(b>>4) & 0xf])); | ||
| 10943 | } | ||
| 10944 | fringe_bmp[i] = CreateBitmap (wd, h, 1, 1, w32bits); | ||
| 10945 | } | ||
| 10946 | } | ||
| 11250 | 10947 | ||
| 11251 | #ifndef F_SETOWN_BUG | 10948 | #ifndef F_SETOWN_BUG |
| 11252 | #ifdef F_SETOWN | 10949 | #ifdef F_SETOWN |
| @@ -11315,12 +11012,12 @@ x_delete_display (dpyinfo) | |||
| 11315 | xfree (dpyinfo->w32_id_name); | 11012 | xfree (dpyinfo->w32_id_name); |
| 11316 | 11013 | ||
| 11317 | /* Destroy row bitmaps. */ | 11014 | /* Destroy row bitmaps. */ |
| 11318 | DeleteObject (left_bmp); | 11015 | { |
| 11319 | DeleteObject (ov_bmp); | 11016 | int i; |
| 11320 | DeleteObject (right_bmp); | 11017 | |
| 11321 | DeleteObject (continued_bmp); | 11018 | for (i = NO_FRINGE_BITMAP + 1; i < MAX_FRINGE_BITMAPS; i++) |
| 11322 | DeleteObject (continuation_bmp); | 11019 | DeleteObject (fringe_bmp[i]); |
| 11323 | DeleteObject (zv_bmp); | 11020 | } |
| 11324 | } | 11021 | } |
| 11325 | 11022 | ||
| 11326 | /* Set up use of W32. */ | 11023 | /* Set up use of W32. */ |
| @@ -11345,7 +11042,8 @@ static struct redisplay_interface w32_redisplay_interface = | |||
| 11345 | x_flush, | 11042 | x_flush, |
| 11346 | x_clear_mouse_face, | 11043 | x_clear_mouse_face, |
| 11347 | x_get_glyph_overhangs, | 11044 | x_get_glyph_overhangs, |
| 11348 | x_fix_overlapping_area | 11045 | x_fix_overlapping_area, |
| 11046 | w32_draw_fringe_bitmap | ||
| 11349 | }; | 11047 | }; |
| 11350 | 11048 | ||
| 11351 | void | 11049 | void |