From 31cfe76b67f37df3300f839c1e2193530e782a1d Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 30 Nov 2019 15:05:48 -0500 Subject: [PATCH] build with TEXTCOLOR undef'd turned up a couple of things Also, one more has_color in obsolete sys/mac folder. Adjusted code. --- sys/mac/mttymain.c | 30 ++++++++++++++++++++++++++++++ sys/winnt/nttty.c | 2 -- win/tty/wintty.c | 2 +- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/sys/mac/mttymain.c b/sys/mac/mttymain.c index 5231e84da..2cd59a9d2 100644 --- a/sys/mac/mttymain.c +++ b/sys/mac/mttymain.c @@ -269,6 +269,33 @@ _mt_init_stuff(void) clear_tty(_mt_window); InitMenuRes(); + + { + /* update the window proc has_color table */ + int i, setting = 0; + Rect r; +// Point p = {0, 0}; + GDHandle gh = (GDHandle) 0; + + if (_mt_in_color) { + GetWindowBounds(_mt_window, kWindowContentRgn, &r); +// SetPortWindowPort(_mt_window); +// LocalToGlobal (&p); +// OffsetRect (&r, p.h, p.v); + gh = GetMaxDevice(&r); + /* > 4 bpp */ + setting = ((*((*gh)->gdPMap))->pixelSize > 4) ? 1 : 0; + } + + for (i = 0; i < CLR_MAX ; ++i) { + tty_procs.has_color[i] = + (i == CLR_BLACK || i == NO_COLOR || i == CLR_WHITE) + ? 1 + : (_mt_in_color && gh) + ? setting + : 0; + } + } } int @@ -302,6 +329,8 @@ getreturn(char *str) (void) tgetch(); } +#if 0 /* this function is commented out */ +/* the tty has_color[] table is filled in during init above */ int has_color(int color) { @@ -327,6 +356,7 @@ has_color(int color) return (*((*gh)->gdPMap))->pixelSize > 4; /* > 4 bpp */ } +#endif void tty_delay_output(void) diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index 8a52fb683..88aea5aad 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -715,7 +715,6 @@ tty_delay_output() } } -#ifdef TEXTCOLOR /* * CLR_BLACK 0 * CLR_RED 1 @@ -788,7 +787,6 @@ init_ttycolor() #endif init_ttycolor_completed = TRUE; } -#endif /* TEXTCOLOR */ #if 0 int diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 475767ec4..bcd039a71 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -4311,7 +4311,7 @@ unsigned long *bmarray; the condition where this gets used always has the same value */ #define condcolor(bm,bmarray) NO_COLOR #define term_start_color(color) /*empty*/ -#define term_end_color(color) /*empty*/ +#define term_end_color() /*empty*/ #endif /* TEXTCOLOR */ STATIC_OVL int -- 2.40.0