From 5a412ab6e2276302418f2535c2128ad9846d3543 Mon Sep 17 00:00:00 2001
From: Přemysl Eric Janouch
Date: Wed, 26 Jul 2023 14:57:35 +0200
Subject: xW: handle WM_SYSCOLORCHANGE
---
xW/xW.cpp | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
(limited to 'xW')
diff --git a/xW/xW.cpp b/xW/xW.cpp
index d3de8a6..e4733a2 100644
--- a/xW/xW.cpp
+++ b/xW/xW.cpp
@@ -499,7 +499,7 @@ convert_item_formatting(Relay::ItemData *item, CHARFORMAT2 &cf, bool &inverse)
}
static std::vector
-convert_items(std::vector> &items)
+convert_items(const std::vector> &items)
{
CHARFORMAT2 cf = default_charformat();
std::vector 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();
--
cgit v1.2.3-70-g09d2