From a0b6e2c916aef0bf225a4a5fa8329027445d29ad Mon Sep 17 00:00:00 2001 From: Drakulix Date: Thu, 15 Feb 2018 12:08:18 +0100 Subject: [PATCH] Don't required EventLoop for wayland object creation --- src/wayland/compositor/mod.rs | 8 ++++---- src/wayland/output/mod.rs | 8 ++++---- src/wayland/seat/mod.rs | 8 ++++---- src/wayland/shell/mod.rs | 10 +++++----- src/wayland/shm/mod.rs | 6 +++--- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/wayland/compositor/mod.rs b/src/wayland/compositor/mod.rs index 0747dc8..6aedd21 100644 --- a/src/wayland/compositor/mod.rs +++ b/src/wayland/compositor/mod.rs @@ -93,7 +93,7 @@ use self::roles::{Role, RoleType, WrongRole}; use self::tree::SurfaceData; pub use self::tree::TraversalAction; use utils::Rectangle; -use wayland_server::{resource_is_registered, EventLoop, EventLoopHandle, Global}; +use wayland_server::{resource_is_registered, EventLoopHandle, Global}; use wayland_server::protocol::{wl_buffer, wl_callback, wl_compositor, wl_output, wl_region, wl_subcompositor, wl_surface}; @@ -529,7 +529,7 @@ impl CompositorToken { /// It also returns the two global handles, in case you whish to remove these /// globals from the event loop in the future. pub fn compositor_init( - evl: &mut EventLoop, implem: SurfaceUserImplementation, idata: ID, logger: L + evlh: &mut EventLoopHandle, implem: SurfaceUserImplementation, idata: ID, logger: L ) -> ( CompositorToken, Global>, @@ -548,8 +548,8 @@ where idata, ); let compositor_global_token = - evl.register_global::(4, self::handlers::compositor_bind, idata); - let subcompositor_global_token = evl.register_global::( + evlh.register_global::(4, self::handlers::compositor_bind, idata); + let subcompositor_global_token = evlh.register_global::( 1, self::handlers::subcompositor_bind::, (), diff --git a/src/wayland/output/mod.rs b/src/wayland/output/mod.rs index 9404d64..3acf5fc 100644 --- a/src/wayland/output/mod.rs +++ b/src/wayland/output/mod.rs @@ -54,7 +54,7 @@ //! # } //! ``` -use wayland_server::{Client, EventLoop, EventLoopHandle, Global, Liveness, Resource, StateToken}; +use wayland_server::{Client, EventLoopHandle, Global, Liveness, Resource, StateToken}; use wayland_server::protocol::wl_output; #[derive(Copy, Clone, PartialEq)] @@ -113,7 +113,7 @@ impl Output { /// returns the state token allowing you to access it, as well as the global handle, /// in case you whish to remove this global in the future. pub fn new( - evl: &mut EventLoop, name: String, physical: PhysicalProperties, logger: L + evlh: &mut EventLoopHandle, name: String, physical: PhysicalProperties, logger: L ) -> ( StateToken, Global>, @@ -125,7 +125,7 @@ impl Output { info!(log, "Creating new wl_output"; "name" => &name); - let token = evl.state().insert(Output { + let token = evlh.state().insert(Output { name: name, log: log, instances: Vec::new(), @@ -138,7 +138,7 @@ impl Output { preferred_mode: None, }); - let global = evl.register_global(3, output_bind, token.clone()); + let global = evlh.register_global(3, output_bind, token.clone()); (token, global) } diff --git a/src/wayland/seat/mod.rs b/src/wayland/seat/mod.rs index 724dccb..fae8005 100644 --- a/src/wayland/seat/mod.rs +++ b/src/wayland/seat/mod.rs @@ -59,7 +59,7 @@ mod pointer; pub use self::keyboard::{Error as KeyboardError, KeyboardHandle}; pub use self::pointer::PointerHandle; -use wayland_server::{Client, EventLoop, EventLoopHandle, Global, Liveness, Resource, StateToken}; +use wayland_server::{Client, EventLoopHandle, Global, Liveness, Resource, StateToken}; use wayland_server::protocol::{wl_keyboard, wl_pointer, wl_seat}; /// Internal data of a seat global @@ -88,7 +88,7 @@ impl Seat { /// you to add or remove capabilities from it), and the global handle, /// in case you want to remove it. pub fn new( - evl: &mut EventLoop, name: String, logger: L + evlh: &mut EventLoopHandle, name: String, logger: L ) -> (StateToken, Global>) where L: Into>, @@ -101,9 +101,9 @@ impl Seat { keyboard: None, known_seats: Vec::new(), }; - let token = evl.state().insert(seat); + let token = evlh.state().insert(seat); // TODO: support version 5 (axis) - let global = evl.register_global(4, seat_global_bind, token.clone()); + let global = evlh.register_global(4, seat_global_bind, token.clone()); (token, global) } diff --git a/src/wayland/shell/mod.rs b/src/wayland/shell/mod.rs index 6b3c223..18eff4b 100644 --- a/src/wayland/shell/mod.rs +++ b/src/wayland/shell/mod.rs @@ -113,7 +113,7 @@ use wayland::compositor::roles::Role; use wayland_protocols::unstable::xdg_shell::v6::server::{zxdg_popup_v6, zxdg_positioner_v6 as xdg_positioner, zxdg_shell_v6, zxdg_surface_v6, zxdg_toplevel_v6}; -use wayland_server::{EventLoop, EventLoopHandle, EventResult, Global, Liveness, Resource, StateToken}; +use wayland_server::{EventLoopHandle, EventResult, Global, Liveness, Resource, StateToken}; use wayland_server::protocol::{wl_output, wl_seat, wl_shell, wl_shell_surface, wl_surface}; mod wl_handlers; @@ -301,7 +301,7 @@ impl Clone for ShellSurfaceIData { /// It also returns the two global handles, in case you whish to remove these /// globals from the event loop in the future. pub fn shell_init( - evl: &mut EventLoop, token: CompositorToken, + evlh: &mut EventLoopHandle, token: CompositorToken, implementation: ShellSurfaceUserImplementation, idata: SID, logger: L, ) -> ( StateToken>, @@ -321,7 +321,7 @@ where known_toplevels: Vec::new(), known_popups: Vec::new(), }; - let shell_state_token = evl.state().insert(shell_state); + let shell_state_token = evlh.state().insert(shell_state); let shell_surface_idata = ShellSurfaceIData { log: log.new(o!("smithay_module" => "shell_handler")), @@ -332,12 +332,12 @@ where }; // TODO: init globals - let wl_shell_global = evl.register_global( + let wl_shell_global = evlh.register_global( 1, self::wl_handlers::wl_shell_bind::, shell_surface_idata.clone(), ); - let xdg_shell_global = evl.register_global( + let xdg_shell_global = evlh.register_global( 1, self::xdg_handlers::xdg_shell_bind::, shell_surface_idata.clone(), diff --git a/src/wayland/shm/mod.rs b/src/wayland/shm/mod.rs index 0346079..7ce136a 100644 --- a/src/wayland/shm/mod.rs +++ b/src/wayland/shm/mod.rs @@ -64,7 +64,7 @@ use self::pool::{Pool, ResizeError}; use std::rc::Rc; use std::sync::Arc; -use wayland_server::{resource_is_registered, Client, EventLoop, EventLoopHandle, Global, Resource}; +use wayland_server::{resource_is_registered, Client, EventLoopHandle, Global, Resource}; use wayland_server::protocol::{wl_buffer, wl_shm, wl_shm_pool}; mod pool; @@ -89,7 +89,7 @@ pub struct ShmGlobalData { /// returns the global handle, in case you whish to remove this global in /// the future. pub fn init_shm_global( - evl: &mut EventLoop, mut formats: Vec, logger: L + evlh: &mut EventLoopHandle, mut formats: Vec, logger: L ) -> Global where L: Into>, @@ -104,7 +104,7 @@ where log: log.new(o!("smithay_module" => "shm_handler")), }; - evl.register_global::(1, shm_global_bind, data) + evlh.register_global::(1, shm_global_bind, data) } /// Error that can occur when accessing an SHM buffer