replace unsafe impls from wayland-server with declare_handler macro

This commit is contained in:
Victor Berger 2017-06-23 15:18:12 +02:00
parent c2c5716524
commit 9d2f03943e
3 changed files with 8 additions and 68 deletions

View File

@ -67,16 +67,7 @@ impl<U, H> wl_shell::Handler for WlShellStubHandler<U, H>
} }
} }
unsafe impl<U, H> ::wayland_server::Handler<wl_shell::WlShell> for WlShellStubHandler<U, H> server_declare_handler!(WlShellStubHandler<U: [Send], H: [CompositorHandler<U>, Send]>, wl_shell::Handler, wl_shell::WlShell);
where U: Send + 'static,
H: CompositorHandler<U> + Send + 'static
{
unsafe fn message(&mut self, evq: &mut EventLoopHandle, client: &Client, resource: &wl_shell::WlShell,
opcode: u32, args: *const ::wayland_server::sys::wl_argument)
-> Result<(), ()> {
<WlShellStubHandler<U,H> as ::wayland_server::protocol::wl_shell::Handler>::__message(self, evq, client, resource, opcode, args)
}
}
impl<U, H> wl_shell_surface::Handler for WlShellStubHandler<U, H> impl<U, H> wl_shell_surface::Handler for WlShellStubHandler<U, H>
where U: Send + 'static, where U: Send + 'static,
@ -84,14 +75,4 @@ impl<U, H> wl_shell_surface::Handler for WlShellStubHandler<U, H>
{ {
} }
unsafe impl<U, H> ::wayland_server::Handler<wl_shell_surface::WlShellSurface> for WlShellStubHandler<U, H> server_declare_handler!(WlShellStubHandler<U: [Send], H: [CompositorHandler<U>, Send]>, wl_shell_surface::Handler, wl_shell_surface::WlShellSurface);
where U: Send + 'static,
H: CompositorHandler<U> + Send + 'static
{
unsafe fn message(&mut self, evq: &mut EventLoopHandle, client: &Client,
resource: &wl_shell_surface::WlShellSurface, opcode: u32,
args: *const ::wayland_server::sys::wl_argument)
-> Result<(), ()> {
<WlShellStubHandler<U,H> as ::wayland_server::protocol::wl_shell_surface::Handler>::__message(self, evq, client, resource, opcode, args)
}
}

View File

@ -1,3 +1,4 @@
#[macro_use(server_declare_handler)]
extern crate wayland_server; extern crate wayland_server;
extern crate smithay; extern crate smithay;
#[macro_use] #[macro_use]

View File

