|
|
@ -176,12 +176,10 @@ impl WindowWrapper {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn toggle_fullscreen(&mut self) {
|
|
|
|
pub fn toggle_fullscreen(&mut self) {
|
|
|
|
let raw_handle = self.window.raw();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.fullscreen {
|
|
|
|
if self.fullscreen {
|
|
|
|
if cfg!(not(target_os = "macos")) {
|
|
|
|
if cfg!(not(target_os = "macos")) {
|
|
|
|
unsafe {
|
|
|
|
unsafe {
|
|
|
|
// Set window back to resizable
|
|
|
|
let raw_handle = self.window.raw();
|
|
|
|
sdl2::sys::SDL_SetWindowResizable(raw_handle, sdl2::sys::SDL_bool::SDL_TRUE);
|
|
|
|
sdl2::sys::SDL_SetWindowResizable(raw_handle, sdl2::sys::SDL_bool::SDL_TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -199,13 +197,20 @@ impl WindowWrapper {
|
|
|
|
self.cached_position = self.window.position();
|
|
|
|
self.cached_position = self.window.position();
|
|
|
|
|
|
|
|
|
|
|
|
if cfg!(not(target_os = "macos")) {
|
|
|
|
if cfg!(not(target_os = "macos")) {
|
|
|
|
let raw_handle = self.window.raw();
|
|
|
|
let video_subsystem = self.window.subsystem();
|
|
|
|
let display_index = self.window.display_index().unwrap();
|
|
|
|
if let Ok(rect) = self
|
|
|
|
if let Ok(rect) = self.window.subsystem().display_bounds(display_index) {
|
|
|
|
.window
|
|
|
|
|
|
|
|
.display_index()
|
|
|
|
|
|
|
|
.and_then(|index| video_subsystem.display_bounds(index))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Set window to fullscreen
|
|
|
|
unsafe {
|
|
|
|
unsafe {
|
|
|
|
sdl2::sys::SDL_SetWindowResizable(raw_handle, sdl2::sys::SDL_bool::SDL_FALSE);
|
|
|
|
let raw_handle = self.window.raw();
|
|
|
|
|
|
|
|
sdl2::sys::SDL_SetWindowResizable(
|
|
|
|
|
|
|
|
raw_handle,
|
|
|
|
|
|
|
|
sdl2::sys::SDL_bool::SDL_FALSE,
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Set window to fullscreen
|
|
|
|
|
|
|
|
self.window.set_size(rect.width(), rect.height()).unwrap();
|
|
|
|
self.window.set_size(rect.width(), rect.height()).unwrap();
|
|
|
|
self.window.set_position(
|
|
|
|
self.window.set_position(
|
|
|
|
sdl2::video::WindowPos::Positioned(rect.x()),
|
|
|
|
sdl2::video::WindowPos::Positioned(rect.x()),
|
|
|
|