windows: refine DwmExtendFrameIntoClientArea call

This commit is contained in:
Wez Furlong committed 2023-04-17 06:33:02 -07:00
1 parent 08e9be0df3
commit 163dfd7d9a
1 file changed
+16 -11
+16 -11
View File
@@ -1375,16 +1375,6 @@ fn apply_theme(hwnd: HWND) -> Option<LRESULT> {
);
};
DwmExtendFrameIntoClientArea(
hwnd,
&MARGINS {
cxLeftWidth: -1,
cxRightWidth: -1,
cyTopHeight: -1,
cyBottomHeight: -1,
},
);
if let Some(inner) = rc_from_hwnd(hwnd) {
let mut inner = inner.borrow_mut();
@@ -1397,6 +1387,21 @@ fn apply_theme(hwnd: HWND) -> Option<LRESULT> {
SystemBackdrop::Tabbed => DWM_SYSTEMBACKDROP_TYPE::DWMSBT_TABBEDWINDOW,
};
let margins = match inner.config.win32_system_backdrop {
SystemBackdrop::Auto | SystemBackdrop::Disable => 0,
SystemBackdrop::Acrylic | SystemBackdrop::Mica | SystemBackdrop::Tabbed => -1,
};
DwmExtendFrameIntoClientArea(
hwnd,
&MARGINS {
cxLeftWidth: margins,
cxRightWidth: margins,
cyTopHeight: margins,
cyBottomHeight: margins,
},
);
// Apply Acrylic or Mica Backdrop
if *IS_WIN11_22H2 {
DwmSetWindowAttribute(
@@ -2869,7 +2874,7 @@ unsafe fn do_wnd_proc(hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM) ->
crate::spawn::SPAWN_QUEUE.run();
None
}
WM_SETTINGCHANGE => apply_theme(hwnd),
WM_SETTINGCHANGE | WM_DWMCOMPOSITIONCHANGED => apply_theme(hwnd),
WM_IME_SETCONTEXT => ime_set_context(hwnd, msg, wparam, lparam),
WM_IME_COMPOSITION => ime_composition(hwnd, msg, wparam, lparam),
WM_IME_ENDCOMPOSITION => ime_end_composition(hwnd, msg, wparam, lparam),