xW: handle WM_SYSCOLORCHANGE

This commit is contained in:
Přemysl Eric Janouch 2023-07-26 14:57:35 +02:00
parent 81bc578773
commit 5a412ab6e2
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -499,7 +499,7 @@ convert_item_formatting(Relay::ItemData *item, CHARFORMAT2 &cf, bool &inverse)
}
static std::vector<BufferLineItem>
convert_items(std::vector<std::unique_ptr<Relay::ItemData>> &items)
convert_items(const std::vector<std::unique_ptr<Relay::ItemData>> &items)
{
CHARFORMAT2 cf = default_charformat();
std::vector<BufferLineItem> result;
@ -1627,6 +1627,21 @@ window_proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (auto b = buffer_by_name(g.buffer_current))
refresh_buffer(*b);
return 0;
case WM_SYSCOLORCHANGE:
// The topic would flicker with WS_EX_TRANSPARENT.
// The buffer only changed its text colour, not background.
SendMessage(g.hwndTopic,
EM_SETBKGNDCOLOR, 0, GetSysColor(COLOR_3DFACE));
SendMessage(g.hwndBuffer,
EM_SETBKGNDCOLOR, 1, 0);
// XXX: This is incomplete, we'd have to run convert_items() again;
// essentially only COLOR_GRAYTEXT is reloaded in here.
if (auto b = buffer_by_name(g.buffer_current))
refresh_buffer(*b);
// Pass it to all child windows, through DefWindowProc().
break;
case WM_ACTIVATE:
if (LOWORD(wParam) == WA_INACTIVE)
g.hwndLastFocused = GetFocus();