mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 21:31:29 +11:00
windows feature WS_EX_NOREDIRECTIONBITMAP (#575)
* set WS_EX_NOREDIRECTIONBITMAP * add CHANGELOG.md * more flexibility. * Skip DwmEnableBlurBehindWindow if no_redirection_bitmap is enabled.
This commit is contained in:
parent
8f394f117b
commit
047c67baf3
|
@ -1,5 +1,6 @@
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- Windows additionally has `WindowBuilderExt::with_no_redirection_bitmap`.
|
||||||
- **Breaking:** Removed `VirtualKeyCode::LMenu` and `VirtualKeyCode::RMenu`; Windows now generates `VirtualKeyCode::LAlt` and `VirtualKeyCode::RAlt` instead.
|
- **Breaking:** Removed `VirtualKeyCode::LMenu` and `VirtualKeyCode::RMenu`; Windows now generates `VirtualKeyCode::LAlt` and `VirtualKeyCode::RAlt` instead.
|
||||||
- On X11, exiting fullscreen no longer leaves the window in the monitor's top left corner.
|
- On X11, exiting fullscreen no longer leaves the window in the monitor's top left corner.
|
||||||
- **Breaking:** `Window::hidpi_factor` has been renamed to `Window::get_hidpi_factor` for better consistency. `WindowEvent::HiDPIFactorChanged` has been renamed to `WindowEvent::HiDpiFactorChanged`. DPI factors are always represented as `f64` instead of `f32` now.
|
- **Breaking:** `Window::hidpi_factor` has been renamed to `Window::get_hidpi_factor` for better consistency. `WindowEvent::HiDPIFactorChanged` has been renamed to `WindowEvent::HiDpiFactorChanged`. DPI factors are always represented as `f64` instead of `f32` now.
|
||||||
|
|
|
@ -55,6 +55,9 @@ pub trait WindowBuilderExt {
|
||||||
|
|
||||||
/// This sets `ICON_BIG`. A good ceiling here is 256x256.
|
/// This sets `ICON_BIG`. A good ceiling here is 256x256.
|
||||||
fn with_taskbar_icon(self, taskbar_icon: Option<Icon>) -> WindowBuilder;
|
fn with_taskbar_icon(self, taskbar_icon: Option<Icon>) -> WindowBuilder;
|
||||||
|
|
||||||
|
/// This sets `WS_EX_NOREDIRECTIONBITMAP`.
|
||||||
|
fn with_no_redirection_bitmap(self, flag: bool) -> WindowBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WindowBuilderExt for WindowBuilder {
|
impl WindowBuilderExt for WindowBuilder {
|
||||||
|
@ -69,6 +72,12 @@ impl WindowBuilderExt for WindowBuilder {
|
||||||
self.platform_specific.taskbar_icon = taskbar_icon;
|
self.platform_specific.taskbar_icon = taskbar_icon;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn with_no_redirection_bitmap(mut self, flag: bool) -> WindowBuilder {
|
||||||
|
self.platform_specific.no_redirection_bitmap = flag;
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Additional methods on `MonitorId` that are specific to Windows.
|
/// Additional methods on `MonitorId` that are specific to Windows.
|
||||||
|
|
|
@ -11,6 +11,7 @@ pub use self::window::Window;
|
||||||
pub struct PlatformSpecificWindowBuilderAttributes {
|
pub struct PlatformSpecificWindowBuilderAttributes {
|
||||||
pub parent: Option<HWND>,
|
pub parent: Option<HWND>,
|
||||||
pub taskbar_icon: Option<::Icon>,
|
pub taskbar_icon: Option<::Icon>,
|
||||||
|
pub no_redirection_bitmap: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Send for PlatformSpecificWindowBuilderAttributes {}
|
unsafe impl Send for PlatformSpecificWindowBuilderAttributes {}
|
||||||
|
|
|
@ -888,6 +888,9 @@ unsafe fn init(
|
||||||
if attributes.always_on_top {
|
if attributes.always_on_top {
|
||||||
ex_style |= winuser::WS_EX_TOPMOST;
|
ex_style |= winuser::WS_EX_TOPMOST;
|
||||||
}
|
}
|
||||||
|
if pl_attribs.no_redirection_bitmap {
|
||||||
|
ex_style |= winuser::WS_EX_NOREDIRECTIONBITMAP;
|
||||||
|
}
|
||||||
|
|
||||||
// adjusting the window coordinates using the style
|
// adjusting the window coordinates using the style
|
||||||
winuser::AdjustWindowRectEx(&mut rect, style, 0, ex_style);
|
winuser::AdjustWindowRectEx(&mut rect, style, 0, ex_style);
|
||||||
|
@ -999,7 +1002,7 @@ unsafe fn init(
|
||||||
};
|
};
|
||||||
|
|
||||||
// making the window transparent
|
// making the window transparent
|
||||||
if attributes.transparent {
|
if attributes.transparent && !pl_attribs.no_redirection_bitmap {
|
||||||
let bb = dwmapi::DWM_BLURBEHIND {
|
let bb = dwmapi::DWM_BLURBEHIND {
|
||||||
dwFlags: 0x1, // FIXME: DWM_BB_ENABLE;
|
dwFlags: 0x1, // FIXME: DWM_BB_ENABLE;
|
||||||
fEnable: 1,
|
fEnable: 1,
|
||||||
|
|
Loading…
Reference in a new issue