Refactoring of the Glutin port in preparation of the compositor refactoring.

This commit is contained in:
Paul Rouget 2019-04-17 10:18:14 +02:00
parent d58ea974ba
commit 21ed7653f4
30 changed files with 1287 additions and 1067 deletions

View file

@ -103,7 +103,7 @@ impl FrameTreeId {
enum LayerPixel {}
/// NB: Never block on the constellation, because sometimes the constellation blocks on us.
pub struct IOCompositor<Window: WindowMethods> {
pub struct IOCompositor<Window: WindowMethods + ?Sized> {
/// The application window.
pub window: Rc<Window>,
@ -258,7 +258,7 @@ enum CompositeTarget {
PngFile,
}
impl<Window: WindowMethods> IOCompositor<Window> {
impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
fn new(window: Rc<Window>, state: InitialCompositorState) -> Self {
let composite_target = match opts::get().output_file {
Some(_) => CompositeTarget::PngFile,

View file

@ -148,8 +148,6 @@ pub trait WindowMethods {
/// Return the GL function pointer trait.
#[cfg(feature = "gl")]
fn gl(&self) -> Rc<dyn gl::Gl>;
/// Returns a thread-safe object to wake up the window's event loop.
fn create_event_loop_waker(&self) -> Box<dyn EventLoopWaker>;
/// Get the coordinates of the native window, the screen and the framebuffer.
fn get_coordinates(&self) -> EmbedderCoordinates;
/// Set whether the application is currently animating.
@ -157,6 +155,11 @@ pub trait WindowMethods {
/// will want to avoid blocking on UI events, and just
/// run the event loop at the vsync interval.
fn set_animation_state(&self, _state: AnimationState);
}
pub trait EmbedderMethods {
/// Returns a thread-safe object to wake up the window's event loop.
fn create_event_loop_waker(&self) -> Box<dyn EventLoopWaker>;
/// Register services with a VRServiceManager.
fn register_vr_services(
&self,