aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Third2020-09-23 13:57:50 +0100
committerAlan Third2020-09-25 17:18:59 +0100
commitc4c5db3de70b55f8bc03c9fee35e29d60f41f16e (patch)
treee9c55345bf6209718d03ec6c5711e35ec676c17c /src
parent497a1ed8bba528bf4078c80bb00b29870eb01e6f (diff)
downloademacs-c4c5db3de70b55f8bc03c9fee35e29d60f41f16e.tar.gz
emacs-c4c5db3de70b55f8bc03c9fee35e29d60f41f16e.zip
Implement internal border colors on NS (bug#41071)
* src/nsterm.m (ns_clear_under_internal_border): New function. (ns_after_update_window_line): Use the correct background color. (ns_redisplay_interface): Add ns_clear_under_internal_border.
Diffstat (limited to 'src')
-rw-r--r--src/nsterm.m64
1 files changed, 59 insertions, 5 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index 5e5d09f058b..4b1cf65964c 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3053,6 +3053,40 @@ ns_scroll_run (struct window *w, struct run *run)
3053 3053
3054 3054
3055static void 3055static void
3056ns_clear_under_internal_border (struct frame *f)
3057{
3058 NSTRACE ("ns_clear_under_internal_border");
3059
3060 if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0)
3061 {
3062 int border_width = FRAME_INTERNAL_BORDER_WIDTH (f);
3063 NSView *view = FRAME_NS_VIEW (f);
3064 NSRect edge_rect, frame_rect = [view bounds];
3065 NSRectEdge edge[] = {NSMinXEdge, NSMinYEdge, NSMaxXEdge, NSMaxYEdge};
3066
3067 int face_id =
3068 !NILP (Vface_remapping_alist)
3069 ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
3070 : INTERNAL_BORDER_FACE_ID;
3071 struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
3072
3073 if (!face)
3074 face = FRAME_DEFAULT_FACE (f);
3075
3076 ns_focus (f, &frame_rect, 1);
3077 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
3078 for (int i = 0; i < 4 ; i++)
3079 {
3080 NSDivideRect (frame_rect, &edge_rect, &frame_rect, border_width, edge[i]);
3081
3082 NSRectFill (edge_rect);
3083 }
3084 ns_unfocus (f);
3085 }
3086}
3087
3088
3089static void
3056ns_after_update_window_line (struct window *w, struct glyph_row *desired_row) 3090ns_after_update_window_line (struct window *w, struct glyph_row *desired_row)
3057/* -------------------------------------------------------------------------- 3091/* --------------------------------------------------------------------------
3058 External (RIF): preparatory to fringe update after text was updated 3092 External (RIF): preparatory to fringe update after text was updated
@@ -3080,12 +3114,32 @@ ns_after_update_window_line (struct window *w, struct glyph_row *desired_row)
3080 height > 0)) 3114 height > 0))
3081 { 3115 {
3082 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); 3116 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
3117 int face_id =
3118 !NILP (Vface_remapping_alist)
3119 ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
3120 : INTERNAL_BORDER_FACE_ID;
3121 struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
3083 3122
3084 block_input (); 3123 block_input ();
3085 ns_clear_frame_area (f, 0, y, width, height); 3124 if (face)
3086 ns_clear_frame_area (f, 3125 {
3087 FRAME_PIXEL_WIDTH (f) - width, 3126 NSRect r = NSMakeRect (0, y, FRAME_PIXEL_WIDTH (f), height);
3088 y, width, height); 3127 ns_focus (f, &r, 1);
3128
3129 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
3130 NSRectFill (NSMakeRect (0, y, width, height));
3131 NSRectFill (NSMakeRect (FRAME_PIXEL_WIDTH (f) - width,
3132 y, width, height));
3133
3134 ns_unfocus (f);
3135 }
3136 else
3137 {
3138 ns_clear_frame_area (f, 0, y, width, height);
3139 ns_clear_frame_area (f,
3140 FRAME_PIXEL_WIDTH (f) - width,
3141 y, width, height);
3142 }
3089 unblock_input (); 3143 unblock_input ();
3090 } 3144 }
3091} 3145}
@@ -5301,7 +5355,7 @@ static struct redisplay_interface ns_redisplay_interface =
5301 ns_draw_glyph_string, 5355 ns_draw_glyph_string,
5302 ns_define_frame_cursor, 5356 ns_define_frame_cursor,
5303 ns_clear_frame_area, 5357 ns_clear_frame_area,
5304 0, /* clear_under_internal_border */ 5358 ns_clear_under_internal_border, /* clear_under_internal_border */
5305 ns_draw_window_cursor, 5359 ns_draw_window_cursor,
5306 ns_draw_vertical_window_border, 5360 ns_draw_vertical_window_border,
5307 ns_draw_window_divider, 5361 ns_draw_window_divider,