From 013a8acfd05d900bd4bc8f603009ea028d22df4a Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 24 Feb 1999 21:17:06 +0000 Subject: [PATCH] Ah. We seem to be working with the Palette Manager again. Good. [originally from svn r61] --- mac_res.r | 6 +++--- macterm.c | 13 ++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/mac_res.r b/mac_res.r index c4814bca..d20a4bc2 100644 --- a/mac_res.r +++ b/mac_res.r @@ -1,4 +1,4 @@ -/* $Id: mac_res.r,v 1.1.2.3 1999/02/24 01:29:10 ben Exp $ */ +/* $Id: mac_res.r,v 1.1.2.4 1999/02/24 21:17:05 ben Exp $ */ /* PuTTY resources */ #define PICT_RezTemplateVersion 1 @@ -312,7 +312,7 @@ resource 'DITL' (wFatal, "fatalbox", purgeable) { /* Terminal window */ -resource 'WIND' (PREF_pltt_ID, "terminal", purgeable) { +resource 'WIND' (wTerminal, "terminal", purgeable) { { 0, 0, 200, 200 }, zoomDocProc, invisible, @@ -322,7 +322,7 @@ resource 'WIND' (PREF_pltt_ID, "terminal", purgeable) { staggerParentWindowScreen }; -resource 'pltt' (wTerminal, "terminal", purgeable) { +resource 'pltt' (PREF_pltt_ID, "terminal", purgeable) { { 0x0000, 0x0000, 0x0000, pmTolerant, 0x2000, /* black */ 0x5555, 0x5555, 0x5555, pmTolerant, 0x2000, /* bright black */ diff --git a/macterm.c b/macterm.c index d4400ad7..08179aac 100644 --- a/macterm.c +++ b/macterm.c @@ -66,6 +66,8 @@ void mac_newsession(void) { cfg.try_palette = FALSE; cfg.bold_colour = TRUE; cfg.colours = GetNewPalette(PREF_pltt_ID); + if (cfg.colours == NULL) + fatalbox("Failed to get default palette"); onlysession = s; /* XXX: Own storage management? */ @@ -78,8 +80,9 @@ void mac_newsession(void) { term_size(24, 80, 100); mac_initfont(s); mac_initpalette(s); - /* Set to TRUE to get palette updates in the background. */ - SetPalette(s->window, s->palette, FALSE); + /* Set to FALSE to not get palette updates in the background. */ + SetPalette(s->window, s->palette, TRUE); + ActivatePalette(s->window); ShowWindow(s->window); inbuf_putstr("\033[1mBold\033[m \033[2mfaint\033[m \033[3mitalic\033[m \033[4mu_line\033[m " "\033[5mslow bl\033[m \033[6mfast bl\033[m \033[7minverse\033[m \033[8mconceal\033[m " @@ -115,7 +118,11 @@ static void mac_initfont(struct mac_session *s) { static void mac_initpalette(struct mac_session *s) { - s->palette = NewPalette(0, NULL, 0, 0); + if (mac_qdversion == gestaltOriginalQD) + return; + s->palette = NewPalette((*cfg.colours)->pmEntries, NULL, pmCourteous, 0); + if (s->palette == NULL) + fatalbox("Unable to create palette"); CopyPalette(cfg.colours, s->palette, 0, 0, (*cfg.colours)->pmEntries); }