diff --git a/examples/drm.rs b/examples/drm.rs index bd93763..749b171 100644 --- a/examples/drm.rs +++ b/examples/drm.rs @@ -21,10 +21,10 @@ use helpers::{init_shell, GliumDrawer, MyWindowMap, Roles, SurfaceData}; use slog::{Drain, Logger}; use smithay::backend::drm::{drm_device_bind, DrmBackend, DrmDevice, DrmHandler}; use smithay::backend::graphics::egl::EGLGraphicsBackend; -use smithay::compositor::{CompositorToken, SubsurfaceRole, TraversalAction}; -use smithay::compositor::roles::Role; -use smithay::shell::ShellState; -use smithay::shm::init_shm_global; +use smithay::wayland::compositor::{CompositorToken, SubsurfaceRole, TraversalAction}; +use smithay::wayland::compositor::roles::Role; +use smithay::wayland::shell::ShellState; +use smithay::wayland::shm::init_shm_global; use std::cell::RefCell; use std::fs::OpenOptions; use std::io::Error as IoError; diff --git a/examples/helpers/implementations.rs b/examples/helpers/implementations.rs index 4fc3ff5..e75919d 100644 --- a/examples/helpers/implementations.rs +++ b/examples/helpers/implementations.rs @@ -1,9 +1,9 @@ use super::WindowMap; use rand; -use smithay::compositor::{compositor_init, CompositorToken, SurfaceAttributes, SurfaceUserImplementation}; -use smithay::shell::{shell_init, PopupConfigure, ShellState, ShellSurfaceRole, +use smithay::wayland::compositor::{compositor_init, CompositorToken, SurfaceAttributes, SurfaceUserImplementation}; +use smithay::wayland::shell::{shell_init, PopupConfigure, ShellState, ShellSurfaceRole, ShellSurfaceUserImplementation, ToplevelConfigure}; -use smithay::shm::with_buffer_contents; +use smithay::wayland::shm::with_buffer_contents; use std::cell::RefCell; use std::rc::Rc; use wayland_server::{EventLoop, StateToken}; diff --git a/examples/helpers/window_map.rs b/examples/helpers/window_map.rs index 9122846..a2dda9f 100644 --- a/examples/helpers/window_map.rs +++ b/examples/helpers/window_map.rs @@ -1,6 +1,6 @@ -use smithay::compositor::{CompositorToken, SubsurfaceRole, SurfaceAttributes, TraversalAction}; -use smithay::compositor::roles::Role; -use smithay::shell::{ShellSurfaceRole, ToplevelSurface}; +use smithay::wayland::compositor::{CompositorToken, SubsurfaceRole, SurfaceAttributes, TraversalAction}; +use smithay::wayland::compositor::roles::Role; +use smithay::wayland::shell::{ShellSurfaceRole, ToplevelSurface}; use smithay::utils::Rectangle; use wayland_server::Resource; use wayland_server::protocol::wl_surface; diff --git a/examples/winit.rs b/examples/winit.rs index c06d922..057ec46 100644 --- a/examples/winit.rs +++ b/examples/winit.rs @@ -18,10 +18,10 @@ use smithay::backend::graphics::egl::EGLGraphicsBackend; use smithay::backend::input::{self, Event, InputBackend, InputHandler, KeyboardKeyEvent, PointerButtonEvent, PointerMotionAbsoluteEvent}; use smithay::backend::winit; -use smithay::compositor::{SubsurfaceRole, TraversalAction}; -use smithay::compositor::roles::Role; -use smithay::seat::{KeyboardHandle, PointerHandle, Seat}; -use smithay::shm::init_shm_global; +use smithay::wayland::compositor::{SubsurfaceRole, TraversalAction}; +use smithay::wayland::compositor::roles::Role; +use smithay::wayland::seat::{KeyboardHandle, PointerHandle, Seat}; +use smithay::wayland::shm::init_shm_global; use std::cell::RefCell; use std::rc::Rc; use wayland_server::protocol::wl_pointer; diff --git a/src/lib.rs b/src/lib.rs index 6f8f0a6..bb9e7a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -42,10 +42,7 @@ extern crate slog_stdlog; extern crate error_chain; pub mod backend; -pub mod compositor; -pub mod shm; -pub mod seat; -pub mod shell; +pub mod wayland; pub mod utils; fn slog_or_stdlog(logger: L) -> ::slog::Logger diff --git a/src/compositor/handlers.rs b/src/wayland/compositor/handlers.rs similarity index 100% rename from src/compositor/handlers.rs rename to src/wayland/compositor/handlers.rs diff --git a/src/compositor/mod.rs b/src/wayland/compositor/mod.rs similarity index 99% rename from src/compositor/mod.rs rename to src/wayland/compositor/mod.rs index ec819ed..504705a 100644 --- a/src/compositor/mod.rs +++ b/src/wayland/compositor/mod.rs @@ -31,7 +31,7 @@ //! # #[macro_use] extern crate smithay; //! use wayland_server::protocol::wl_compositor::WlCompositor; //! use wayland_server::protocol::wl_subcompositor::WlSubcompositor; -//! use smithay::compositor::{compositor_init, SurfaceUserImplementation}; +//! use smithay::wayland::compositor::{compositor_init, SurfaceUserImplementation}; //! //! // Define some user data to be associated with the surfaces. //! // It must implement the Default trait, which will represent the state of a surface which diff --git a/src/compositor/region.rs b/src/wayland/compositor/region.rs similarity index 100% rename from src/compositor/region.rs rename to src/wayland/compositor/region.rs diff --git a/src/compositor/roles.rs b/src/wayland/compositor/roles.rs similarity index 92% rename from src/compositor/roles.rs rename to src/wayland/compositor/roles.rs index ff705c4..845ffa9 100644 --- a/src/compositor/roles.rs +++ b/src/wayland/compositor/roles.rs @@ -161,7 +161,7 @@ macro_rules! define_roles( ($enum_name:ident => $([ $role_name: ident, $role_data: ty])*) => { define_roles!(__impl $enum_name => // add in subsurface role - [Subsurface, $crate::compositor::SubsurfaceRole] + [Subsurface, $crate::wayland::compositor::SubsurfaceRole] $([$role_name, $role_data])* ); }; @@ -177,7 +177,7 @@ macro_rules! define_roles( } } - impl $crate::compositor::roles::RoleType for $enum_name { + impl $crate::wayland::compositor::roles::RoleType for $enum_name { fn has_role(&self) -> bool { if let $enum_name::NoRole = *self { false @@ -188,7 +188,7 @@ macro_rules! define_roles( } $( - impl $crate::compositor::roles::Role<$role_data> for $enum_name { + impl $crate::wayland::compositor::roles::Role<$role_data> for $enum_name { fn set_with(&mut self, data: $role_data) -> ::std::result::Result<(), $role_data> { if let $enum_name::NoRole = *self { *self = $enum_name::$role_name(data); @@ -206,23 +206,23 @@ macro_rules! define_roles( } } - fn data(&self) -> ::std::result::Result<&$role_data, $crate::compositor::roles::WrongRole> { + fn data(&self) -> ::std::result::Result<&$role_data, $crate::wayland::compositor::roles::WrongRole> { if let $enum_name::$role_name(ref data) = *self { Ok(data) } else { - Err($crate::compositor::roles::WrongRole) + Err($crate::wayland::compositor::roles::WrongRole) } } - fn data_mut(&mut self) -> ::std::result::Result<&mut $role_data, $crate::compositor::roles::WrongRole> { + fn data_mut(&mut self) -> ::std::result::Result<&mut $role_data, $crate::wayland::compositor::roles::WrongRole> { if let $enum_name::$role_name(ref mut data) = *self { Ok(data) } else { - Err($crate::compositor::roles::WrongRole) + Err($crate::wayland::compositor::roles::WrongRole) } } - fn unset(&mut self) -> ::std::result::Result<$role_data, $crate::compositor::roles::WrongRole> { + fn unset(&mut self) -> ::std::result::Result<$role_data, $crate::wayland::compositor::roles::WrongRole> { // remove self to make borrow checker happy let temp = ::std::mem::replace(self, $enum_name::NoRole); if let $enum_name::$role_name(data) = temp { @@ -230,7 +230,7 @@ macro_rules! define_roles( } else { // put it back in place ::std::mem::replace(self, temp); - Err($crate::compositor::roles::WrongRole) + Err($crate::wayland::compositor::roles::WrongRole) } } } diff --git a/src/compositor/tree.rs b/src/wayland/compositor/tree.rs similarity index 100% rename from src/compositor/tree.rs rename to src/wayland/compositor/tree.rs diff --git a/src/wayland/mod.rs b/src/wayland/mod.rs new file mode 100644 index 0000000..165cef2 --- /dev/null +++ b/src/wayland/mod.rs @@ -0,0 +1,9 @@ +//! Protocol-related utilities +//! +//! This module contains several handlers to manage the wayland protocol +//! and the clients. + +pub mod compositor; +pub mod seat; +pub mod shm; +pub mod shell; \ No newline at end of file diff --git a/src/seat/keyboard.rs b/src/wayland/seat/keyboard.rs similarity index 100% rename from src/seat/keyboard.rs rename to src/wayland/seat/keyboard.rs diff --git a/src/seat/mod.rs b/src/wayland/seat/mod.rs similarity index 99% rename from src/seat/mod.rs rename to src/wayland/seat/mod.rs index cdc2516..f7837e8 100644 --- a/src/seat/mod.rs +++ b/src/wayland/seat/mod.rs @@ -11,7 +11,7 @@ //! # extern crate wayland_server; //! # #[macro_use] extern crate smithay; //! -//! use smithay::seat::Seat; +//! use smithay::wayland::seat::Seat; //! //! # fn main(){ //! # let (_display, mut event_loop) = wayland_server::create_display(); @@ -38,7 +38,7 @@ //! # extern crate wayland_server; //! # #[macro_use] extern crate smithay; //! # -//! # use smithay::seat::Seat; +//! # use smithay::wayland::seat::Seat; //! # //! # fn main(){ //! # let (_display, mut event_loop) = wayland_server::create_display(); diff --git a/src/seat/pointer.rs b/src/wayland/seat/pointer.rs similarity index 100% rename from src/seat/pointer.rs rename to src/wayland/seat/pointer.rs diff --git a/src/shell/mod.rs b/src/wayland/shell/mod.rs similarity index 98% rename from src/shell/mod.rs rename to src/wayland/shell/mod.rs index dce9124..16cdd50 100644 --- a/src/shell/mod.rs +++ b/src/wayland/shell/mod.rs @@ -29,9 +29,9 @@ //! # #[macro_use] extern crate smithay; //! # extern crate wayland_protocols; //! # -//! use smithay::compositor::roles::*; -//! use smithay::compositor::CompositorToken; -//! use smithay::shell::{shell_init, ShellSurfaceRole, ShellSurfaceUserImplementation}; +//! use smithay::wayland::compositor::roles::*; +//! use smithay::wayland::compositor::CompositorToken; +//! use smithay::wayland::shell::{shell_init, ShellSurfaceRole, ShellSurfaceUserImplementation}; //! use wayland_server::protocol::wl_shell::WlShell; //! use wayland_protocols::unstable::xdg_shell::server::zxdg_shell_v6::ZxdgShellV6; //! use wayland_server::{EventLoop, EventLoopHandle}; @@ -52,7 +52,7 @@ //! //! # fn main() { //! # let (_display, mut event_loop) = wayland_server::create_display(); -//! # let (compositor_token, _, _) = smithay::compositor::compositor_init::<(), MyRoles, _, _>( +//! # let (compositor_token, _, _) = smithay::wayland::compositor::compositor_init::<(), MyRoles, _, _>( //! # &mut event_loop, //! # unimplemented!(), //! # (), @@ -105,8 +105,8 @@ //! access from the `state()` of the event loop and the token returned by the init //! function. -use compositor::CompositorToken; -use compositor::roles::Role; +use wayland::compositor::CompositorToken; +use wayland::compositor::roles::Role; use std::cell::RefCell; use std::rc::Rc; use utils::Rectangle; diff --git a/src/shell/wl_handlers.rs b/src/wayland/shell/wl_handlers.rs similarity index 99% rename from src/shell/wl_handlers.rs rename to src/wayland/shell/wl_handlers.rs index 53c3102..2586064 100644 --- a/src/shell/wl_handlers.rs +++ b/src/wayland/shell/wl_handlers.rs @@ -1,8 +1,8 @@ use super::{make_shell_client_data, PopupConfigure, PopupState, PositionerState, ShellClient, ShellClientData, ShellSurfaceIData, ShellSurfacePendingState, ShellSurfaceRole, ToplevelConfigure, ToplevelState}; -use compositor::CompositorToken; -use compositor::roles::*; +use wayland::compositor::CompositorToken; +use wayland::compositor::roles::*; use std::sync::Mutex; use utils::Rectangle; use wayland_protocols::unstable::xdg_shell::server::{zxdg_positioner_v6 as xdg_positioner, zxdg_toplevel_v6}; diff --git a/src/shell/xdg_handlers.rs b/src/wayland/shell/xdg_handlers.rs similarity index 99% rename from src/shell/xdg_handlers.rs rename to src/wayland/shell/xdg_handlers.rs index 15311b9..233cfb8 100644 --- a/src/shell/xdg_handlers.rs +++ b/src/wayland/shell/xdg_handlers.rs @@ -1,8 +1,8 @@ use super::{make_shell_client_data, PopupConfigure, PopupState, PositionerState, ShellClient, ShellClientData, ShellSurfaceIData, ShellSurfacePendingState, ShellSurfaceRole, ToplevelConfigure, ToplevelState}; -use compositor::CompositorToken; -use compositor::roles::*; +use wayland::compositor::CompositorToken; +use wayland::compositor::roles::*; use std::sync::Mutex; use utils::Rectangle; use wayland_protocols::unstable::xdg_shell::server::{zxdg_popup_v6, zxdg_positioner_v6, zxdg_shell_v6, diff --git a/src/shm/mod.rs b/src/wayland/shm/mod.rs similarity index 98% rename from src/shm/mod.rs rename to src/wayland/shm/mod.rs index 88ff5e1..4a87663 100644 --- a/src/shm/mod.rs +++ b/src/wayland/shm/mod.rs @@ -19,7 +19,7 @@ //! extern crate wayland_server; //! extern crate smithay; //! -//! use smithay::shm::init_shm_global; +//! use smithay::wayland::shm::init_shm_global; //! use wayland_server::protocol::wl_shm::Format; //! //! # fn main() { @@ -43,7 +43,7 @@ //! # extern crate smithay; //! # use wayland_server::protocol::wl_buffer::WlBuffer; //! # fn wrap(buffer: &WlBuffer) { -//! use smithay::shm::{with_buffer_contents, BufferData}; +//! use smithay::wayland::shm::{with_buffer_contents, BufferData}; //! //! with_buffer_contents(&buffer, //! |slice: &[u8], buffer_metadata: BufferData| { diff --git a/src/shm/pool.rs b/src/wayland/shm/pool.rs similarity index 100% rename from src/shm/pool.rs rename to src/wayland/shm/pool.rs