mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-06 04:09:37 +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
1 changed files with 43 additions and 7 deletions
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 frame *f = XFRAME (WINDOW_FRAME (w));
|
||||||
struct face *face;
|
struct face *face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID);
|
||||||
NSRect r = NSMakeRect (x0, y0, x1-x0, y1-y0);
|
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");
|
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 ((y1 - y0 > x1 - x0) && (x1 - x0 >= 3))
|
||||||
if (face)
|
/* A vertical divider, at least three pixels wide: Draw first and
|
||||||
[ns_lookup_indexed_color(face->foreground, f) set];
|
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);
|
ns_unfocus (f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue