-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Blur-Behind / Glassy Windows #538
Description
Moved from rust-windowing/glutin#875
Possibly related to #260
About
Glassy windows are similar to transparent windows. They let the user see through the client area of the window, exposing whatever is behind it. The difference to transparent windows is, that glassy windows have a blur-filter applied to them.
The effect can look something like this or this.
Transparency and blur are mutually exclusive.
Implementation
On Windows, the WinAPI function DwmEnableBlurBehindWindow can be used to create the blur-behind effect (I think). On OS X, NSVisualEffectView is the way to do it.
Personally I don't know how to achieve the effect on X11, but I'm sure it's possible there as well.
Library wise this could be exposed via a new function to the WindowBuilder struct. The question being is: What do we specifiy as the parameters? Since the blur effect can be customized to achieve a specific look and feel, passing a bool is probably not sufficient.
Further
Both of the Windows and OS X functions above only affect the client area of the window, however on both systems the title bar (and on Windows the border) can be made blurred as well.
It would probably be a good idea to implement seperate functions for controlling the client area and title bar / border blur.
Generally, I propose 2 functions similar to this:
fn with_client_blur(self, tbd.) -> WindowBuilder<'a>;
fn with_decoration_blur(self, tbd.) -> WindowBuilder<'a>;Names and signatures are of course debatable.
Comments and thoughts appreciated!
Appendix 1
I have done some more research and found that on Windows 10, the undocumented function SetWindowCompositionAttribute needs to be used, as DwmEnableBlurBehindWindow is deprecated and does not properly work anymore on Windows 10. This function is is implemented in user32.dll.