diff options
| author | Alan Third | 2017-11-19 11:45:55 +0000 |
|---|---|---|
| committer | Alan Third | 2017-11-20 20:38:05 +0000 |
| commit | 6c312605bf6d89ae90df8e45121776226bf3550b (patch) | |
| tree | 8a8e0b76fe7110e765bb41ad2c2c5cee9b0c74f1 /src | |
| parent | eb335c97b23fb845de358d3392f03e5faa2b51b5 (diff) | |
| download | emacs-6c312605bf6d89ae90df8e45121776226bf3550b.tar.gz emacs-6c312605bf6d89ae90df8e45121776226bf3550b.zip | |
Add window divider faces to NS (bug#29353)
* src/nsterm.m (ns_draw_window_divider): Use
window-divider-first-pixel and window-divider-last-pixel faces.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsterm.m | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index 5c29f039e51..cf32a5e8015 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -3174,18 +3174,54 @@ ns_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) | |||
| 3174 | -------------------------------------------------------------------------- */ | 3174 | -------------------------------------------------------------------------- */ |
| 3175 | { | 3175 | { |
| 3176 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 3176 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 3177 | struct face *face; | 3177 | struct face *face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID); |
| 3178 | NSRect r = NSMakeRect (x0, y0, x1-x0, y1-y0); | 3178 | struct face *face_first |
| 3179 | = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID); | ||
| 3180 | struct face *face_last | ||
| 3181 | = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID); | ||
| 3182 | unsigned long color = face ? face->foreground : FRAME_FOREGROUND_PIXEL (f); | ||
| 3183 | unsigned long color_first = (face_first | ||
| 3184 | ? face_first->foreground | ||
| 3185 | : FRAME_FOREGROUND_PIXEL (f)); | ||
| 3186 | unsigned long color_last = (face_last | ||
| 3187 | ? face_last->foreground | ||
| 3188 | : FRAME_FOREGROUND_PIXEL (f)); | ||
| 3189 | NSRect divider = NSMakeRect (x0, y0, x1-x0, y1-y0); | ||
| 3179 | 3190 | ||
| 3180 | NSTRACE ("ns_draw_window_divider"); | 3191 | NSTRACE ("ns_draw_window_divider"); |
| 3181 | 3192 | ||
| 3182 | face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID); | 3193 | ns_focus (f, ÷r, 1); |
| 3183 | 3194 | ||
| 3184 | ns_focus (f, &r, 1); | 3195 | if ((y1 - y0 > x1 - x0) && (x1 - x0 >= 3)) |
| 3185 | if (face) | 3196 | /* A vertical divider, at least three pixels wide: Draw first and |
| 3186 | [ns_lookup_indexed_color(face->foreground, f) set]; | 3197 | last pixels differently. */ |
| 3198 | { | ||
| 3199 | [ns_lookup_indexed_color(color_first, f) set]; | ||
| 3200 | NSRectFill(NSMakeRect (x0, y0, 1, y1 - y0)); | ||
| 3201 | [ns_lookup_indexed_color(color, f) set]; | ||
| 3202 | NSRectFill(NSMakeRect (x0 + 1, y0, x1 - x0 - 2, y1 - y0)); | ||
| 3203 | [ns_lookup_indexed_color(color_last, f) set]; | ||
| 3204 | NSRectFill(NSMakeRect (x1 - 1, y0, 1, y1 - y0)); | ||
| 3205 | } | ||
| 3206 | else if ((x1 - x0 > y1 - y0) && (y1 - y0 >= 3)) | ||
| 3207 | /* A horizontal divider, at least three pixels high: Draw first and | ||
| 3208 | last pixels differently. */ | ||
| 3209 | { | ||
| 3210 | [ns_lookup_indexed_color(color_first, f) set]; | ||
| 3211 | NSRectFill(NSMakeRect (x0, y0, x1 - x0, 1)); | ||
| 3212 | [ns_lookup_indexed_color(color, f) set]; | ||
| 3213 | NSRectFill(NSMakeRect (x0, y0 + 1, x1 - x0, y1 - y0 - 2)); | ||
| 3214 | [ns_lookup_indexed_color(color_last, f) set]; | ||
| 3215 | NSRectFill(NSMakeRect (x0, y1 - 1, x1 - x0, 1)); | ||
| 3216 | } | ||
| 3217 | else | ||
| 3218 | { | ||
| 3219 | /* In any other case do not draw the first and last pixels | ||
| 3220 | differently. */ | ||
| 3221 | [ns_lookup_indexed_color(color, f) set]; | ||
| 3222 | NSRectFill(divider); | ||
| 3223 | } | ||
| 3187 | 3224 | ||
| 3188 | NSRectFill(r); | ||
| 3189 | ns_unfocus (f); | 3225 | ns_unfocus (f); |
| 3190 | } | 3226 | } |
| 3191 | 3227 | ||