Skip to content

Commit 0325605

Browse files
committed
Exclusive fullscreen
1 parent 7d55ab1 commit 0325605

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/main.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,20 @@ impl App {
161161
if let Some(_) = self.target.window.winit_window.fullscreen() {
162162
self.target.window.winit_window.set_fullscreen(None);
163163
} else {
164-
self.target
165-
.window
166-
.winit_window
167-
.set_fullscreen(Some(winit::window::Fullscreen::Borderless(None)));
164+
let monitor = self.target.window.winit_window.current_monitor();
165+
let f = if let Some(monitor) = monitor {
166+
let mut modes = monitor.video_modes();
167+
if let Some(m) = modes.next() {
168+
log::info!("Video #{}: {}", 0, m);
169+
winit::window::Fullscreen::Exclusive(m)
170+
} else {
171+
winit::window::Fullscreen::Borderless(None)
172+
}
173+
} else {
174+
winit::window::Fullscreen::Borderless(None)
175+
};
176+
177+
self.target.window.winit_window.set_fullscreen(Some(f));
168178
}
169179
}
170180
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,

0 commit comments

Comments
 (0)