From 1adf211d70e162b50b18ede5a9c6ba6ae73ac8b2 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 5 Oct 2017 20:30:09 +0100 Subject: [PATCH] Disable true colour on monochrome or paletted displays. I'm not sure if any X11 monochrome visuals or Windows paletted display modes are still around, but just in case they are, we shouldn't attempt true colour on either kind of display. --- unix/gtkwin.c | 3 +++ windows/window.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/unix/gtkwin.c b/unix/gtkwin.c index f49f92af..94ba4069 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -3255,6 +3255,9 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len, } else ncombining = 1; + if (monochrome) + truecolour.fg = truecolour.bg = optionalrgb_none; + nfg = ((monochrome ? ATTR_DEFFG : (attr & ATTR_FGMASK)) >> ATTR_FGSHIFT); nbg = ((monochrome ? ATTR_DEFBG : (attr & ATTR_BGMASK)) >> ATTR_BGSHIFT); if (!!(attr & ATTR_REVERSE) ^ (monochrome && (attr & TATTR_ACTCURS))) { diff --git a/windows/window.c b/windows/window.c index 452eb771..79738ff9 100644 --- a/windows/window.c +++ b/windows/window.c @@ -3522,12 +3522,12 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len, if (nbg < 16) nbg |= 8; else if (nbg >= 256) nbg |= 1; } - if (truecolour.fg.enabled) + if (!pal && truecolour.fg.enabled) fg = RGB(truecolour.fg.r, truecolour.fg.g, truecolour.fg.b); else fg = colours[nfg]; - if (truecolour.bg.enabled) + if (!pal && truecolour.bg.enabled) bg = RGB(truecolour.bg.r, truecolour.bg.g, truecolour.bg.b); else bg = colours[nbg];