mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-26 07:33:47 +00:00
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.
This commit is contained in:
parent
eb335c97b2
commit
6c312605bf
50
src/nsterm.m
50
src/nsterm.m
@ -3174,18 +3174,54 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
|
||||
-------------------------------------------------------------------------- */
|
||||
{
|
||||
struct frame *f = XFRAME (WINDOW_FRAME (w));
|
||||
struct face *face;
|
||||
NSRect r = NSMakeRect (x0, y0, x1-x0, y1-y0);
|
||||
struct face *face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID);
|
||||
struct face *face_first
|
||||
= FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID);
|
||||
struct face *face_last
|
||||
= FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID);
|
||||
unsigned long color = face ? face->foreground : FRAME_FOREGROUND_PIXEL (f);
|
||||
unsigned long color_first = (face_first
|
||||
? face_first->foreground
|
||||
: FRAME_FOREGROUND_PIXEL (f));
|
||||
unsigned long color_last = (face_last
|
||||
? face_last->foreground
|
||||
: FRAME_FOREGROUND_PIXEL (f));
|
||||
NSRect divider = NSMakeRect (x0, y0, x1-x0, y1-y0);
|
||||
|
||||
NSTRACE ("ns_draw_window_divider");
|
||||
|
||||
face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID);
|
||||
ns_focus (f, ÷r, 1);
|
||||
|
||||
ns_focus (f, &r, 1);
|
||||
if (face)
|
||||
[ns_lookup_indexed_color(face->foreground, f) set];
|
||||
if ((y1 - y0 > x1 - x0) && (x1 - x0 >= 3))
|
||||
/* A vertical divider, at least three pixels wide: Draw first and
|
||||
last pixels differently. */
|
||||
{
|
||||
[ns_lookup_indexed_color(color_first, f) set];
|
||||
NSRectFill(NSMakeRect (x0, y0, 1, y1 - y0));
|
||||
[ns_lookup_indexed_color(color, f) set];
|
||||
NSRectFill(NSMakeRect (x0 + 1, y0, x1 - x0 - 2, y1 - y0));
|
||||
[ns_lookup_indexed_color(color_last, f) set];
|
||||
NSRectFill(NSMakeRect (x1 - 1, y0, 1, y1 - y0));
|
||||
}
|
||||
else if ((x1 - x0 > y1 - y0) && (y1 - y0 >= 3))
|
||||
/* A horizontal divider, at least three pixels high: Draw first and
|
||||
last pixels differently. */
|
||||
{
|
||||
[ns_lookup_indexed_color(color_first, f) set];
|
||||
NSRectFill(NSMakeRect (x0, y0, x1 - x0, 1));
|
||||
[ns_lookup_indexed_color(color, f) set];
|
||||
NSRectFill(NSMakeRect (x0, y0 + 1, x1 - x0, y1 - y0 - 2));
|
||||
[ns_lookup_indexed_color(color_last, f) set];
|
||||
NSRectFill(NSMakeRect (x0, y1 - 1, x1 - x0, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* In any other case do not draw the first and last pixels
|
||||
differently. */
|
||||
[ns_lookup_indexed_color(color, f) set];
|
||||
NSRectFill(divider);
|
||||
}
|
||||
|
||||
NSRectFill(r);
|
||||
ns_unfocus (f);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user