drm: reformat

This commit is contained in:
Drakulix 2017-09-14 22:32:53 +02:00
parent 9c71793b0e
commit 73d262e292
4 changed files with 10 additions and 17 deletions

View File

@ -1,4 +1,3 @@
extern crate drm;
#[macro_use]
extern crate glium;
@ -34,15 +33,15 @@ use smithay::shm::{ShmGlobal, ShmToken};
use std::fs::OpenOptions;
use std::io::Error as IoError;
use std::time::Duration;
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_server::{Client, EventLoopHandle};
use wayland_server::sources::READ;
use wayland_server::protocol::{wl_callback, wl_compositor, wl_output, wl_seat, wl_shell, wl_shm,
wl_subcompositor, wl_surface};
use wayland_server::sources::READ;
define_roles!(Roles => [ ShellSurface, ShellSurfaceRole ] );
@ -284,7 +283,8 @@ fn main() {
let fd = device.as_raw_fd();
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();
}

View File

@ -1,4 +1,3 @@
use super::{DrmError, ModeError};
use super::devices;

View File

@ -153,7 +153,7 @@ impl error::Error for ModeError {
#[derive(Debug)]
pub enum CrtcError {
/// Selected crtc is already in use by another `DrmBackend`
AlreadyInUse
AlreadyInUse,
}
impl fmt::Display for CrtcError {

View File

@ -156,7 +156,7 @@ use std::os::unix::io::{AsRawFd, RawFd};
use std::rc::{Rc, Weak};
use std::time::Duration;
use wayland_server::{EventLoopHandle};
use wayland_server::EventLoopHandle;
use wayland_server::sources::{FdEventSourceHandler, FdInterest};
mod backend;
@ -164,7 +164,7 @@ mod error;
pub use self::backend::{DrmBackend, Id};
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
#[derive(Debug)]
@ -255,7 +255,7 @@ impl<H: DrmHandler + 'static> DrmDevice<H> {
/// The file descriptor might not be valid and needs to be owned by smithay,
/// make sure not to share it. Otherwise undefined behavior might occur.
pub unsafe fn new_from_fd_with_gl_attr<L>(fd: RawFd, attributes: GlAttributes, logger: L)
-> Result<Self, DrmError>
-> Result<Self, DrmError>
where
L: Into<Option<::slog::Logger>>,
{
@ -427,10 +427,7 @@ impl<H: DrmHandler + 'static> FdEventSourceHandler for DrmDevice<H> {
impl BasicDevice for DrmDeviceRef {}
impl ControlDevice for DrmDeviceRef {}
struct PageFlipHandler<'a, 'b, H: DrmHandler + 'static>(
&'a mut DrmDevice<H>,
&'b mut EventLoopHandle,
);
struct PageFlipHandler<'a, 'b, H: DrmHandler + 'static>(&'a mut DrmDevice<H>, &'b mut EventLoopHandle);
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,
@ -451,10 +448,7 @@ impl<H: DrmHandler + 'static> FdEventSourceHandler for DrmDevice<H> {
&DrmDeviceRef(fd),
2,
None::<&mut ()>,
Some(&mut PageFlipHandler(
self,
evlh,
)),
Some(&mut PageFlipHandler(self, evlh)),
None::<&mut ()>,
).unwrap();
}