From 1d800c956b2abbaefdbd01fa2d1b8ef9328f21c5 Mon Sep 17 00:00:00 2001 From: Rashil Gandhi Date: Sat, 17 Jul 2021 23:49:38 +0530 Subject: [PATCH] Listen for settings change event --- window/src/os/windows/window.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/window/src/os/windows/window.rs b/window/src/os/windows/window.rs index 4e3f22997..cd7d2b3de 100644 --- a/window/src/os/windows/window.rs +++ b/window/src/os/windows/window.rs @@ -767,10 +767,8 @@ fn read_theme() -> io::Result { theme.get_value::("AppsUseLightTheme") } -fn enable_theme(hwnd: HWND) { +fn enable_theme(hwnd: HWND) -> Option { // Check for OS app theme, and set window attributes accordingly. - // If the OS app theme changes, the wezterm window would have to be - // restarted for changes to reflect. // Note that the MS terminal app uses the logic found here for this stuff: // https://github.com/microsoft/terminal/blob/9b92986b49bed8cc41fde4d6ef080921c41e6d9e/src/interactivity/win32/windowtheme.cpp#L62 use winapi::um::dwmapi::DwmSetWindowAttribute; @@ -824,8 +822,10 @@ fn enable_theme(hwnd: HWND) { cbData: std::mem::size_of_val(&enabled) as _, }, ); - } + }; } + + None } unsafe fn wm_enter_exit_size_move( @@ -1914,6 +1914,7 @@ unsafe fn do_wnd_proc(hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM) -> crate::spawn::SPAWN_QUEUE.run(); None } + WM_SETTINGCHANGE => enable_theme(hwnd), WM_IME_COMPOSITION => ime_composition(hwnd, msg, wparam, lparam), WM_MOUSEMOVE => mouse_move(hwnd, msg, wparam, lparam), WM_MOUSEHWHEEL | WM_MOUSEWHEEL => mouse_wheel(hwnd, msg, wparam, lparam),