Add support for fullscreen #10102

This commit is contained in:
Jansen Jan 2016-12-08 14:02:08 +01:00
parent c3c086e521
commit 55f0e56224
33 changed files with 454 additions and 30 deletions

View file

@ -633,6 +633,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
func();
}
(Msg::SetFullscreenState(state), ShutdownState::NotShuttingDown) => {
self.window.set_fullscreen_state(state);
}
// When we are shutting_down, we need to avoid performing operations
// such as Paint that may crash because we have begun tearing down
// the rest of our resources.

View file

@ -128,7 +128,9 @@ pub enum Msg {
/// Runs a closure in the compositor thread.
/// It's used to dispatch functions from webrender to the main thread's event loop.
/// Required to allow WGL GLContext sharing in Windows.
Dispatch(Box<Fn() + Send>)
Dispatch(Box<Fn() + Send>),
/// Enter or exit fullscreen
SetFullscreenState(bool),
}
impl Debug for Msg {
@ -161,6 +163,7 @@ impl Debug for Msg {
Msg::PipelineExited(..) => write!(f, "PipelineExited"),
Msg::NewScrollFrameReady(..) => write!(f, "NewScrollFrameReady"),
Msg::Dispatch(..) => write!(f, "Dispatch"),
Msg::SetFullscreenState(..) => write!(f, "SetFullscreenState"),
}
}
}

View file

@ -119,6 +119,8 @@ pub trait WindowMethods {
fn set_inner_size(&self, size: Size2D<u32>);
/// Set the window position
fn set_position(&self, point: Point2D<i32>);
/// Set fullscreen state
fn set_fullscreen_state(&self, state: bool);
/// Sets the page title for the current page.
fn set_page_title(&self, title: Option<String>);