Don't required EventLoop for wayland object creation

This commit is contained in:
Drakulix 2018-02-15 12:08:18 +01:00
parent 88617153b9
commit a0b6e2c916
5 changed files with 20 additions and 20 deletions

View file

@ -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<U: 'static, R: RoleType + 'static, ID: 'static> CompositorToken<U, R, ID> {
/// 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<U, R, ID, L>(
evl: &mut EventLoop, implem: SurfaceUserImplementation<U, R, ID>, idata: ID, logger: L
evlh: &mut EventLoopHandle, implem: SurfaceUserImplementation<U, R, ID>, idata: ID, logger: L
) -> (
CompositorToken<U, R, ID>,
Global<wl_compositor::WlCompositor, self::handlers::SurfaceIData<U, R, ID>>,
@ -548,8 +548,8 @@ where
idata,
);
let compositor_global_token =
evl.register_global::<wl_compositor::WlCompositor, _>(4, self::handlers::compositor_bind, idata);
let subcompositor_global_token = evl.register_global::<wl_subcompositor::WlSubcompositor, _>(
evlh.register_global::<wl_compositor::WlCompositor, _>(4, self::handlers::compositor_bind, idata);
let subcompositor_global_token = evlh.register_global::<wl_subcompositor::WlSubcompositor, _>(
1,
self::handlers::subcompositor_bind::<U, R>,
(),

View file

@ -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<L>(
evl: &mut EventLoop, name: String, physical: PhysicalProperties, logger: L
evlh: &mut EventLoopHandle, name: String, physical: PhysicalProperties, logger: L
) -> (
StateToken<Output>,
Global<wl_output::WlOutput, StateToken<Output>>,
@ -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)
}

View file

@ -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<L>(
evl: &mut EventLoop, name: String, logger: L
evlh: &mut EventLoopHandle, name: String, logger: L
) -> (StateToken<Seat>, Global<wl_seat::WlSeat, StateToken<Seat>>)
where
L: Into<Option<::slog::Logger>>,
@ -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)
}

View file

@ -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<U, R, CID, SID, SD> Clone for ShellSurfaceIData<U, R, CID, SID, SD> {
/// 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<U, R, CID, SID, SD, L>(
evl: &mut EventLoop, token: CompositorToken<U, R, CID>,
evlh: &mut EventLoopHandle, token: CompositorToken<U, R, CID>,
implementation: ShellSurfaceUserImplementation<U, R, CID, SID, SD>, idata: SID, logger: L,
) -> (
StateToken<ShellState<U, R, CID, SD>>,
@ -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::<U, R, CID, SID, SD>,
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::<U, R, CID, SID, SD>,
shell_surface_idata.clone(),

View file

@ -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<L>(
evl: &mut EventLoop, mut formats: Vec<wl_shm::Format>, logger: L
evlh: &mut EventLoopHandle, mut formats: Vec<wl_shm::Format>, logger: L
) -> Global<wl_shm::WlShm, ShmGlobalData>
where
L: Into<Option<::slog::Logger>>,
@ -104,7 +104,7 @@ where
log: log.new(o!("smithay_module" => "shm_handler")),
};
evl.register_global::<wl_shm::WlShm, _>(1, shm_global_bind, data)
evlh.register_global::<wl_shm::WlShm, _>(1, shm_global_bind, data)
}
/// Error that can occur when accessing an SHM buffer