cargo fmt

This commit is contained in:
Victor Berger 2017-06-11 23:08:59 +02:00
parent 712fc5b8b8
commit bf9ee9a395
2 changed files with 13 additions and 13 deletions

View File

@ -7,26 +7,26 @@ extern crate slog;
extern crate slog_async; extern crate slog_async;
extern crate slog_term; extern crate slog_term;
use slog::*;
use glium::Surface; use glium::Surface;
use slog::*;
use smithay::backend::graphics::glium::IntoGlium; use smithay::backend::graphics::glium::IntoGlium;
use smithay::backend::input::InputBackend; use smithay::backend::input::InputBackend;
use smithay::backend::winit; use smithay::backend::winit;
use smithay::compositor::{self, CompositorHandler};
use smithay::shm::ShmGlobal; use smithay::shm::ShmGlobal;
use smithay::compositor::{CompositorHandler, self};
use wayland_server::protocol::{wl_compositor, wl_shm, wl_subcompositor}; use wayland_server::protocol::{wl_compositor, wl_shm, wl_subcompositor};
struct SurfaceHandler; struct SurfaceHandler;
impl compositor::Handler for SurfaceHandler { impl compositor::Handler for SurfaceHandler {}
}
fn main() { fn main() {
// A logger facility, here we use the terminal for this example // A logger facility, here we use the terminal for this example
let log = Logger::root(slog_async::Async::default(slog_term::term_full().fuse()).fuse(), o!()); let log = Logger::root(slog_async::Async::default(slog_term::term_full().fuse()).fuse(),
o!());
// Initialize a simple backend for testing // Initialize a simple backend for testing
let (renderer, mut input) = winit::init(log.clone()).unwrap(); let (renderer, mut input) = winit::init(log.clone()).unwrap();
@ -38,8 +38,7 @@ fn main() {
*/ */
// Insert the ShmGlobal as a handler to your event loop // Insert the ShmGlobal as a handler to your event loop
// Here, we specify tha the standard Argb8888 and Xrgb8888 is the only supported. // Here, we specify tha the standard Argb8888 and Xrgb8888 is the only supported.
let shm_handler_id = let shm_handler_id = event_loop.add_handler_with_init(ShmGlobal::new(vec![], log.clone()));
event_loop.add_handler_with_init(ShmGlobal::new(vec![], log.clone()));
// Register this handler to advertise a wl_shm global of version 1 // Register this handler to advertise a wl_shm global of version 1
event_loop.register_global::<wl_shm::WlShm, ShmGlobal>(shm_handler_id, 1); event_loop.register_global::<wl_shm::WlShm, ShmGlobal>(shm_handler_id, 1);
@ -57,10 +56,10 @@ fn main() {
*/ */
let (shm_token, compositor_token) = { let (shm_token, compositor_token) = {
let state = event_loop.state(); let state = event_loop.state();
( (state.get_handler::<ShmGlobal>(shm_handler_id).get_token(),
state.get_handler::<ShmGlobal>(shm_handler_id).get_token(), state
state.get_handler::<CompositorHandler<(),SurfaceHandler>>(compositor_handler_id).get_token() .get_handler::<CompositorHandler<(), SurfaceHandler>>(compositor_handler_id)
) .get_token())
}; };
/* /*

View File

@ -112,7 +112,8 @@ impl<U, H: UserHandler> wl_surface::Handler for CompositorHandler<U, H> {
} }
fn damage_buffer(&mut self, _: &mut EventLoopHandle, _: &Client, surface: &wl_surface::WlSurface, fn damage_buffer(&mut self, _: &mut EventLoopHandle, _: &Client, surface: &wl_surface::WlSurface,
x: i32, y: i32, width: i32, height: i32) { x: i32, y: i32, width: i32, height: i32) {
trace!(self.log, "Registering damage to surface (buffer coordinates)."); trace!(self.log,
"Registering damage to surface (buffer coordinates).");
unsafe { unsafe {
SurfaceData::<U>::with_data(surface, |d| { SurfaceData::<U>::with_data(surface, |d| {
d.damage = Damage::Buffer(Rectangle { d.damage = Damage::Buffer(Rectangle {