1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Implement `default-colours' on Windows based loosely on Michael Wardle's patch.

[originally from svn r3444]
This commit is contained in:
Jacob Nevins
2003-09-03 20:14:38 +00:00
parent dbe68abfff
commit 95d5a91c24
6 changed files with 54 additions and 1 deletions

View File

@ -75,6 +75,7 @@ static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
unsigned char *output);
static void cfgtopalette(void);
static void systopalette(void);
static void init_palette(void);
static void init_fonts(int, int);
static void another_font(int);
@ -1015,6 +1016,38 @@ static void cfgtopalette(void)
defpal[i].rgbtGreen = cfg.colours[w][1];
defpal[i].rgbtBlue = cfg.colours[w][2];
}
/* Override with system colours if appropriate */
if (cfg.system_colour)
systopalette();
}
/*
* Override bit of defpal with colours from the system.
* (NB that this takes a copy the system colours at the time this is called,
* so subsequent colour scheme changes don't take effect. To fix that we'd
* probably want to be using GetSysColorBrush() and the like.)
*/
static void systopalette(void)
{
int i;
static const struct { int nIndex; int norm; int bold; } or[] =
{
{ COLOR_WINDOWTEXT, 16, 17 }, /* Default Foreground */
{ COLOR_WINDOW, 18, 19 }, /* Default Background */
{ COLOR_HIGHLIGHTTEXT, 20, 21 }, /* Cursor Text */
{ COLOR_HIGHLIGHT, 22, 23 }, /* Cursor Colour */
};
for (i = 0; i < (sizeof(or)/sizeof(or[0])); i++) {
COLORREF colour = GetSysColor(or[i].nIndex);
defpal[or[i].norm].rgbtRed =
defpal[or[i].bold].rgbtRed = GetRValue(colour);
defpal[or[i].norm].rgbtGreen =
defpal[or[i].bold].rgbtGreen = GetGValue(colour);
defpal[or[i].norm].rgbtBlue =
defpal[or[i].bold].rgbtBlue = GetBValue(colour);
}
}
/*