@@ -129,7 +129,16 @@ impl Window {
129
129
} ) ;
130
130
}
131
131
132
- pub fn set_blur ( & self , _blur : bool ) { }
132
+ pub fn set_blur ( & self , blur : bool ) {
133
+ let window = self . window ;
134
+ let window_state = Arc :: clone ( & self . window_state ) ;
135
+ self . thread_executor . execute_in_thread ( move || {
136
+ let _ = & window;
137
+ WindowState :: set_window_flags ( window_state. lock ( ) . unwrap ( ) , window, |f| {
138
+ f. set ( WindowFlags :: BLUR , blur)
139
+ } ) ;
140
+ } ) ;
141
+ }
133
142
134
143
#[ inline]
135
144
pub fn set_visible ( & self , visible : bool ) {
@@ -1233,10 +1242,16 @@ impl InitData<'_> {
1233
1242
pub unsafe fn on_create ( & mut self ) {
1234
1243
let win = self . window . as_mut ( ) . expect ( "failed window creation" ) ;
1235
1244
1236
- // making the window transparent
1245
+ // making the window transparent and optionally blurred
1237
1246
if self . attributes . transparent && !self . attributes . platform_specific . no_redirection_bitmap {
1238
- // Empty region for the blur effect, so the window is fully transparent
1239
- let region = unsafe { CreateRectRgn ( 0 , 0 , -1 , -1 ) } ;
1247
+ let region = unsafe {
1248
+ if self . attributes . blur {
1249
+ 0
1250
+ } else {
1251
+ // Empty region for the blur effect, so the window is fully transparent
1252
+ CreateRectRgn ( 0 , 0 , -1 , -1 )
1253
+ }
1254
+ } ;
1240
1255
1241
1256
let bb = DWM_BLURBEHIND {
1242
1257
dwFlags : DWM_BB_ENABLE | DWM_BB_BLURREGION ,
@@ -1328,6 +1343,7 @@ unsafe fn init(
1328
1343
. set ( WindowFlags :: NO_BACK_BUFFER , attributes. platform_specific . no_redirection_bitmap ) ;
1329
1344
window_flags. set ( WindowFlags :: MARKER_ACTIVATE , attributes. active ) ;
1330
1345
window_flags. set ( WindowFlags :: TRANSPARENT , attributes. transparent ) ;
1346
+ window_flags. set ( WindowFlags :: BLUR , attributes. blur ) ;
1331
1347
// WindowFlags::VISIBLE and MAXIMIZED are set down below after the window has been configured.
1332
1348
window_flags. set ( WindowFlags :: RESIZABLE , attributes. resizable ) ;
1333
1349
// Will be changed later using `window.set_enabled_buttons` but we need to set a default here
0 commit comments