@@ -1988,8 +1988,6 @@ pub struct WindowWrapper {
1988
1988
webviews : Vec < WebviewWrapper > ,
1989
1989
window_event_listeners : WindowEventListeners ,
1990
1990
#[ cfg( windows) ]
1991
- is_window_fullscreen : bool ,
1992
- #[ cfg( windows) ]
1993
1991
is_window_transparent : bool ,
1994
1992
#[ cfg( windows) ]
1995
1993
surface : Option < softbuffer:: Surface < Arc < Window > , Arc < Window > > > ,
@@ -2773,7 +2771,15 @@ fn handle_user_message<T: UserEvent>(
2773
2771
WindowMessage :: Destroy => {
2774
2772
panic ! ( "cannot handle `WindowMessage::Destroy` on the main thread" )
2775
2773
}
2776
- WindowMessage :: SetDecorations ( decorations) => window. set_decorations ( decorations) ,
2774
+ WindowMessage :: SetDecorations ( decorations) => {
2775
+ window. set_decorations ( decorations) ;
2776
+ #[ cfg( windows) ]
2777
+ if decorations {
2778
+ undecorated_resizing:: detach_resize_handler ( window. hwnd ( ) ) ;
2779
+ } else {
2780
+ undecorated_resizing:: attach_resize_handler ( window. hwnd ( ) ) ;
2781
+ }
2782
+ }
2777
2783
WindowMessage :: SetShadow ( _enable) => {
2778
2784
#[ cfg( windows) ]
2779
2785
window. set_undecorated_shadow ( _enable) ;
@@ -2806,10 +2812,6 @@ fn handle_user_message<T: UserEvent>(
2806
2812
} else {
2807
2813
window. set_fullscreen ( None )
2808
2814
}
2809
- #[ cfg( windows) ]
2810
- if let Some ( w) = windows. 0 . borrow_mut ( ) . get_mut ( & id) {
2811
- w. is_window_fullscreen = fullscreen;
2812
- }
2813
2815
}
2814
2816
WindowMessage :: SetFocus => {
2815
2817
window. set_focus ( ) ;
@@ -3197,8 +3199,6 @@ fn handle_user_message<T: UserEvent>(
3197
3199
Message :: CreateRawWindow ( window_id, handler, sender) => {
3198
3200
let ( label, builder) = handler ( ) ;
3199
3201
3200
- #[ cfg( windows) ]
3201
- let is_window_fullscreen = builder. window . fullscreen . is_some ( ) ;
3202
3202
#[ cfg( windows) ]
3203
3203
let is_window_transparent = builder. window . transparent ;
3204
3204
@@ -3232,8 +3232,6 @@ fn handle_user_message<T: UserEvent>(
3232
3232
window_event_listeners : Default :: default ( ) ,
3233
3233
webviews : Vec :: new ( ) ,
3234
3234
#[ cfg( windows) ]
3235
- is_window_fullscreen,
3236
- #[ cfg( windows) ]
3237
3235
is_window_transparent,
3238
3236
#[ cfg( windows) ]
3239
3237
surface,
@@ -3577,8 +3575,6 @@ fn create_window<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
3577
3575
3578
3576
#[ cfg( windows) ]
3579
3577
let is_window_transparent = window_builder. inner . window . transparent ;
3580
- #[ cfg( windows) ]
3581
- let is_window_fullscreen = window_builder. inner . window . fullscreen . is_some ( ) ;
3582
3578
3583
3579
#[ cfg( target_os = "macos" ) ]
3584
3580
{
@@ -3727,8 +3723,6 @@ fn create_window<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
3727
3723
webviews,
3728
3724
window_event_listeners,
3729
3725
#[ cfg( windows) ]
3730
- is_window_fullscreen,
3731
- #[ cfg( windows) ]
3732
3726
is_window_transparent,
3733
3727
#[ cfg( windows) ]
3734
3728
surface,
@@ -3818,11 +3812,6 @@ fn create_webview<T: UserEvent>(
3818
3812
. with_accept_first_mouse ( webview_attributes. accept_first_mouse )
3819
3813
. with_hotkeys_zoom ( webview_attributes. zoom_hotkeys_enabled ) ;
3820
3814
3821
- #[ cfg( windows) ]
3822
- if kind == WebviewKind :: WindowContent {
3823
- webview_builder = webview_builder. with_initialization_script ( undecorated_resizing:: SCRIPT ) ;
3824
- }
3825
-
3826
3815
if webview_attributes. drag_drop_handler_enabled {
3827
3816
let proxy = context. proxy . clone ( ) ;
3828
3817
let window_id_ = window_id. clone ( ) ;
@@ -4054,15 +4043,19 @@ fn create_webview<T: UserEvent>(
4054
4043
. build ( )
4055
4044
. map_err ( |e| Error :: CreateWebview ( Box :: new ( e) ) ) ?;
4056
4045
4057
- #[ cfg( any(
4058
- target_os = "linux" ,
4059
- target_os = "dragonfly" ,
4060
- target_os = "freebsd" ,
4061
- target_os = "netbsd" ,
4062
- target_os = "openbsd"
4063
- ) ) ]
4064
4046
if kind == WebviewKind :: WindowContent {
4047
+ #[ cfg( any(
4048
+ target_os = "linux" ,
4049
+ target_os = "dragonfly" ,
4050
+ target_os = "freebsd" ,
4051
+ target_os = "netbsd" ,
4052
+ target_os = "openbsd"
4053
+ ) ) ]
4065
4054
undecorated_resizing:: attach_resize_handler ( & webview) ;
4055
+ #[ cfg( windows) ]
4056
+ if window. is_resizable ( ) && !window. is_decorated ( ) {
4057
+ undecorated_resizing:: attach_resize_handler ( window. hwnd ( ) ) ;
4058
+ }
4066
4059
}
4067
4060
4068
4061
#[ cfg( windows) ]
@@ -4127,13 +4120,6 @@ fn create_ipc_handler<T: UserEvent>(
4127
4120
ipc_handler : Option < WebviewIpcHandler < T , Wry < T > > > ,
4128
4121
) -> Box < IpcHandler > {
4129
4122
Box :: new ( move |request| {
4130
- #[ cfg( windows) ]
4131
- if _kind == WebviewKind :: WindowContent
4132
- && undecorated_resizing:: handle_request ( context. clone ( ) , * window_id. lock ( ) . unwrap ( ) , & request)
4133
- {
4134
- return ;
4135
- }
4136
-
4137
4123
if let Some ( handler) = & ipc_handler {
4138
4124
handler (
4139
4125
DetachedWebview {
0 commit comments