From 73d262e292a4bc2e738b5635fce91ce45c74cf5c Mon Sep 17 00:00:00 2001 From: Drakulix Date: Thu, 14 Sep 2017 22:32:53 +0200 Subject: [PATCH] drm: reformat --- examples/drm.rs | 8 ++++---- src/backend/drm/backend.rs | 1 - src/backend/drm/error.rs | 2 +- src/backend/drm/mod.rs | 16 +++++----------- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/examples/drm.rs b/examples/drm.rs index bc65307..964cb67 100644 --- a/examples/drm.rs +++ b/examples/drm.rs @@ -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::>(fd, drm_device_id, READ); + let _drm_event_source = + event_loop.add_fd_event_source::>(fd, drm_device_id, READ); event_loop.run().unwrap(); } diff --git a/src/backend/drm/backend.rs b/src/backend/drm/backend.rs index a8c3f1e..31bc3e6 100644 --- a/src/backend/drm/backend.rs +++ b/src/backend/drm/backend.rs @@ -1,4 +1,3 @@ - use super::{DrmError, ModeError}; use super::devices; diff --git a/src/backend/drm/error.rs b/src/backend/drm/error.rs index 5e05e5c..01f7d2c 100644 --- a/src/backend/drm/error.rs +++ b/src/backend/drm/error.rs @@ -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 { diff --git a/src/backend/drm/mod.rs b/src/backend/drm/mod.rs index 19bfd09..81f1a9c 100644 --- a/src/backend/drm/mod.rs +++ b/src/backend/drm/mod.rs @@ -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 DrmDevice { /// 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(fd: RawFd, attributes: GlAttributes, logger: L) - -> Result + -> Result where L: Into>, { @@ -427,10 +427,7 @@ impl FdEventSourceHandler for DrmDevice { impl BasicDevice for DrmDeviceRef {} impl ControlDevice for DrmDeviceRef {} - struct PageFlipHandler<'a, 'b, H: DrmHandler + 'static>( - &'a mut DrmDevice, - &'b mut EventLoopHandle, - ); + struct PageFlipHandler<'a, 'b, H: DrmHandler + 'static>(&'a mut DrmDevice, &'b mut EventLoopHandle); impl<'a, 'b, H: DrmHandler + 'static> crtc::PageFlipHandler for PageFlipHandler<'a, 'b, H> { fn handle_event(&mut self, _device: &DrmDeviceRef, frame: u32, duration: Duration, @@ -451,10 +448,7 @@ impl FdEventSourceHandler for DrmDevice { &DrmDeviceRef(fd), 2, None::<&mut ()>, - Some(&mut PageFlipHandler( - self, - evlh, - )), + Some(&mut PageFlipHandler(self, evlh)), None::<&mut ()>, ).unwrap(); }