Mercurial > emacs
comparison src/xterm.c @ 41721:e0335ea68760
(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.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sat, 01 Dec 2001 01:22:27 +0000 |
parents | ef0186b9dac0 |
children | c0edacaaaea8 |
comparison
equal
deleted
inserted
replaced
41720:b4898b480ab0 | 41721:e0335ea68760 |
---|---|
170 | 170 |
171 /* Bitmap drawn to indicate lines not displaying text if | 171 /* Bitmap drawn to indicate lines not displaying text if |
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 |
181 #define left_width 8 | 189 #define left_width 8 |
182 #define left_height 8 | 190 #define left_height 8 |
460 static void x_update_cursor_in_window_tree P_ ((struct window *, int)); | 468 static void x_update_cursor_in_window_tree P_ ((struct window *, int)); |
461 static void x_update_window_cursor P_ ((struct window *, int)); | 469 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)); |
469 static int x_phys_cursor_in_rect_p P_ ((struct window *, XRectangle *)); | 477 static int x_phys_cursor_in_rect_p P_ ((struct window *, XRectangle *)); |
470 static void x_draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); | 478 static void x_draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); |
815 window W. ROW is the glyph row for which to display the bitmap; it | 823 window W. ROW is the glyph row for which to display the bitmap; it |
816 determines the vertical position at which the bitmap has to be | 824 determines the vertical position at which the bitmap has to be |
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; |
832 struct face *face; | 842 struct face *face; |
833 int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); | 843 int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); |
834 | 844 |
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; |
886 break; | |
887 | |
888 case ZV_LINE_BITMAP: | |
889 wd = zv_width; | |
890 h = zv_height - (y % zv_period); | |
891 bits = zv_bits + (y % zv_period); | |
892 break; | |
893 | |
894 default: | |
895 abort (); | |
896 } | |
897 | |
898 /* Clip bitmap if too high. */ | |
899 if (h > row->height) | |
900 h = row->height; | |
901 | |
902 /* Set dy to the offset in the row to start drawing the bitmap. */ | |
903 dy = (row->height - h) / 2; | |
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); | |
878 x = (WINDOW_TO_FRAME_PIXEL_X (w, 0) | 915 x = (WINDOW_TO_FRAME_PIXEL_X (w, 0) |
879 - wd | 916 - wd |
880 - (FRAME_X_LEFT_FRINGE_WIDTH (f) - wd) / 2); | 917 - (FRAME_X_LEFT_FRINGE_WIDTH (f) - wd) / 2); |
881 break; | 918 if (wd < FRAME_X_LEFT_FRINGE_WIDTH (f) || row->height > h) |
882 | 919 { |
883 case ZV_LINE_BITMAP: | 920 /* If W has a vertical border to its left, don't draw over it. */ |
884 wd = zv_width; | 921 int border = ((XFASTINT (w->left) > 0 |
885 h = zv_height; | 922 && !FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
886 bits = zv_bits; | 923 ? 1 : 0); |
887 x = (WINDOW_TO_FRAME_PIXEL_X (w, 0) | 924 b1 = (window_box_left (w, -1) |
888 - wd | 925 - FRAME_X_LEFT_FRINGE_WIDTH (f) |
889 - (FRAME_X_LEFT_FRINGE_WIDTH (f) - wd) / 2); | 926 + border); |
890 break; | 927 b2 = (FRAME_X_LEFT_FRINGE_WIDTH (f) - border); |
891 | 928 } |
892 default: | 929 } |
893 abort (); | 930 else |
894 } | 931 { |
895 | 932 if (wd > FRAME_X_RIGHT_FRINGE_WIDTH (f)) |
896 /* Convert to frame coordinates. Set dy to the offset in the row to | 933 wd = FRAME_X_RIGHT_FRINGE_WIDTH (f); |
897 start drawing the bitmap. */ | 934 x = (window_box_right (w, -1) |
898 y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | 935 + (FRAME_X_RIGHT_FRINGE_WIDTH (f) - wd) / 2); |
899 dy = (row->height - h) / 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; | |
900 | 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); |
907 XCopyArea (display, pixmap, window, gc, 0, 0, wd, h, x, y + dy); | 976 XCopyArea (display, pixmap, window, gc, 0, 0, wd, h, x, y + dy); |
908 XFreePixmap (display, pixmap); | 977 XFreePixmap (display, pixmap); |
918 struct window *w; | 987 struct window *w; |
919 struct glyph_row *row; | 988 struct glyph_row *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 |
928 /* If row is completely invisible, because of vscrolling, we | 995 /* If row is completely invisible, because of vscrolling, we |
929 don't have to draw anything. */ | 996 don't have to draw anything. */ |
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 | 1013 |
972 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 1014 x_draw_fringe_bitmap (w, row, bitmap, 1); |
973 face->gc, | 1015 } |
974 (left | 1016 |
975 - FRAME_X_LEFT_FRINGE_WIDTH (f) | 1017 if (FRAME_X_RIGHT_FRINGE_WIDTH (f) != 0) |
976 + border), | 1018 { |
977 WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, | 1019 /* Decide which bitmap to draw in the right fringe. */ |
978 row->y)), | 1020 if (row->truncated_on_right_p) |
979 FRAME_X_LEFT_FRINGE_WIDTH (f) - border, | 1021 bitmap = RIGHT_TRUNCATION_BITMAP; |
980 row->visible_height); | 1022 else if (row->continued_p) |
981 if (!face->stipple) | 1023 bitmap = CONTINUED_LINE_BITMAP; |
982 XSetForeground (FRAME_X_DISPLAY (f), face->gc, face->foreground); | 1024 else if (row->indicate_empty_line_p && FRAME_X_LEFT_FRINGE_WIDTH (f) == 0) |
983 } | 1025 bitmap = ZV_LINE_BITMAP; |
984 | |
985 /* Draw the left bitmap. */ | |
986 if (bitmap != NO_FRINGE_BITMAP) | |
987 x_draw_fringe_bitmap (w, row, bitmap); | |
988 | |
989 /* Decide which bitmap to draw in the right fringe. */ | |
990 if (row->truncated_on_right_p) | |
991 bitmap = RIGHT_TRUNCATION_BITMAP; | |
992 else if (row->continued_p) | |
993 bitmap = CONTINUED_LINE_BITMAP; | |
994 else | |
995 bitmap = NO_FRINGE_BITMAP; | |
996 | |
997 /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill | |
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 { | |
1003 int right = window_box_right (w, -1); | |
1004 | |
1005 if (header_line_height < 0) | |
1006 header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | |
1007 | |
1008 /* In case the same realized face is used for fringes and | |
1009 for something displayed in the text (e.g. face `region' on | |
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), | 1028 |
1017 face->gc, | 1029 x_draw_fringe_bitmap (w, row, bitmap, 0); |
1018 right, | 1030 } |
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 | |
1027 /* Draw the right bitmap. */ | |
1028 if (bitmap != NO_FRINGE_BITMAP) | |
1029 x_draw_fringe_bitmap (w, row, bitmap); | |
1030 } | 1031 } |
1031 | 1032 |
1032 | 1033 |
1033 | 1034 |
1034 /* This is called when starting Emacs and when restarting after | 1035 /* This is called when starting Emacs and when restarting after |
5062 if (row->full_width_p) | 5063 if (row->full_width_p) |
5063 { | 5064 { |
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; |
5071 area_width = XFASTINT (w->width) * CANON_X_UNIT (f); | 5071 area_width = XFASTINT (w->width) * CANON_X_UNIT (f); |
5072 last_x = window_left_x + area_width; | 5072 last_x = window_left_x + area_width; |
12097 return Qnil; | 12097 return Qnil; |
12098 | 12098 |
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 { |
12106 int wid = FONT_WIDTH (f->output_data.x->font); | 12108 int wid = FONT_WIDTH (f->output_data.x->font); |
12107 f->scroll_bar_cols = (f->scroll_bar_pixel_width + wid-1) / wid; | 12109 f->scroll_bar_cols = (f->scroll_bar_pixel_width + wid-1) / wid; |
12175 #endif | 12177 #endif |
12176 | 12178 |
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 |
12183 ***********************************************************************/ | 12269 ***********************************************************************/ |
12184 | 12270 |
12565 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) | 12651 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
12566 ? 0 | 12652 ? 0 |
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 |
12575 f->output_data.x->win_gravity = NorthWestGravity; | 12662 f->output_data.x->win_gravity = NorthWestGravity; |
12576 x_wm_set_size_hint (f, (long) 0, 0); | 12663 x_wm_set_size_hint (f, (long) 0, 0); |