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

@ -357,17 +357,17 @@ pub enum MouseCursor {
}
/// Describes if the Window is in one of the fullscreen modes
#[derive(Clone, PartialEq)]
#[derive(Clone)]
pub enum FullScreenState {
None,
Windowed,
Exclusive(platform::MonitorId),
Exclusive(MonitorId),
}
impl FullScreenState {
pub fn get_monitor(&self) -> Option<platform::MonitorId> {
if let FullScreenState::Exclusive(ref monitor) = *self {
Some(monitor.clone())
Some(monitor.0.clone())
} else {
None
}