Fix fullscreen mode on glutin backend[ci skip]

This commit is contained in:
karnak 2023-06-21 10:54:52 +03:00
parent f07228895c
commit a5ed1a370e
3 changed files with 22 additions and 1 deletions

View File

@ -351,6 +351,18 @@ impl BackendEventLoop for GlutinEventLoop {
}
_ => (),
}
#[cfg(not(any(target_os = "android", target_os = "horizon")))]
{
if state_ref.settings.window_mode.get_glutin_fullscreen_type() != window.window().fullscreen() {
let fullscreen_type = state_ref.settings.window_mode.get_glutin_fullscreen_type();
let cursor_visible = state_ref.settings.window_mode.should_display_mouse_cursor();
window.window().set_fullscreen(fullscreen_type);
window.window().set_cursor_visible(cursor_visible);
}
}
});
}

View File

@ -396,13 +396,14 @@ impl BackendEventLoop for SDL2EventLoop {
let window = refs.window.window_mut();
let fullscreen_type = state.settings.window_mode.get_sdl2_fullscreen_type();
let show_cursor = state.settings.window_mode.should_display_mouse_cursor();
window.set_fullscreen(fullscreen_type);
window
.subsystem()
.sdl()
.mouse()
.show_cursor(state.settings.window_mode.should_display_mouse_cursor());
.show_cursor(show_cursor);
refs.fullscreen_type = fullscreen_type;
}

View File

@ -86,6 +86,14 @@ impl WindowMode {
}
}
#[cfg(feature = "backend-glutin")]
pub fn get_glutin_fullscreen_type(&self) -> Option<glutin::window::Fullscreen> {
match self {
WindowMode::Windowed => None,
WindowMode::Fullscreen => Some(glutin::window::Fullscreen::Borderless(None)),
}
}
pub fn should_display_mouse_cursor(&self) -> bool {
match self {
WindowMode::Windowed => true,