Unify fullscreen and fullscreen_windowed APIs

Use the enum to make a single fullscreen API that's much more
consistent. Both set_fullscreen() and with_fullscreen() take the
same enum and support all the variations so you can build the window
however you want and switch between the modes at runtime.
This commit is contained in:
Pedro Côrte-Real 2017-08-29 01:36:24 +01:00
parent b35c4a5ee5
commit 1382adbf11
4 changed files with 170 additions and 134 deletions

View file

@ -4,7 +4,7 @@ use std::collections::VecDeque;
use std::sync::Arc;
use std::env;
use {CreationError, CursorState, EventsLoopClosed, MouseCursor, ControlFlow};
use {CreationError, CursorState, EventsLoopClosed, MouseCursor, ControlFlow, FullScreenState};
use libc;
use self::x11::XConnection;
@ -319,9 +319,9 @@ impl Window2 {
}
#[inline]
pub fn set_fullscreen_windowed(&self, fullscreen: bool) {
pub fn set_fullscreen(&self, state: FullScreenState) {
match self {
&Window2::X(ref w) => w.set_fullscreen_windowed(fullscreen),
&Window2::X(ref w) => w.set_fullscreen(state),
&Window2::Wayland(ref _w) => {},
}
}