@ -32,17 +32,7 @@ impl<U, H> wl_compositor::Handler for CompositorHandler<U, H>
} }
} }
unsafe impl<U, H> ::wayland_server::Handler<wl_compositor::WlCompositor> for CompositorHandler<U, H> server_declare_handler!(CompositorHandler<U: [Default, Send], H: [UserHandler<U>, Send]>, wl_compositor::Handler, wl_compositor::WlCompositor);
where U: Default + Send + 'static,
H: UserHandler<U> + Send + 'static
{
unsafe fn message(&mut self, evq: &mut EventLoopHandle, client: &Client,
resource: &wl_compositor::WlCompositor, opcode: u32,
args: *const ::wayland_server::sys::wl_argument)
-> Result<(), ()> {
<CompositorHandler<U, H> as ::wayland_server::protocol::wl_compositor::Handler>::__message(self, evq, client, resource, opcode, args)
}
}
/* /*
* wl_surface * wl_surface
@ -130,15 +120,7 @@ impl<U, H: UserHandler<U>> wl_surface::Handler for CompositorHandler<U, H> {
} }
} }
unsafe impl<U, H: UserHandler<U>> ::wayland_server::Handler<wl_surface::WlSurface> server_declare_handler!(CompositorHandler<U:[], H: [UserHandler<U>]>, wl_surface::Handler, wl_surface::WlSurface);
for CompositorHandler<U, H> {
unsafe fn message(&mut self, evq: &mut EventLoopHandle, client: &Client,
resource: &wl_surface::WlSurface, opcode: u32,
args: *const ::wayland_server::sys::wl_argument)
-> Result<(), ()> {
<CompositorHandler<U, H> as ::wayland_server::protocol::wl_surface::Handler>::__message(self, evq, client, resource, opcode, args)
}
}
impl<U> Destroy<wl_surface::WlSurface> for CompositorDestructor<U> { impl<U> Destroy<wl_surface::WlSurface> for CompositorDestructor<U> {
fn destroy(surface: &wl_surface::WlSurface) { fn destroy(surface: &wl_surface::WlSurface) {
@ -181,14 +163,7 @@ impl<U, H> wl_region::Handler for CompositorHandler<U, H> {
} }
} }
unsafe impl<U, H> ::wayland_server::Handler<wl_region::WlRegion> for CompositorHandler<U, H> { server_declare_handler!(CompositorHandler<U: [], H: []>, wl_region::Handler, wl_region::WlRegion);
unsafe fn message(&mut self, evq: &mut EventLoopHandle, client: &Client,
resource: &wl_region::WlRegion, opcode: u32,
args: *const ::wayland_server::sys::wl_argument)
-> Result<(), ()> {
<CompositorHandler<U, H> as ::wayland_server::protocol::wl_region::Handler>::__message(self, evq, client, resource, opcode, args)
}
}
impl<U> Destroy<wl_region::WlRegion> for CompositorDestructor<U> { impl<U> Destroy<wl_region::WlRegion> for CompositorDestructor<U> {
fn destroy(region: &wl_region::WlRegion) { fn destroy(region: &wl_region::WlRegion) {
@ -222,17 +197,7 @@ impl<U, H> wl_subcompositor::Handler for CompositorHandler<U, H>
} }
} }
unsafe impl<U, H> ::wayland_server::Handler<wl_subcompositor::WlSubcompositor> for CompositorHandler<U, H> server_declare_handler!(CompositorHandler<U: [Send], H: [Send]>, wl_subcompositor::Handler, wl_subcompositor::WlSubcompositor);
where U: Send + 'static,
H: Send + 'static
{
unsafe fn message(&mut self, evq: &mut EventLoopHandle, client: &Client,
resource: &wl_subcompositor::WlSubcompositor, opcode: u32,
args: *const ::wayland_server::sys::wl_argument)
-> Result<(), ()> {
<CompositorHandler<U, H> as ::wayland_server::protocol::wl_subcompositor::Handler>::__message(self, evq, client, resource, opcode, args)
}
}
/* /*
* wl_subsurface * wl_subsurface
@ -293,14 +258,7 @@ impl<U, H> wl_subsurface::Handler for CompositorHandler<U, H> {
} }
} }
unsafe impl<U, H> ::wayland_server::Handler<wl_subsurface::WlSubsurface> for CompositorHandler<U, H> { server_declare_handler!(CompositorHandler<U: [], H: []>, wl_subsurface::Handler, wl_subsurface::WlSubsurface);
unsafe fn message(&mut self, evq: &mut EventLoopHandle, client: &Client,
resource: &wl_subsurface::WlSubsurface, opcode: u32,
args: *const ::wayland_server::sys::wl_argument)
-> Result<(), ()> {
<CompositorHandler<U, H> as ::wayland_server::protocol::wl_subsurface::Handler>::__message(self, evq, client, resource, opcode, args)
}
}
impl<U> Destroy<wl_subsurface::WlSubsurface> for CompositorDestructor<U> { impl<U> Destroy<wl_subsurface::WlSubsurface> for CompositorDestructor<U> {
fn destroy(subsurface: &wl_subsurface::WlSubsurface) { fn destroy(subsurface: &wl_subsurface::WlSubsurface) {