aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Robert2009-01-23 14:32:47 +0000
committerAdrian Robert2009-01-23 14:32:47 +0000
commit27521ca69b159cd00f362b315f9351b72195cd5a (patch)
treec2d7ff66f99fd0777add1940c72ffe19451d80da /src
parente0d2e69ae3d9ad1931013626268a712bdb609cd8 (diff)
downloademacs-27521ca69b159cd00f362b315f9351b72195cd5a.tar.gz
emacs-27521ca69b159cd00f362b315f9351b72195cd5a.zip
* nsterm.m (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change of 2008-11-15 to other terms. (Bug#615)
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/nsterm.m122
2 files changed, 75 insertions, 50 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index fb7ff70f29b..9b934db7fc2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -13,6 +13,9 @@
13 (EmacsView-readSelectionFromPasteboard:) 13 (EmacsView-readSelectionFromPasteboard:)
14 (writeSelectionToPasteboard:types:): New stubbed-out methods for 14 (writeSelectionToPasteboard:types:): New stubbed-out methods for
15 NSServicesRequests protocol. (Bug#1435) 15 NSServicesRequests protocol. (Bug#1435)
16 (ns_dumpglyphs_stretch): New function.
17 (ns_draw_glyph_string): Use it, parallel Yamamoto Mitsuharu change
18 of 2008-11-15 to other terms. (Bug#615)
16 19
17 * nsimage.m (setPixmapData:): Set to ignore image DPI. 20 * nsimage.m (setPixmapData:): Set to ignore image DPI.
18 21
diff --git a/src/nsterm.m b/src/nsterm.m
index 535b7b0dc5c..46bb50a91b6 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2884,10 +2884,66 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
2884 r.size.width = s->slice.width + 2*th-1; 2884 r.size.width = s->slice.width + 2*th-1;
2885 r.size.height = s->slice.height + 2*th-1; 2885 r.size.height = s->slice.height + 2*th-1;
2886 ns_draw_relief (r, th, raised_p, 2886 ns_draw_relief (r, th, raised_p,
2887 s->slice.y == 0, 2887 s->slice.y == 0,
2888 s->slice.y + s->slice.height == s->img->height, 2888 s->slice.y + s->slice.height == s->img->height,
2889 s->slice.x == 0, 2889 s->slice.x == 0,
2890 s->slice.x + s->slice.width == s->img->width, s); 2890 s->slice.x + s->slice.width == s->img->width, s);
2891 }
2892}
2893
2894
2895static void
2896ns_dumpglyphs_stretch (struct glyph_string *s)
2897{
2898 NSRect r[2];
2899 int n, i;
2900
2901 if (!s->background_filled_p)
2902 {
2903 n = ns_get_glyph_string_clip_rect (s, r);
2904 *r = NSMakeRect (s->x, s->y, s->background_width, s->height);
2905
2906 for (i=0; i<n; i++)
2907 {
2908 if (!s->row->full_width_p)
2909 {
2910 /* truncate to avoid overwriting fringe and/or scrollbar */
2911 int overrun = max (0, (s->x + s->background_width)
2912 - (WINDOW_BOX_RIGHT_EDGE_X (s->w)
2913 - WINDOW_RIGHT_FRINGE_WIDTH (s->w)));
2914 r[i].size.width -= overrun;
2915
2916 /* XXX: Try to work between problem where a stretch glyph on
2917 a partially-visible bottom row will clear part of the
2918 modeline, and another where list-buffers headers and similar
2919 rows erroneously have visible_height set to 0. Not sure
2920 where this is coming from as other terms seem not to show. */
2921 r[i].size.height = min (s->height, s->row->visible_height);
2922 }
2923
2924 /* expand full-width rows over internal borders */
2925 else
2926 {
2927 r[i] = ns_fix_rect_ibw (r[i], FRAME_INTERNAL_BORDER_WIDTH (s->f),
2928 FRAME_PIXEL_WIDTH (s->f));
2929 }
2930
2931 /* NOTE: under NS this is NOT used to draw cursors, but we must avoid
2932 overwriting cursor (usually when cursor on a tab) */
2933 if (s->hl == DRAW_CURSOR)
2934 {
2935 r[i].origin.x += s->width;
2936 r[i].size.width -= s->width;
2937 }
2938 }
2939
2940 ns_focus (s->f, r, n);
2941 [ns_lookup_indexed_color (NS_FACE_BACKGROUND
2942 (FACE_FROM_ID (s->f, s->first_glyph->face_id)), s->f) set];
2943 NSRectFill (r[0]);
2944 NSRectFill (r[1]);
2945 ns_unfocus (s->f);
2946 s->background_filled_p = 1;
2891 } 2947 }
2892} 2948}
2893 2949
@@ -2915,10 +2971,17 @@ ns_draw_glyph_string (struct glyph_string *s)
2915 width += next->width, next = next->next) 2971 width += next->width, next = next->next)
2916 if (next->first_glyph->type != IMAGE_GLYPH) 2972 if (next->first_glyph->type != IMAGE_GLYPH)
2917 { 2973 {
2918 n = ns_get_glyph_string_clip_rect (s->next, r); 2974 if (next->first_glyph->type != STRETCH_GLYPH)
2919 ns_focus (s->f, r, n); 2975 {
2920 ns_maybe_dumpglyphs_background (s->next, 1); 2976 n = ns_get_glyph_string_clip_rect (s->next, r);
2921 ns_unfocus (s->f); 2977 ns_focus (s->f, r, n);
2978 ns_maybe_dumpglyphs_background (s->next, 1);
2979 ns_unfocus (s->f);
2980 }
2981 else
2982 {
2983 ns_dumpglyphs_stretch (s->next);
2984 }
2922 next->num_clips = 0; 2985 next->num_clips = 0;
2923 } 2986 }
2924 } 2987 }
@@ -2946,48 +3009,7 @@ ns_draw_glyph_string (struct glyph_string *s)
2946 break; 3009 break;
2947 3010
2948 case STRETCH_GLYPH: 3011 case STRETCH_GLYPH:
2949 if (!s->background_filled_p) 3012 ns_dumpglyphs_stretch (s);
2950 {
2951 *r = NSMakeRect (s->x, s->y, s->background_width, s->height);
2952
2953 if (!s->row->full_width_p)
2954 {
2955 /* truncate to avoid overwriting fringe and/or scrollbar */
2956 int overrun = max (0, (s->x + s->background_width)
2957 - (WINDOW_BOX_RIGHT_EDGE_X (s->w)
2958 - WINDOW_RIGHT_FRINGE_WIDTH (s->w)));
2959 r[0].size.width -= overrun;
2960
2961 /* XXX: Try to work between problem where a stretch glyph on
2962 a partially-visible bottom row will clear part of the
2963 modeline, and another where list-buffers headers and similar
2964 rows erroneously have visible_height set to 0. Not sure
2965 where this is coming from as other terms seem not to show. */
2966 r[0].size.height = min (s->height, s->row->visible_height);
2967 }
2968
2969 /* expand full-width rows over internal borders */
2970 else
2971 {
2972 r[0] = ns_fix_rect_ibw (r[0], FRAME_INTERNAL_BORDER_WIDTH (s->f),
2973 FRAME_PIXEL_WIDTH (s->f));
2974 }
2975
2976 /* NOTE: under NS this is NOT used to draw cursors, but we must avoid
2977 overwriting cursor (usually when cursor on a tab) */
2978 if (s->hl == DRAW_CURSOR)
2979 {
2980 r[0].origin.x += s->width;
2981 r[0].size.width -= s->width;
2982 }
2983
2984 ns_focus (s->f, r, 1);
2985 [ns_lookup_indexed_color (NS_FACE_BACKGROUND
2986 (FACE_FROM_ID (s->f, s->first_glyph->face_id)), s->f) set];
2987 NSRectFill (r[0]);
2988 ns_unfocus (s->f);
2989 s->background_filled_p = 1;
2990 }
2991 break; 3013 break;
2992 3014
2993 case CHAR_GLYPH: 3015 case CHAR_GLYPH: