Skip to content

Commit

Permalink
windows feature WS_EX_NOREDIRECTIONBITMAP (#575)
Browse files Browse the repository at this point in the history
* set WS_EX_NOREDIRECTIONBITMAP

* add CHANGELOG.md

* more flexibility.

* Skip DwmEnableBlurBehindWindow if no_redirection_bitmap is enabled.
  • Loading branch information
ekicyou authored and francesca64 committed Jun 22, 2018
1 parent 8f394f1 commit 047c67b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 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.
- 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.
Expand Down
9 changes: 9 additions & 0 deletions src/os/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ pub trait WindowBuilderExt {

/// This sets `ICON_BIG`. A good ceiling here is 256x256.
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 {
Expand All @@ -69,6 +72,12 @@ impl WindowBuilderExt for WindowBuilder {
self.platform_specific.taskbar_icon = taskbar_icon;
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.
Expand Down
1 change: 1 addition & 0 deletions src/platform/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub use self::window::Window;
pub struct PlatformSpecificWindowBuilderAttributes {
pub parent: Option<HWND>,
pub taskbar_icon: Option<::Icon>,
pub no_redirection_bitmap: bool,
}

unsafe impl Send for PlatformSpecificWindowBuilderAttributes {}
Expand Down
5 changes: 4 additions & 1 deletion src/platform/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,9 @@ unsafe fn init(
if attributes.always_on_top {
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
winuser::AdjustWindowRectEx(&mut rect, style, 0, ex_style);
Expand Down Expand Up @@ -999,7 +1002,7 @@ unsafe fn init(
};

// making the window transparent
if attributes.transparent {
if attributes.transparent && !pl_attribs.no_redirection_bitmap {
let bb = dwmapi::DWM_BLURBEHIND {
dwFlags: 0x1, // FIXME: DWM_BB_ENABLE;
fEnable: 1,
Expand Down

0 comments on commit 047c67b

Please sign in to comment.