summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-07-26 14:57:35 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-07-26 16:07:20 +0200
commit5a412ab6e2276302418f2535c2128ad9846d3543 (patch)
tree54a9554ef67192925ababf992e4f8e6107867b14
parent81bc5787738476aa4ea9d51954374af3a3ceae0b (diff)
downloadxK-5a412ab6e2276302418f2535c2128ad9846d3543.tar.gz
xK-5a412ab6e2276302418f2535c2128ad9846d3543.tar.xz
xK-5a412ab6e2276302418f2535c2128ad9846d3543.zip
xW: handle WM_SYSCOLORCHANGE
-rw-r--r--xW/xW.cpp17
1 files changed, 16 insertions, 1 deletions
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<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();