diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2015-05-24 13:09:22 +0200 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2015-05-24 13:09:22 +0200 |
commit | d089ea867459bfd7e875a2cd44ae46bac705ae18 (patch) | |
tree | 300996b7cb0e58aff01f390da77c76d94b3a8c5c /src/api/win32 | |
parent | 1377f276b7b64a1e75aa43da7efdea9a81155397 (diff) | |
parent | 9117bcf3d3f441c86c85b04ce54e135d28fcb2e1 (diff) | |
download | glutin-d089ea867459bfd7e875a2cd44ae46bac705ae18.tar.gz glutin-d089ea867459bfd7e875a2cd44ae46bac705ae18.zip |
Merge pull request #453 from tomaka/transparency
Add API for transparency and decorations and add support for win32
Diffstat (limited to 'src/api/win32')
-rw-r--r-- | src/api/win32/callback.rs | 1 | ||||
-rw-r--r-- | src/api/win32/init.rs | 17 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/api/win32/callback.rs b/src/api/win32/callback.rs index 1ea95a5..86d5f1c 100644 --- a/src/api/win32/callback.rs +++ b/src/api/win32/callback.rs @@ -44,6 +44,7 @@ fn send_event(input_window: winapi::HWND, event: Event) { /// This is the callback that is called by `DispatchMessage` in the events loop. /// /// Returning 0 tells the Win32 API that the message has been processed. +// FIXME: detect WM_DWMCOMPOSITIONCHANGED and call DwmEnableBlurBehindWindow if necessary pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT, wparam: winapi::WPARAM, lparam: winapi::LPARAM) -> winapi::LRESULT diff --git a/src/api/win32/init.rs b/src/api/win32/init.rs index fb4e181..f46c395 100644 --- a/src/api/win32/init.rs +++ b/src/api/win32/init.rs @@ -25,6 +25,7 @@ use std::sync::mpsc::channel; use winapi; use kernel32; +use dwmapi; use user32; use api::wgl; @@ -102,7 +103,7 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>, } // computing the style and extended style of the window - let (ex_style, style) = if builder.monitor.is_some() { + let (ex_style, style) = if builder.monitor.is_some() || builder.decorations == false { (winapi::WS_EX_APPWINDOW, winapi::WS_POPUP | winapi::WS_CLIPSIBLINGS | winapi::WS_CLIPCHILDREN) } else { (winapi::WS_EX_APPWINDOW | winapi::WS_EX_WINDOWEDGE, @@ -214,6 +215,20 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>, } }; + // making the window transparent + if builder.transparent { + let bb = winapi::DWM_BLURBEHIND { + dwFlags: 0x1, // FIXME: DWM_BB_ENABLE; + fEnable: 1, + hRgnBlur: ptr::null_mut(), + fTransitionOnMaximized: 0, + }; + + unsafe { + dwmapi::DwmEnableBlurBehindWindow(real_window.0, &bb); + } + } + // calling SetForegroundWindow if fullscreen if builder.monitor.is_some() { user32::SetForegroundWindow(real_window.0); |