1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-26 14:54:16 +03:00

windows: more consistently enable/disable backdrop on older windows

When the user edits their config, this should stand a better chance
of the desired effect being enabled and not requiring a restart.

refs: #3528
This commit is contained in:
Wez Furlong 2023-04-16 11:09:18 -07:00
parent eef5ffb0ce
commit c4145a464b
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

View File

@ -1394,13 +1394,21 @@ fn apply_theme(hwnd: HWND) -> Option<LRESULT> {
&pv_attribute as *const _ as _, &pv_attribute as *const _ as _,
std::mem::size_of_val(&pv_attribute) as u32, std::mem::size_of_val(&pv_attribute) as u32,
); );
} else if inner.config.win32_system_backdrop == SystemBackdrop::Acrylic { } else {
let mut colour = inner.config.win32_acrylic_accent_color.to_srgb_u8(); let mut colour = inner.config.win32_acrylic_accent_color.to_srgb_u8();
colour.3 = if colour.3 == 0 { 1 } else { colour.3 }; // acrylic doesn't like to have 0 alpha colour.3 = if colour.3 == 0 { 1 } else { colour.3 }; // acrylic doesn't like to have 0 alpha
let mut policy = ACCENT_POLICY { let mut policy = ACCENT_POLICY {
AccentState: ACCENT_STATE::ACCENT_ENABLE_ACRYLICBLURBEHIND as _, AccentState: if inner.config.win32_system_backdrop == SystemBackdrop::Acrylic {
AccentFlags: 2, ACCENT_STATE::ACCENT_ENABLE_ACRYLICBLURBEHIND as _
} else {
ACCENT_STATE::ACCENT_DISABLED as _
},
AccentFlags: if inner.config.win32_system_backdrop == SystemBackdrop::Acrylic {
2
} else {
0
},
GradientColour: (colour.0 as u32) GradientColour: (colour.0 as u32)
| (colour.1 as u32) << 8 | (colour.1 as u32) << 8
| (colour.2 as u32) << 16 | (colour.2 as u32) << 16
@ -1417,10 +1425,10 @@ fn apply_theme(hwnd: HWND) -> Option<LRESULT> {
cbData: std::mem::size_of_val(&policy) as _, cbData: std::mem::size_of_val(&policy) as _,
}, },
); );
}; }
} else if !*IS_WIN10 && !*IS_WIN11_22H2 {
// For build versions less than 22h2 but are if !*IS_WIN10 && !*IS_WIN11_22H2 {
// still win11 // For build versions less than 22h2 but are still win11
let mica_enabled: u32 = let mica_enabled: u32 =
if inner.config.win32_system_backdrop == SystemBackdrop::Mica { if inner.config.win32_system_backdrop == SystemBackdrop::Mica {
1 1
@ -1434,6 +1442,7 @@ fn apply_theme(hwnd: HWND) -> Option<LRESULT> {
std::mem::size_of_val(&mica_enabled) as u32, std::mem::size_of_val(&mica_enabled) as u32,
); );
} }
}
if appearance != inner.appearance { if appearance != inner.appearance {
inner.appearance = appearance; inner.appearance = appearance;