diff options
| author | Kim F. Storm | 2001-12-01 01:22:27 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2001-12-01 01:22:27 +0000 |
| commit | 976b73d7c114510fe950e803142b278bf924e7cc (patch) | |
| tree | 3a994784e7446fada44f7100858577d3d823c1a2 /src | |
| parent | d246e5586b4cbb5543a4c3d1579cae111513f16a (diff) | |
| download | emacs-976b73d7c114510fe950e803142b278bf924e7cc.tar.gz emacs-976b73d7c114510fe950e803142b278bf924e7cc.zip | |
(zv_height, zv_bits, zv_period): Changed zv bitmap to
fill fringe evenly with small dashes.
(x_draw_fringe_bitmap): Clear background if necessary. Align and
clip the new ZV bitmap to avoid jitter between rows.
(x_draw_row_fringe_bitmaps): Rely on x_draw_fringe_bitmap to clear
background. Don't draw fringe bitmaps if fringe width is zero.
(x_compute_fringe_widths): New function.
(x_new_font, x_set_window_size_1): Use it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 341 |
1 files changed, 214 insertions, 127 deletions
diff --git a/src/xterm.c b/src/xterm.c index c6ff4e6d08e..06d9af4ea6d 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -172,9 +172,17 @@ enum fringe_bitmap_type | |||
| 172 | `indicate-empty-lines' is non-nil. */ | 172 | `indicate-empty-lines' is non-nil. */ |
| 173 | 173 | ||
| 174 | #define zv_width 8 | 174 | #define zv_width 8 |
| 175 | #define zv_height 8 | 175 | #define zv_height 72 |
| 176 | #define zv_period 3 | ||
| 176 | static unsigned char zv_bits[] = { | 177 | static unsigned char zv_bits[] = { |
| 177 | 0x00, 0x00, 0x1e, 0x1e, 0x1e, 0x1e, 0x00, 0x00}; | 178 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, |
| 179 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 180 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 181 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 182 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 183 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 184 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 185 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00}; | ||
| 178 | 186 | ||
| 179 | /* An arrow like this: `<-'. */ | 187 | /* An arrow like this: `<-'. */ |
| 180 | 188 | ||
| @@ -462,7 +470,7 @@ static void x_update_window_cursor P_ ((struct window *, int)); | |||
| 462 | static void x_erase_phys_cursor P_ ((struct window *)); | 470 | static void x_erase_phys_cursor P_ ((struct window *)); |
| 463 | void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int)); | 471 | void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int)); |
| 464 | static void x_draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, | 472 | static void x_draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, |
| 465 | enum fringe_bitmap_type)); | 473 | enum fringe_bitmap_type, int left_p)); |
| 466 | 474 | ||
| 467 | static void x_clip_to_row P_ ((struct window *, struct glyph_row *, | 475 | static void x_clip_to_row P_ ((struct window *, struct glyph_row *, |
| 468 | GC, int)); | 476 | GC, int)); |
| @@ -817,15 +825,17 @@ x_after_update_window_line (desired_row) | |||
| 817 | drawn. */ | 825 | drawn. */ |
| 818 | 826 | ||
| 819 | static void | 827 | static void |
| 820 | x_draw_fringe_bitmap (w, row, which) | 828 | x_draw_fringe_bitmap (w, row, which, left_p) |
| 821 | struct window *w; | 829 | struct window *w; |
| 822 | struct glyph_row *row; | 830 | struct glyph_row *row; |
| 823 | enum fringe_bitmap_type which; | 831 | enum fringe_bitmap_type which; |
| 832 | int left_p; | ||
| 824 | { | 833 | { |
| 825 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 834 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 826 | Display *display = FRAME_X_DISPLAY (f); | 835 | Display *display = FRAME_X_DISPLAY (f); |
| 827 | Window window = FRAME_X_WINDOW (f); | 836 | Window window = FRAME_X_WINDOW (f); |
| 828 | int x, y, wd, h, dy; | 837 | int x, y, wd, h, dy; |
| 838 | int b1, b2; | ||
| 829 | unsigned char *bits; | 839 | unsigned char *bits; |
| 830 | Pixmap pixmap; | 840 | Pixmap pixmap; |
| 831 | GC gc = f->output_data.x->normal_gc; | 841 | GC gc = f->output_data.x->normal_gc; |
| @@ -835,72 +845,131 @@ x_draw_fringe_bitmap (w, row, which) | |||
| 835 | /* Must clip because of partially visible lines. */ | 845 | /* Must clip because of partially visible lines. */ |
| 836 | x_clip_to_row (w, row, gc, 1); | 846 | x_clip_to_row (w, row, gc, 1); |
| 837 | 847 | ||
| 848 | /* Convert row to frame coordinates. */ | ||
| 849 | y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | ||
| 850 | |||
| 838 | switch (which) | 851 | switch (which) |
| 839 | { | 852 | { |
| 853 | case NO_FRINGE_BITMAP: | ||
| 854 | wd = 0; | ||
| 855 | h = 0; | ||
| 856 | break; | ||
| 857 | |||
| 840 | case LEFT_TRUNCATION_BITMAP: | 858 | case LEFT_TRUNCATION_BITMAP: |
| 841 | wd = left_width; | 859 | wd = left_width; |
| 842 | h = left_height; | 860 | h = left_height; |
| 843 | bits = left_bits; | 861 | bits = left_bits; |
| 844 | x = (WINDOW_TO_FRAME_PIXEL_X (w, 0) | ||
| 845 | - wd | ||
| 846 | - (FRAME_X_LEFT_FRINGE_WIDTH (f) - wd) / 2); | ||
| 847 | break; | 862 | break; |
| 848 | 863 | ||
| 849 | case OVERLAY_ARROW_BITMAP: | 864 | case OVERLAY_ARROW_BITMAP: |
| 850 | wd = left_width; | 865 | wd = ov_width; |
| 851 | h = left_height; | 866 | h = ov_height; |
| 852 | bits = ov_bits; | 867 | bits = ov_bits; |
| 853 | x = (WINDOW_TO_FRAME_PIXEL_X (w, 0) | ||
| 854 | - wd | ||
| 855 | - (FRAME_X_LEFT_FRINGE_WIDTH (f) - wd) / 2); | ||
| 856 | break; | 868 | break; |
| 857 | 869 | ||
| 858 | case RIGHT_TRUNCATION_BITMAP: | 870 | case RIGHT_TRUNCATION_BITMAP: |
| 859 | wd = right_width; | 871 | wd = right_width; |
| 860 | h = right_height; | 872 | h = right_height; |
| 861 | bits = right_bits; | 873 | bits = right_bits; |
| 862 | x = window_box_right (w, -1); | ||
| 863 | x += (FRAME_X_RIGHT_FRINGE_WIDTH (f) - wd) / 2; | ||
| 864 | break; | 874 | break; |
| 865 | 875 | ||
| 866 | case CONTINUED_LINE_BITMAP: | 876 | case CONTINUED_LINE_BITMAP: |
| 867 | wd = right_width; | 877 | wd = continued_width; |
| 868 | h = right_height; | 878 | h = continued_height; |
| 869 | bits = continued_bits; | 879 | bits = continued_bits; |
| 870 | x = window_box_right (w, -1); | ||
| 871 | x += (FRAME_X_RIGHT_FRINGE_WIDTH (f) - wd) / 2; | ||
| 872 | break; | 880 | break; |
| 873 | 881 | ||
| 874 | case CONTINUATION_LINE_BITMAP: | 882 | case CONTINUATION_LINE_BITMAP: |
| 875 | wd = continuation_width; | 883 | wd = continuation_width; |
| 876 | h = continuation_height; | 884 | h = continuation_height; |
| 877 | bits = continuation_bits; | 885 | bits = continuation_bits; |
| 878 | x = (WINDOW_TO_FRAME_PIXEL_X (w, 0) | ||
| 879 | - wd | ||
| 880 | - (FRAME_X_LEFT_FRINGE_WIDTH (f) - wd) / 2); | ||
| 881 | break; | 886 | break; |
| 882 | 887 | ||
| 883 | case ZV_LINE_BITMAP: | 888 | case ZV_LINE_BITMAP: |
| 884 | wd = zv_width; | 889 | wd = zv_width; |
| 885 | h = zv_height; | 890 | h = zv_height - (y % zv_period); |
| 886 | bits = zv_bits; | 891 | bits = zv_bits + (y % zv_period); |
| 887 | x = (WINDOW_TO_FRAME_PIXEL_X (w, 0) | ||
| 888 | - wd | ||
| 889 | - (FRAME_X_LEFT_FRINGE_WIDTH (f) - wd) / 2); | ||
| 890 | break; | 892 | break; |
| 891 | 893 | ||
| 892 | default: | 894 | default: |
| 893 | abort (); | 895 | abort (); |
| 894 | } | 896 | } |
| 895 | 897 | ||
| 896 | /* Convert to frame coordinates. Set dy to the offset in the row to | 898 | /* Clip bitmap if too high. */ |
| 897 | start drawing the bitmap. */ | 899 | if (h > row->height) |
| 898 | y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | 900 | h = row->height; |
| 901 | |||
| 902 | /* Set dy to the offset in the row to start drawing the bitmap. */ | ||
| 899 | dy = (row->height - h) / 2; | 903 | dy = (row->height - h) / 2; |
| 900 | 904 | ||
| 905 | face = FACE_FROM_ID (f, FRINGE_FACE_ID); | ||
| 906 | PREPARE_FACE_FOR_DISPLAY (f, face); | ||
| 907 | |||
| 908 | /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill | ||
| 909 | the fringe. */ | ||
| 910 | b1 = -1; | ||
| 911 | if (left_p) | ||
| 912 | { | ||
| 913 | if (wd > FRAME_X_LEFT_FRINGE_WIDTH (f)) | ||
| 914 | wd = FRAME_X_LEFT_FRINGE_WIDTH (f); | ||
| 915 | x = (WINDOW_TO_FRAME_PIXEL_X (w, 0) | ||
| 916 | - wd | ||
| 917 | - (FRAME_X_LEFT_FRINGE_WIDTH (f) - wd) / 2); | ||
| 918 | if (wd < FRAME_X_LEFT_FRINGE_WIDTH (f) || row->height > h) | ||
| 919 | { | ||
| 920 | /* If W has a vertical border to its left, don't draw over it. */ | ||
| 921 | int border = ((XFASTINT (w->left) > 0 | ||
| 922 | && !FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | ||
| 923 | ? 1 : 0); | ||
| 924 | b1 = (window_box_left (w, -1) | ||
| 925 | - FRAME_X_LEFT_FRINGE_WIDTH (f) | ||
| 926 | + border); | ||
| 927 | b2 = (FRAME_X_LEFT_FRINGE_WIDTH (f) - border); | ||
| 928 | } | ||
| 929 | } | ||
| 930 | else | ||
| 931 | { | ||
| 932 | if (wd > FRAME_X_RIGHT_FRINGE_WIDTH (f)) | ||
| 933 | wd = FRAME_X_RIGHT_FRINGE_WIDTH (f); | ||
| 934 | x = (window_box_right (w, -1) | ||
| 935 | + (FRAME_X_RIGHT_FRINGE_WIDTH (f) - wd) / 2); | ||
| 936 | /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill | ||
| 937 | the fringe. */ | ||
| 938 | if (wd < FRAME_X_RIGHT_FRINGE_WIDTH (f) || row->height > h) | ||
| 939 | { | ||
| 940 | b1 = window_box_right (w, -1); | ||
| 941 | b2 = FRAME_X_RIGHT_FRINGE_WIDTH (f); | ||
| 942 | } | ||
| 943 | } | ||
| 944 | |||
| 945 | if (b1 >= 0) | ||
| 946 | { | ||
| 947 | int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | ||
| 948 | |||
| 949 | /* In case the same realized face is used for fringes and | ||
| 950 | for something displayed in the text (e.g. face `region' on | ||
| 951 | mono-displays, the fill style may have been changed to | ||
| 952 | FillSolid in x_draw_glyph_string_background. */ | ||
| 953 | if (face->stipple) | ||
| 954 | XSetFillStyle (display, face->gc, FillOpaqueStippled); | ||
| 955 | else | ||
| 956 | XSetForeground (display, face->gc, face->background); | ||
| 957 | |||
| 958 | XFillRectangle (display, window, face->gc, | ||
| 959 | b1, | ||
| 960 | WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, | ||
| 961 | row->y)), | ||
| 962 | b2, | ||
| 963 | row->visible_height); | ||
| 964 | if (!face->stipple) | ||
| 965 | XSetForeground (display, face->gc, face->foreground); | ||
| 966 | } | ||
| 967 | |||
| 968 | if (which == NO_FRINGE_BITMAP) | ||
| 969 | return; | ||
| 970 | |||
| 901 | /* Draw the bitmap. I believe these small pixmaps can be cached | 971 | /* Draw the bitmap. I believe these small pixmaps can be cached |
| 902 | by the server. */ | 972 | by the server. */ |
| 903 | face = FACE_FROM_ID (f, FRINGE_FACE_ID); | ||
| 904 | pixmap = XCreatePixmapFromBitmapData (display, window, bits, wd, h, | 973 | pixmap = XCreatePixmapFromBitmapData (display, window, bits, wd, h, |
| 905 | face->foreground, | 974 | face->foreground, |
| 906 | face->background, depth); | 975 | face->background, depth); |
| @@ -920,8 +989,6 @@ x_draw_row_fringe_bitmaps (w, row) | |||
| 920 | { | 989 | { |
| 921 | struct frame *f = XFRAME (w->frame); | 990 | struct frame *f = XFRAME (w->frame); |
| 922 | enum fringe_bitmap_type bitmap; | 991 | enum fringe_bitmap_type bitmap; |
| 923 | struct face *face; | ||
| 924 | int header_line_height = -1; | ||
| 925 | 992 | ||
| 926 | xassert (interrupt_input_blocked); | 993 | xassert (interrupt_input_blocked); |
| 927 | 994 | ||
| @@ -930,103 +997,37 @@ x_draw_row_fringe_bitmaps (w, row) | |||
| 930 | if (row->visible_height <= 0) | 997 | if (row->visible_height <= 0) |
| 931 | return; | 998 | return; |
| 932 | 999 | ||
| 933 | face = FACE_FROM_ID (f, FRINGE_FACE_ID); | 1000 | if (FRAME_X_LEFT_FRINGE_WIDTH (f) != 0) |
| 934 | PREPARE_FACE_FOR_DISPLAY (f, face); | 1001 | { |
| 935 | 1002 | /* Decide which bitmap to draw in the left fringe. */ | |
| 936 | /* Decide which bitmap to draw in the left fringe. */ | 1003 | if (row->overlay_arrow_p) |
| 937 | if (row->overlay_arrow_p) | 1004 | bitmap = OVERLAY_ARROW_BITMAP; |
| 938 | bitmap = OVERLAY_ARROW_BITMAP; | 1005 | else if (row->truncated_on_left_p) |
| 939 | else if (row->truncated_on_left_p) | 1006 | bitmap = LEFT_TRUNCATION_BITMAP; |
| 940 | bitmap = LEFT_TRUNCATION_BITMAP; | 1007 | else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) |
| 941 | else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) | 1008 | bitmap = CONTINUATION_LINE_BITMAP; |
| 942 | bitmap = CONTINUATION_LINE_BITMAP; | 1009 | else if (row->indicate_empty_line_p) |
| 943 | else if (row->indicate_empty_line_p) | 1010 | bitmap = ZV_LINE_BITMAP; |
| 944 | bitmap = ZV_LINE_BITMAP; | ||
| 945 | else | ||
| 946 | bitmap = NO_FRINGE_BITMAP; | ||
| 947 | |||
| 948 | /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill | ||
| 949 | the fringe. */ | ||
| 950 | if (bitmap == NO_FRINGE_BITMAP | ||
| 951 | || FRAME_FRINGE_BITMAP_WIDTH (f) < FRAME_X_LEFT_FRINGE_WIDTH (f) | ||
| 952 | || row->height > FRAME_FRINGE_BITMAP_HEIGHT (f)) | ||
| 953 | { | ||
| 954 | /* If W has a vertical border to its left, don't draw over it. */ | ||
| 955 | int border = ((XFASTINT (w->left) > 0 | ||
| 956 | && !FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | ||
| 957 | ? 1 : 0); | ||
| 958 | int left = window_box_left (w, -1); | ||
| 959 | |||
| 960 | if (header_line_height < 0) | ||
| 961 | header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | ||
| 962 | |||
| 963 | /* In case the same realized face is used for fringes and | ||
| 964 | for something displayed in the text (e.g. face `region' on | ||
| 965 | mono-displays, the fill style may have been changed to | ||
| 966 | FillSolid in x_draw_glyph_string_background. */ | ||
| 967 | if (face->stipple) | ||
| 968 | XSetFillStyle (FRAME_X_DISPLAY (f), face->gc, FillOpaqueStippled); | ||
| 969 | else | 1011 | else |
| 970 | XSetForeground (FRAME_X_DISPLAY (f), face->gc, face->background); | 1012 | bitmap = NO_FRINGE_BITMAP; |
| 971 | |||
| 972 | XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 973 | face->gc, | ||
| 974 | (left | ||
| 975 | - FRAME_X_LEFT_FRINGE_WIDTH (f) | ||
| 976 | + border), | ||
| 977 | WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, | ||
| 978 | row->y)), | ||
| 979 | FRAME_X_LEFT_FRINGE_WIDTH (f) - border, | ||
| 980 | row->visible_height); | ||
| 981 | if (!face->stipple) | ||
| 982 | XSetForeground (FRAME_X_DISPLAY (f), face->gc, face->foreground); | ||
| 983 | } | ||
| 984 | |||
| 985 | /* Draw the left bitmap. */ | ||
| 986 | if (bitmap != NO_FRINGE_BITMAP) | ||
| 987 | x_draw_fringe_bitmap (w, row, bitmap); | ||
| 988 | 1013 | ||
| 989 | /* Decide which bitmap to draw in the right fringe. */ | 1014 | x_draw_fringe_bitmap (w, row, bitmap, 1); |
| 990 | if (row->truncated_on_right_p) | 1015 | } |
| 991 | bitmap = RIGHT_TRUNCATION_BITMAP; | ||
| 992 | else if (row->continued_p) | ||
| 993 | bitmap = CONTINUED_LINE_BITMAP; | ||
| 994 | else | ||
| 995 | bitmap = NO_FRINGE_BITMAP; | ||
| 996 | 1016 | ||
| 997 | /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill | 1017 | if (FRAME_X_RIGHT_FRINGE_WIDTH (f) != 0) |
| 998 | the fringe. */ | ||
| 999 | if (bitmap == NO_FRINGE_BITMAP | ||
| 1000 | || FRAME_FRINGE_BITMAP_WIDTH (f) < FRAME_X_RIGHT_FRINGE_WIDTH (f) | ||
| 1001 | || row->height > FRAME_FRINGE_BITMAP_HEIGHT (f)) | ||
| 1002 | { | 1018 | { |
| 1003 | int right = window_box_right (w, -1); | 1019 | /* Decide which bitmap to draw in the right fringe. */ |
| 1004 | 1020 | if (row->truncated_on_right_p) | |
| 1005 | if (header_line_height < 0) | 1021 | bitmap = RIGHT_TRUNCATION_BITMAP; |
| 1006 | header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 1022 | else if (row->continued_p) |
| 1007 | 1023 | bitmap = CONTINUED_LINE_BITMAP; | |
| 1008 | /* In case the same realized face is used for fringes and | 1024 | else if (row->indicate_empty_line_p && FRAME_X_LEFT_FRINGE_WIDTH (f) == 0) |
| 1009 | for something displayed in the text (e.g. face `region' on | 1025 | bitmap = ZV_LINE_BITMAP; |
| 1010 | mono-displays, the fill style may have been changed to | ||
| 1011 | FillSolid in x_draw_glyph_string_background. */ | ||
| 1012 | if (face->stipple) | ||
| 1013 | XSetFillStyle (FRAME_X_DISPLAY (f), face->gc, FillOpaqueStippled); | ||
| 1014 | else | 1026 | else |
| 1015 | XSetForeground (FRAME_X_DISPLAY (f), face->gc, face->background); | 1027 | bitmap = NO_FRINGE_BITMAP; |
| 1016 | XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 1017 | face->gc, | ||
| 1018 | right, | ||
| 1019 | WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, | ||
| 1020 | row->y)), | ||
| 1021 | FRAME_X_RIGHT_FRINGE_WIDTH (f), | ||
| 1022 | row->visible_height); | ||
| 1023 | if (!face->stipple) | ||
| 1024 | XSetForeground (FRAME_X_DISPLAY (f), face->gc, face->foreground); | ||
| 1025 | } | ||
| 1026 | 1028 | ||
| 1027 | /* Draw the right bitmap. */ | 1029 | x_draw_fringe_bitmap (w, row, bitmap, 0); |
| 1028 | if (bitmap != NO_FRINGE_BITMAP) | 1030 | } |
| 1029 | x_draw_fringe_bitmap (w, row, bitmap); | ||
| 1030 | } | 1031 | } |
| 1031 | 1032 | ||
| 1032 | 1033 | ||
| @@ -5064,7 +5065,6 @@ x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | |||
| 5064 | /* X is relative to the left edge of W, without scroll bars | 5065 | /* X is relative to the left edge of W, without scroll bars |
| 5065 | or fringes. */ | 5066 | or fringes. */ |
| 5066 | struct frame *f = XFRAME (w->frame); | 5067 | struct frame *f = XFRAME (w->frame); |
| 5067 | /* int width = FRAME_FRINGE_WIDTH (f); */ | ||
| 5068 | int window_left_x = WINDOW_LEFT_MARGIN (w) * CANON_X_UNIT (f); | 5068 | int window_left_x = WINDOW_LEFT_MARGIN (w) * CANON_X_UNIT (f); |
| 5069 | 5069 | ||
| 5070 | x += window_left_x; | 5070 | x += window_left_x; |
| @@ -12099,7 +12099,9 @@ x_new_font (f, fontname) | |||
| 12099 | f->output_data.x->font = (XFontStruct *) (fontp->font); | 12099 | f->output_data.x->font = (XFontStruct *) (fontp->font); |
| 12100 | f->output_data.x->baseline_offset = fontp->baseline_offset; | 12100 | f->output_data.x->baseline_offset = fontp->baseline_offset; |
| 12101 | f->output_data.x->fontset = -1; | 12101 | f->output_data.x->fontset = -1; |
| 12102 | 12102 | ||
| 12103 | x_compute_fringe_widths (f, 1); | ||
| 12104 | |||
| 12103 | /* Compute the scroll bar width in character columns. */ | 12105 | /* Compute the scroll bar width in character columns. */ |
| 12104 | if (f->scroll_bar_pixel_width > 0) | 12106 | if (f->scroll_bar_pixel_width > 0) |
| 12105 | { | 12107 | { |
| @@ -12177,6 +12179,90 @@ x_new_fontset (f, fontsetname) | |||
| 12177 | return build_string (fontsetname); | 12179 | return build_string (fontsetname); |
| 12178 | } | 12180 | } |
| 12179 | 12181 | ||
| 12182 | /* Compute actual fringe widths */ | ||
| 12183 | |||
| 12184 | void | ||
| 12185 | x_compute_fringe_widths (f, redraw) | ||
| 12186 | struct frame *f; | ||
| 12187 | int redraw; | ||
| 12188 | { | ||
| 12189 | int o_left = f->output_data.x->left_fringe_width; | ||
| 12190 | int o_right = f->output_data.x->right_fringe_width; | ||
| 12191 | int o_cols = f->output_data.x->fringe_cols; | ||
| 12192 | |||
| 12193 | Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist); | ||
| 12194 | Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist); | ||
| 12195 | int left_fringe_width, right_fringe_width; | ||
| 12196 | |||
| 12197 | if (!NILP (left_fringe)) | ||
| 12198 | left_fringe = Fcdr (left_fringe); | ||
| 12199 | if (!NILP (right_fringe)) | ||
| 12200 | right_fringe = Fcdr (right_fringe); | ||
| 12201 | |||
| 12202 | left_fringe_width = ((NILP (left_fringe) || !INTEGERP (left_fringe)) ? 8 : | ||
| 12203 | XINT (left_fringe)); | ||
| 12204 | right_fringe_width = ((NILP (right_fringe) || !INTEGERP (right_fringe)) ? 8 : | ||
| 12205 | XINT (right_fringe)); | ||
| 12206 | |||
| 12207 | if (left_fringe_width || right_fringe_width) | ||
| 12208 | { | ||
| 12209 | int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width; | ||
| 12210 | int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width; | ||
| 12211 | int conf_wid = left_wid + right_wid; | ||
| 12212 | int font_wid = FONT_WIDTH (f->output_data.x->font); | ||
| 12213 | int cols = (left_wid + right_wid + font_wid-1) / font_wid; | ||
| 12214 | int real_wid = cols * font_wid; | ||
| 12215 | if (left_wid && right_wid) | ||
| 12216 | { | ||
| 12217 | if (left_fringe_width < 0) | ||
| 12218 | { | ||
| 12219 | /* Left fringe width is fixed, adjust right fringe if necessary */ | ||
| 12220 | f->output_data.x->left_fringe_width = left_wid; | ||
| 12221 | f->output_data.x->right_fringe_width = real_wid - left_wid; | ||
| 12222 | } | ||
| 12223 | else if (right_fringe_width < 0) | ||
| 12224 | { | ||
| 12225 | /* Right fringe width is fixed, adjust left fringe if necessary */ | ||
| 12226 | f->output_data.x->left_fringe_width = real_wid - right_wid; | ||
| 12227 | f->output_data.x->right_fringe_width = right_wid; | ||
| 12228 | } | ||
| 12229 | else | ||
| 12230 | { | ||
| 12231 | /* Adjust both fringes with an equal amount. | ||
| 12232 | Note that we are doing integer arithmetic here, so don't | ||
| 12233 | lose a pixel if the total width is an odd number. */ | ||
| 12234 | int fill = real_wid - conf_wid; | ||
| 12235 | f->output_data.x->left_fringe_width = left_wid + fill/2; | ||
| 12236 | f->output_data.x->right_fringe_width = right_wid + fill - fill/2; | ||
| 12237 | } | ||
| 12238 | } | ||
| 12239 | else if (left_fringe_width) | ||
| 12240 | { | ||
| 12241 | f->output_data.x->left_fringe_width = real_wid; | ||
| 12242 | f->output_data.x->right_fringe_width = 0; | ||
| 12243 | } | ||
| 12244 | else | ||
| 12245 | { | ||
| 12246 | f->output_data.x->left_fringe_width = 0; | ||
| 12247 | f->output_data.x->right_fringe_width = real_wid; | ||
| 12248 | } | ||
| 12249 | f->output_data.x->fringe_cols = cols; | ||
| 12250 | f->output_data.x->fringes_extra = real_wid; | ||
| 12251 | } | ||
| 12252 | else | ||
| 12253 | { | ||
| 12254 | f->output_data.x->left_fringe_width = 0; | ||
| 12255 | f->output_data.x->right_fringe_width = 0; | ||
| 12256 | f->output_data.x->fringe_cols = 0; | ||
| 12257 | f->output_data.x->fringes_extra = 0; | ||
| 12258 | } | ||
| 12259 | |||
| 12260 | if (redraw && FRAME_VISIBLE_P (f)) | ||
| 12261 | if (o_left != f->output_data.x->left_fringe_width || | ||
| 12262 | o_right != f->output_data.x->right_fringe_width || | ||
| 12263 | o_cols != f->output_data.x->fringe_cols) | ||
| 12264 | redraw_frame (f); | ||
| 12265 | } | ||
| 12180 | 12266 | ||
| 12181 | /*********************************************************************** | 12267 | /*********************************************************************** |
| 12182 | X Input Methods | 12268 | X Input Methods |
| @@ -12567,8 +12653,9 @@ x_set_window_size_1 (f, change_gravity, cols, rows) | |||
| 12567 | : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | 12653 | : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 |
| 12568 | ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f) | 12654 | ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f) |
| 12569 | : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font))); | 12655 | : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font))); |
| 12570 | f->output_data.x->fringes_extra | 12656 | |
| 12571 | = FRAME_FRINGE_WIDTH (f); | 12657 | x_compute_fringe_widths (f, 0); |
| 12658 | |||
| 12572 | pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); | 12659 | pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); |
| 12573 | pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); | 12660 | pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); |
| 12574 | 12661 | ||