diff --git a/src/platform_impl/windows/window.rs b/src/platform_impl/windows/window.rs index 54389b39..cc04b8f7 100644 --- a/src/platform_impl/windows/window.rs +++ b/src/platform_impl/windows/window.rs @@ -25,6 +25,7 @@ use winapi::{ ole2, oleidl::LPDROPTARGET, shobjidl_core::{CLSID_TaskbarList, ITaskbarList2}, + wingdi::{CreateRectRgn, DeleteObject}, winnt::LPCWSTR, winuser, }, @@ -753,20 +754,18 @@ unsafe fn init( // making the window transparent if attributes.transparent && !pl_attribs.no_redirection_bitmap { + // Empty region for the blur effect, so the window is fully transparent + let region = CreateRectRgn(0, 0, -1, -1); + let bb = dwmapi::DWM_BLURBEHIND { - dwFlags: dwmapi::DWM_BB_ENABLE, + dwFlags: dwmapi::DWM_BB_ENABLE | dwmapi::DWM_BB_BLURREGION, fEnable: 1, - hRgnBlur: ptr::null_mut(), + hRgnBlur: region, fTransitionOnMaximized: 0, }; dwmapi::DwmEnableBlurBehindWindow(real_window.0, &bb); - - if attributes.decorations { - let opacity = 255; - - winuser::SetLayeredWindowAttributes(real_window.0, 0, opacity, winuser::LWA_ALPHA); - } + DeleteObject(region as _); } // If the system theme is dark, we need to set the window theme now diff --git a/src/platform_impl/windows/window_state.rs b/src/platform_impl/windows/window_state.rs index 6a6f0255..9ef55232 100644 --- a/src/platform_impl/windows/window_state.rs +++ b/src/platform_impl/windows/window_state.rs @@ -210,9 +210,6 @@ impl WindowFlags { if self.contains(WindowFlags::NO_BACK_BUFFER) { style_ex |= WS_EX_NOREDIRECTIONBITMAP; } - if self.contains(WindowFlags::TRANSPARENT) && self.contains(WindowFlags::DECORATIONS) { - style_ex |= WS_EX_LAYERED; - } if self.contains(WindowFlags::CHILD) { style |= WS_CHILD; // This is incompatible with WS_POPUP if that gets added eventually. }