@@ -68,7 +68,6 @@ pub struct WinitWindowWrapper {
68
68
keyboard_manager : KeyboardManager ,
69
69
mouse_manager : MouseManager ,
70
70
title : String ,
71
- fullscreen : bool ,
72
71
font_changed_last_frame : bool ,
73
72
saved_inner_size : dpi:: PhysicalSize < u32 > ,
74
73
saved_grid_size : Option < GridSize < u32 > > ,
@@ -99,7 +98,6 @@ impl WinitWindowWrapper {
99
98
keyboard_manager : KeyboardManager :: new ( ) ,
100
99
mouse_manager : MouseManager :: new ( ) ,
101
100
title : String :: from ( "Neovide" ) ,
102
- fullscreen : false ,
103
101
font_changed_last_frame : false ,
104
102
saved_inner_size,
105
103
saved_grid_size : None ,
@@ -122,18 +120,16 @@ impl WinitWindowWrapper {
122
120
}
123
121
}
124
122
125
- pub fn toggle_fullscreen ( & mut self ) {
123
+ pub fn set_fullscreen ( & mut self , fullscreen : bool ) {
126
124
if let Some ( skia_renderer) = & self . skia_renderer {
127
125
let window = skia_renderer. window ( ) ;
128
- if self . fullscreen {
129
- window. set_fullscreen ( None ) ;
130
- } else {
126
+ if fullscreen {
131
127
let handle = window. current_monitor ( ) ;
132
128
window. set_fullscreen ( Some ( Fullscreen :: Borderless ( handle) ) ) ;
129
+ } else {
130
+ window. set_fullscreen ( None ) ;
133
131
}
134
132
}
135
-
136
- self . fullscreen = !self . fullscreen ;
137
133
}
138
134
139
135
#[ cfg( target_os = "macos" ) ]
@@ -206,9 +202,7 @@ impl WinitWindowWrapper {
206
202
self . requested_lines = lines. map ( |v| v. try_into ( ) . unwrap ( ) ) ;
207
203
}
208
204
WindowSettingsChanged :: Fullscreen ( fullscreen) => {
209
- if self . fullscreen != fullscreen {
210
- self . toggle_fullscreen ( ) ;
211
- }
205
+ self . set_fullscreen ( fullscreen) ;
212
206
}
213
207
WindowSettingsChanged :: InputIme ( ime_enabled) => {
214
208
self . set_ime ( ime_enabled) ;
@@ -483,6 +477,9 @@ impl WinitWindowWrapper {
483
477
theme,
484
478
transparency,
485
479
window_blurred,
480
+ fullscreen,
481
+ #[ cfg( target_os = "macos" ) ]
482
+ input_macos_option_key_is_meta,
486
483
..
487
484
} = SETTINGS . get :: < WindowSettings > ( ) ;
488
485
@@ -567,6 +564,10 @@ impl WinitWindowWrapper {
567
564
) ;
568
565
569
566
window. set_blur ( window_blurred && transparency < 1.0 ) ;
567
+ if fullscreen {
568
+ let handle = window. current_monitor ( ) ;
569
+ window. set_fullscreen ( Some ( Fullscreen :: Borderless ( handle) ) ) ;
570
+ }
570
571
571
572
match theme. as_str ( ) {
572
573
"light" => set_background ( "light" ) ,
@@ -592,6 +593,8 @@ impl WinitWindowWrapper {
592
593
593
594
self . ui_state = UIState :: FirstFrame ;
594
595
self . skia_renderer = Some ( skia_renderer) ;
596
+ #[ cfg( target_os = "macos" ) ]
597
+ self . set_macos_option_as_meta ( input_macos_option_key_is_meta) ;
595
598
}
596
599
597
600
fn handle_draw_commands ( & mut self , batch : Vec < DrawCommand > ) {
0 commit comments