drm: reformat
This commit is contained in:
parent
9c71793b0e
commit
73d262e292
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
extern crate drm;
|
extern crate drm;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate glium;
|
extern crate glium;
|
||||||
|
@ -34,15 +33,15 @@ use smithay::shm::{ShmGlobal, ShmToken};
|
||||||
|
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::io::Error as IoError;
|
use std::io::Error as IoError;
|
||||||
use std::time::Duration;
|
|
||||||
use std::os::unix::io::AsRawFd;
|
use std::os::unix::io::AsRawFd;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use wayland_protocols::unstable::xdg_shell::server::{zxdg_shell_v6, zxdg_toplevel_v6};
|
use wayland_protocols::unstable::xdg_shell::server::{zxdg_shell_v6, zxdg_toplevel_v6};
|
||||||
|
|
||||||
use wayland_server::{Client, EventLoopHandle};
|
use wayland_server::{Client, EventLoopHandle};
|
||||||
use wayland_server::sources::READ;
|
|
||||||
use wayland_server::protocol::{wl_callback, wl_compositor, wl_output, wl_seat, wl_shell, wl_shm,
|
use wayland_server::protocol::{wl_callback, wl_compositor, wl_output, wl_seat, wl_shell, wl_shm,
|
||||||
wl_subcompositor, wl_surface};
|
wl_subcompositor, wl_surface};
|
||||||
|
use wayland_server::sources::READ;
|
||||||
|
|
||||||
define_roles!(Roles => [ ShellSurface, ShellSurfaceRole ] );
|
define_roles!(Roles => [ ShellSurface, ShellSurfaceRole ] );
|
||||||
|
|
||||||
|
@ -284,7 +283,8 @@ fn main() {
|
||||||
|
|
||||||
let fd = device.as_raw_fd();
|
let fd = device.as_raw_fd();
|
||||||
let drm_device_id = event_loop.add_handler(device);
|
let drm_device_id = event_loop.add_handler(device);
|
||||||
let _drm_event_source = event_loop.add_fd_event_source::<DrmDevice<DrmHandlerImpl>>(fd, drm_device_id, READ);
|
let _drm_event_source =
|
||||||
|
event_loop.add_fd_event_source::<DrmDevice<DrmHandlerImpl>>(fd, drm_device_id, READ);
|
||||||
|
|
||||||
event_loop.run().unwrap();
|
event_loop.run().unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
use super::{DrmError, ModeError};
|
use super::{DrmError, ModeError};
|
||||||
|
|
||||||
use super::devices;
|
use super::devices;
|
||||||
|
|
|
@ -153,7 +153,7 @@ impl error::Error for ModeError {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum CrtcError {
|
pub enum CrtcError {
|
||||||
/// Selected crtc is already in use by another `DrmBackend`
|
/// Selected crtc is already in use by another `DrmBackend`
|
||||||
AlreadyInUse
|
AlreadyInUse,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for CrtcError {
|
impl fmt::Display for CrtcError {
|
||||||
|
|
|
@ -156,7 +156,7 @@ use std::os::unix::io::{AsRawFd, RawFd};
|
||||||
use std::rc::{Rc, Weak};
|
use std::rc::{Rc, Weak};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use wayland_server::{EventLoopHandle};
|
use wayland_server::EventLoopHandle;
|
||||||
use wayland_server::sources::{FdEventSourceHandler, FdInterest};
|
use wayland_server::sources::{FdEventSourceHandler, FdInterest};
|
||||||
|
|
||||||
mod backend;
|
mod backend;
|
||||||
|
@ -164,7 +164,7 @@ mod error;
|
||||||
|
|
||||||
pub use self::backend::{DrmBackend, Id};
|
pub use self::backend::{DrmBackend, Id};
|
||||||
use self::backend::DrmBackendInternal;
|
use self::backend::DrmBackendInternal;
|
||||||
pub use self::error::{Error as DrmError, ModeError, CrtcError};
|
pub use self::error::{CrtcError, Error as DrmError, ModeError};
|
||||||
|
|
||||||
/// Internal struct as required by the drm crate
|
/// Internal struct as required by the drm crate
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -427,10 +427,7 @@ impl<H: DrmHandler + 'static> FdEventSourceHandler for DrmDevice<H> {
|
||||||
impl BasicDevice for DrmDeviceRef {}
|
impl BasicDevice for DrmDeviceRef {}
|
||||||
impl ControlDevice for DrmDeviceRef {}
|
impl ControlDevice for DrmDeviceRef {}
|
||||||
|
|
||||||
struct PageFlipHandler<'a, 'b, H: DrmHandler + 'static>(
|
struct PageFlipHandler<'a, 'b, H: DrmHandler + 'static>(&'a mut DrmDevice<H>, &'b mut EventLoopHandle);
|
||||||
&'a mut DrmDevice<H>,
|
|
||||||
&'b mut EventLoopHandle,
|
|
||||||
);
|
|
||||||
|
|
||||||
impl<'a, 'b, H: DrmHandler + 'static> crtc::PageFlipHandler<DrmDeviceRef> for PageFlipHandler<'a, 'b, H> {
|
impl<'a, 'b, H: DrmHandler + 'static> crtc::PageFlipHandler<DrmDeviceRef> for PageFlipHandler<'a, 'b, H> {
|
||||||
fn handle_event(&mut self, _device: &DrmDeviceRef, frame: u32, duration: Duration,
|
fn handle_event(&mut self, _device: &DrmDeviceRef, frame: u32, duration: Duration,
|
||||||
|
@ -451,10 +448,7 @@ impl<H: DrmHandler + 'static> FdEventSourceHandler for DrmDevice<H> {
|
||||||
&DrmDeviceRef(fd),
|
&DrmDeviceRef(fd),
|
||||||
2,
|
2,
|
||||||
None::<&mut ()>,
|
None::<&mut ()>,
|
||||||
Some(&mut PageFlipHandler(
|
Some(&mut PageFlipHandler(self, evlh)),
|
||||||
self,
|
|
||||||
evlh,
|
|
||||||
)),
|
|
||||||
None::<&mut ()>,
|
None::<&mut ()>,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue