lib: Use nested imports

This commit is contained in:
Jonas Platte 2018-10-05 00:37:43 +02:00 committed by Victor Berger
parent 850ff6983a
commit a77e29d9b5
33 changed files with 346 additions and 280 deletions

View File

@ -1,9 +1,7 @@
extern crate gl_generator;
use gl_generator::{Api, Fallbacks, Profile, Registry};
use std::env;
use std::fs::File;
use std::path::PathBuf;
use std::{env, fs::File, path::PathBuf};
fn main() {
let dest = PathBuf::from(&env::var("OUT_DIR").unwrap());

View File

@ -1,22 +1,28 @@
use super::error::*;
use super::DevPath;
use backend::graphics::egl::error::Result as EGLResult;
use backend::graphics::egl::native::{Gbm, GbmSurfaceArguments};
use backend::graphics::egl::wayland::{EGLDisplay, EGLWaylandExtensions};
use backend::graphics::egl::{EGLContext, EGLGraphicsBackend, EGLSurface, PixelFormat, SwapBuffersError};
use backend::graphics::GraphicsBackend;
use drm::control::{connector, crtc, encoder, framebuffer, Mode};
use drm::control::{Device, ResourceInfo};
use drm::Device as BasicDevice;
use super::{error::*, DevPath};
use backend::graphics::{
egl::{
error::Result as EGLResult,
native::{Gbm, GbmSurfaceArguments},
wayland::{EGLDisplay, EGLWaylandExtensions},
EGLContext, EGLGraphicsBackend, EGLSurface, PixelFormat, SwapBuffersError,
},
GraphicsBackend,
};
use drm::{
control::{connector, crtc, encoder, framebuffer, Device, Mode, ResourceInfo},
Device as BasicDevice,
};
use gbm::{
BufferObject, BufferObjectFlags, Device as GbmDevice, Format as GbmFormat, Surface as GbmSurface,
SurfaceBufferHandle,
};
use image::{ImageBuffer, Rgba};
use nix::libc::c_void;
use std::cell::Cell;
use std::os::unix::io::{AsRawFd, RawFd};
use std::rc::{Rc, Weak};
use std::{
cell::Cell,
os::unix::io::{AsRawFd, RawFd},
rc::{Rc, Weak},
};
use wayland_server::Display;
/// Backend based on a `DrmDevice` and a given crtc

View File

@ -209,41 +209,52 @@
//! # }
//! ```
use backend::graphics::egl::context::{EGLContext, GlAttributes};
use backend::graphics::egl::error::Result as EGLResult;
use backend::graphics::egl::native::Gbm;
use backend::graphics::egl::wayland::{EGLDisplay, EGLWaylandExtensions};
use backend::graphics::egl::{
context::{EGLContext, GlAttributes},
error::Result as EGLResult,
native::Gbm,
wayland::{EGLDisplay, EGLWaylandExtensions},
};
#[cfg(feature = "backend_session")]
use backend::session::{AsSessionObserver, SessionObserver};
use drm::control::framebuffer;
use drm::control::Device as ControlDevice;
use drm::control::{connector, crtc, encoder, Mode, ResourceInfo};
use drm::result::Error as DrmError;
use drm::Device as BasicDevice;
use drm::{
control::{connector, crtc, encoder, framebuffer, Device as ControlDevice, Mode, ResourceInfo},
result::Error as DrmError,
Device as BasicDevice,
};
use gbm::{BufferObject, Device as GbmDevice};
use nix;
use nix::sys::stat::{self, dev_t, fstat};
use std::cell::RefCell;
use std::collections::HashMap;
use std::hash::{Hash, Hasher};
use std::io::Error as IoError;
use std::os::unix::io::{AsRawFd, RawFd};
use std::path::PathBuf;
use std::rc::{Rc, Weak};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Once, ONCE_INIT};
use std::time::Duration;
use nix::{
self,
sys::stat::{self, dev_t, fstat},
};
use std::{
cell::RefCell,
collections::HashMap,
hash::{Hash, Hasher},
io::Error as IoError,
os::unix::io::{AsRawFd, RawFd},
path::PathBuf,
rc::{Rc, Weak},
sync::{
atomic::{AtomicBool, Ordering},
Arc, Once, ONCE_INIT,
},
time::Duration,
};
use wayland_server::calloop::generic::{EventedRawFd, Generic};
use wayland_server::calloop::{LoopHandle, Ready, Source};
use wayland_server::Display;
use wayland_server::{
calloop::{
generic::{EventedRawFd, Generic},
LoopHandle, Ready, Source,
},
Display,
};
mod backend;
pub mod error;
pub use self::backend::DrmBackend;
use self::backend::DrmBackendInternal;
use self::error::*;
use self::{backend::DrmBackendInternal, error::*};
static LOAD: Once = ONCE_INIT;

View File

@ -1,8 +1,6 @@
//! EGL context related structs
use super::error::*;
use super::native;
use super::{ffi, EGLSurface, PixelFormat};
use super::{error::*, ffi, native, EGLSurface, PixelFormat};
#[cfg(feature = "backend_drm")]
use drm::control::Device as ControlDevice;
#[cfg(feature = "backend_drm")]
@ -11,14 +9,16 @@ use drm::Device as BasicDevice;
use gbm::Device as GbmDevice;
use nix::libc::{c_int, c_void};
use slog;
use std::ffi::{CStr, CString};
use std::marker::PhantomData;
use std::mem;
use std::ops::{Deref, DerefMut};
#[cfg(feature = "backend_drm")]
use std::os::unix::io::{AsRawFd, RawFd};
use std::ptr;
use std::rc::Rc;
use std::{
ffi::{CStr, CString},
marker::PhantomData,
mem,
ops::{Deref, DerefMut},
ptr,
rc::Rc,
};
/// EGL context for rendering
pub struct EGLContext<B: native::Backend, N: native::NativeDisplay<B>> {

View File

@ -81,8 +81,7 @@ pub mod egl {
}
mod wayland_storage {
use super::FnPtr;
use super::__gl_imports::raw;
use super::{FnPtr, __gl_imports::raw};
pub static mut BindWaylandDisplayWL: FnPtr = FnPtr {
f: super::missing_fn_panic as *const raw::c_void,
is_loaded: false,
@ -99,9 +98,7 @@ pub mod egl {
#[allow(non_snake_case)]
pub mod BindWaylandDisplayWL {
use super::FnPtr;
use super::__gl_imports::raw;
use super::{metaloadfn, wayland_storage};
use super::{FnPtr, __gl_imports::raw, metaloadfn, wayland_storage};
#[inline]
#[allow(dead_code)]
@ -123,9 +120,7 @@ pub mod egl {
#[allow(non_snake_case)]
pub mod UnbindWaylandDisplayWL {
use super::FnPtr;
use super::__gl_imports::raw;
use super::{metaloadfn, wayland_storage};
use super::{FnPtr, __gl_imports::raw, metaloadfn, wayland_storage};
#[inline]
#[allow(dead_code)]
@ -147,9 +142,7 @@ pub mod egl {
#[allow(non_snake_case)]
pub mod QueryWaylandBufferWL {
use super::FnPtr;
use super::__gl_imports::raw;
use super::{metaloadfn, wayland_storage};
use super::{FnPtr, __gl_imports::raw, metaloadfn, wayland_storage};
#[inline]
#[allow(dead_code)]

View File

@ -1,7 +1,6 @@
//! Type safe native types for safe context/surface creation
use super::error::*;
use super::ffi;
use super::{error::*, ffi};
#[cfg(feature = "backend_drm")]
use backend::drm::error::{Error as DrmError, ErrorKind as DrmErrorKind, Result as DrmResult};
#[cfg(feature = "backend_drm")]

View File

@ -1,11 +1,10 @@
//! EGL surface related structs
use super::error::*;
use super::ffi;
use super::native;
use super::{EGLContext, SwapBuffersError};
use std::ops::{Deref, DerefMut};
use std::rc::{Rc, Weak};
use super::{error::*, ffi, native, EGLContext, SwapBuffersError};
use std::{
ops::{Deref, DerefMut},
rc::{Rc, Weak},
};
/// EGL surface of a given egl context for rendering
pub struct EGLSurface<N: native::NativeSurface> {

View File

@ -10,14 +10,20 @@
//! You may then use the resulting `EGLDisplay` to recieve `EGLImages` of an egl-based `WlBuffer`
//! for rendering.
use backend::graphics::egl::error::*;
use backend::graphics::egl::ffi::egl::types::EGLImage;
use backend::graphics::egl::{ffi, native, EGLContext, EglExtensionNotSupportedError};
use backend::graphics::egl::{
error::*,
ffi::{self, egl::types::EGLImage},
native, EGLContext, EglExtensionNotSupportedError,
};
use nix::libc::c_uint;
use std::fmt;
use std::rc::{Rc, Weak};
use wayland_server::protocol::wl_buffer::{self, WlBuffer};
use wayland_server::{Display, Resource};
use std::{
fmt,
rc::{Rc, Weak},
};
use wayland_server::{
protocol::wl_buffer::{self, WlBuffer},
Display, Resource,
};
use wayland_sys::server::wl_display;
/// Error that can occur when accessing an EGL buffer

View File

@ -1,15 +1,20 @@
//! Glium compatibility module
use backend::graphics::egl::error::Result as EGLResult;
use backend::graphics::egl::wayland::{EGLDisplay, EGLWaylandExtensions};
use backend::graphics::egl::{EGLGraphicsBackend, SwapBuffersError};
use glium::backend::{Backend, Context, Facade};
use glium::debug::DebugCallbackBehavior;
use glium::Frame;
use glium::SwapBuffersError as GliumSwapBuffersError;
use std::cell::{Ref, RefCell, RefMut};
use std::os::raw::c_void;
use std::rc::Rc;
use backend::graphics::egl::{
error::Result as EGLResult,
wayland::{EGLDisplay, EGLWaylandExtensions},
EGLGraphicsBackend, SwapBuffersError,
};
use glium::{
backend::{Backend, Context, Facade},
debug::DebugCallbackBehavior,
Frame, SwapBuffersError as GliumSwapBuffersError,
};
use std::{
cell::{Ref, RefCell, RefMut},
os::raw::c_void,
rc::Rc,
};
use wayland_server::Display;
impl From<SwapBuffersError> for GliumSwapBuffersError {

View File

@ -1,7 +1,6 @@
//! Common traits for input backends to receive input from.
use std::error::Error;
use std::string::ToString;
use std::{error::Error, string::ToString};
/// A seat describes a group of input devices and at least one
/// graphics device belonging together.

View File

@ -1,22 +1,25 @@
//! Implementation of input backend trait for types provided by `libinput`
use backend::input as backend;
use backend::input::Axis;
#[cfg(feature = "backend_session")]
use backend::session::{AsErrno, Session, SessionObserver};
use backend::{input as backend, input::Axis};
use input as libinput;
use input::event;
use std::cell::RefCell;
use std::collections::hash_map::{DefaultHasher, Entry, HashMap};
use std::hash::{Hash, Hasher};
use std::io::Error as IoError;
use std::os::unix::io::RawFd;
use std::path::Path;
use std::rc::Rc;
use std::{
cell::RefCell,
collections::hash_map::{DefaultHasher, Entry, HashMap},
hash::{Hash, Hasher},
io::Error as IoError,
os::unix::io::RawFd,
path::Path,
rc::Rc,
};
use wayland_server::calloop::generic::{EventedRawFd, Generic};
use wayland_server::calloop::{LoopHandle, Ready, Source};
use wayland_server::calloop::{
generic::{EventedRawFd, Generic},
LoopHandle, Ready, Source,
};
// No idea if this is the same across unix platforms
// Lets make this linux exclusive for now, once someone tries to build it for

View File

@ -28,16 +28,14 @@
//! automatically by the `UdevBackend`, if not done manually).
//! ```
use super::direct::{self, direct_session_bind, BoundDirectSession, DirectSession, DirectSessionNotifier};
#[cfg(feature = "backend_session_logind")]
use super::logind::{self, logind_session_bind, BoundLogindSession, LogindSession, LogindSessionNotifier};
use super::{AsErrno, AsSessionObserver, Session, SessionNotifier, SessionObserver};
use super::{
direct::{self, direct_session_bind, BoundDirectSession, DirectSession, DirectSessionNotifier},
AsErrno, AsSessionObserver, Session, SessionNotifier, SessionObserver,
};
use nix::fcntl::OFlag;
use std::cell::RefCell;
use std::io::Error as IoError;
use std::os::unix::io::RawFd;
use std::path::Path;
use std::rc::Rc;
use std::{cell::RefCell, io::Error as IoError, os::unix::io::RawFd, path::Path, rc::Rc};
use wayland_server::calloop::LoopHandle;

View File

@ -35,18 +35,24 @@ use dbus::{
BusName, BusType, Connection, ConnectionItem, ConnectionItems, Interface, Member, Message, MessageItem,
OwnedFd, Path as DbusPath, Watch, WatchEvent,
};
use nix::fcntl::OFlag;
use nix::sys::stat::{fstat, major, minor, stat};
use std::cell::RefCell;
use std::io::Error as IoError;
use std::os::unix::io::RawFd;
use std::path::Path;
use std::rc::{Rc, Weak};
use std::sync::atomic::{AtomicBool, Ordering};
use nix::{
fcntl::OFlag,
sys::stat::{fstat, major, minor, stat},
};
use std::{
cell::RefCell,
io::Error as IoError,
os::unix::io::RawFd,
path::Path,
rc::{Rc, Weak},
sync::atomic::{AtomicBool, Ordering},
};
use systemd::login;
use wayland_server::calloop::generic::{Event, EventedRawFd, Generic};
use wayland_server::calloop::{LoopHandle, Ready, Source};
use wayland_server::calloop::{
generic::{Event, EventedRawFd, Generic},
LoopHandle, Ready, Source,
};
struct LogindSessionImpl {
conn: RefCell<Connection>,

View File

@ -46,23 +46,30 @@
//! automatically by the `UdevBackend`, if not done manually).
use super::{AsErrno, AsSessionObserver, Session, SessionNotifier, SessionObserver};
use nix::fcntl::{self, open, OFlag};
use nix::libc::c_int;
use nix::sys::signal::{self, Signal};
use nix::sys::stat::{dev_t, fstat, major, minor, Mode};
use nix::unistd::{close, dup};
use nix::{Error as NixError, Result as NixResult};
use std::cell::RefCell;
use std::io::Error as IoError;
use std::os::unix::io::RawFd;
use std::path::Path;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use nix::{
fcntl::{self, open, OFlag},
libc::c_int,
sys::{
signal::{self, Signal},
stat::{dev_t, fstat, major, minor, Mode},
},
unistd::{close, dup},
Error as NixError, Result as NixResult,
};
use std::{
cell::RefCell,
io::Error as IoError,
os::unix::io::RawFd,
path::Path,
rc::Rc,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
};
#[cfg(feature = "backend_session_udev")]
use udev::Context;
use wayland_server::calloop::signals::Signals;
use wayland_server::calloop::{LoopHandle, Source};
use wayland_server::calloop::{signals::Signals, LoopHandle, Source};
#[allow(dead_code)]
mod tty {

View File

@ -11,11 +11,13 @@
//! - direct - legacy tty / virtual terminal kernel api
//!
use nix::fcntl::OFlag;
use std::cell::RefCell;
use std::os::unix::io::RawFd;
use std::path::Path;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::{
cell::RefCell,
os::unix::io::RawFd,
path::Path,
rc::Rc,
sync::{Arc, Mutex},
};
/// General session interface.
///

View File

@ -9,24 +9,28 @@
//! See also `examples/udev.rs` for pure hardware backed example of a compositor utilizing this
//! backend.
use backend::drm::{drm_device_bind, DrmDevice, DrmHandler};
use backend::session::{AsSessionObserver, Session, SessionObserver};
use drm::control::Device as ControlDevice;
use drm::Device as BasicDevice;
use nix::fcntl;
use nix::sys::stat::dev_t;
use std::cell::RefCell;
use std::collections::HashMap;
use std::ffi::OsString;
use std::io::Error as IoError;
use std::mem::drop;
use std::os::unix::io::{AsRawFd, RawFd};
use std::path::{Path, PathBuf};
use std::rc::{Rc, Weak};
use backend::{
drm::{drm_device_bind, DrmDevice, DrmHandler},
session::{AsSessionObserver, Session, SessionObserver},
};
use drm::{control::Device as ControlDevice, Device as BasicDevice};
use nix::{fcntl, sys::stat::dev_t};
use std::{
cell::RefCell,
collections::HashMap,
ffi::OsString,
io::Error as IoError,
mem::drop,
os::unix::io::{AsRawFd, RawFd},
path::{Path, PathBuf},
rc::{Rc, Weak},
};
use udev::{Context, Enumerator, Event, EventType, MonitorBuilder, MonitorSocket, Result as UdevResult};
use wayland_server::calloop::generic::{EventedRawFd, Generic};
use wayland_server::calloop::{LoopHandle, Ready, Source};
use wayland_server::calloop::{
generic::{EventedRawFd, Generic},
LoopHandle, Ready, Source,
};
/// Udev's `DrmDevice` type based on the underlying session
pub struct SessionFdDrmDevice(RawFd);

View File

@ -1,28 +1,30 @@
//! Implementation of backend traits for types provided by `winit`
use backend::graphics::egl::context::GlAttributes;
use backend::graphics::egl::error as egl_error;
use backend::graphics::egl::error::Result as EGLResult;
use backend::graphics::egl::native;
use backend::graphics::egl::wayland::{EGLDisplay, EGLWaylandExtensions};
use backend::graphics::egl::{EGLContext, EGLGraphicsBackend, EGLSurface, PixelFormat, SwapBuffersError};
use backend::graphics::GraphicsBackend;
use backend::input::{
use backend::{
graphics::{
egl::{
context::GlAttributes,
error as egl_error,
error::Result as EGLResult,
native,
wayland::{EGLDisplay, EGLWaylandExtensions},
EGLContext, EGLGraphicsBackend, EGLSurface, PixelFormat, SwapBuffersError,
},
GraphicsBackend,
},
input::{
Axis, AxisSource, Event as BackendEvent, InputBackend, InputHandler, KeyState, KeyboardKeyEvent,
MouseButton, MouseButtonState, PointerAxisEvent, PointerButtonEvent, PointerMotionAbsoluteEvent, Seat,
SeatCapabilities, TouchCancelEvent, TouchDownEvent, TouchMotionEvent, TouchSlot, TouchUpEvent,
MouseButton, MouseButtonState, PointerAxisEvent, PointerButtonEvent, PointerMotionAbsoluteEvent,
Seat, SeatCapabilities, TouchCancelEvent, TouchDownEvent, TouchMotionEvent, TouchSlot, TouchUpEvent,
UnusedEvent,
},
};
use nix::libc::c_void;
use std::cmp;
use std::error;
use std::fmt;
use std::rc::Rc;
use std::time::Instant;
use std::{cmp, error, fmt, rc::Rc, time::Instant};
use wayland_client::egl as wegl;
use wayland_server::Display;
use winit::dpi::{LogicalPosition, LogicalSize};
use winit::{
dpi::{LogicalPosition, LogicalSize},
ElementState, Event, EventsLoop, KeyboardInput, MouseButton as WinitMouseButton, MouseCursor,
MouseScrollDelta, Touch, TouchPhase, Window as WinitWindow, WindowBuilder, WindowEvent,
};

View File

@ -1,12 +1,12 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::Mutex;
use std::{cell::RefCell, rc::Rc, sync::Mutex};
use wayland_server::protocol::{wl_compositor, wl_region, wl_subcompositor, wl_subsurface, wl_surface};
use wayland_server::{DisplayToken, NewResource, Resource};
use wayland_server::{
protocol::{wl_compositor, wl_region, wl_subcompositor, wl_subsurface, wl_surface},
DisplayToken, NewResource, Resource,
};
use super::tree::{Location, SurfaceData};
use super::{
tree::{Location, SurfaceData},
CompositorToken, Damage, Rectangle, RectangleKind, RegionAttributes, Role, RoleType, SubsurfaceRole,
SurfaceEvent,
};

View File

@ -76,23 +76,24 @@
//! This `CompositorToken` also provides access to the metadata associated with the role of the
//! surfaces. See the documentation of the `roles` submodule for a detailed explanation.
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::Mutex;
use std::{cell::RefCell, rc::Rc, sync::Mutex};
mod handlers;
pub mod roles;
mod tree;
use self::roles::{Role, RoleType, WrongRole};
use self::tree::SurfaceData;
pub use self::tree::TraversalAction;
use utils::Rectangle;
use wayland_server::protocol::wl_surface::WlSurface;
use wayland_server::protocol::{
wl_buffer, wl_callback, wl_compositor, wl_output, wl_region, wl_subcompositor,
use self::{
roles::{Role, RoleType, WrongRole},
tree::SurfaceData,
};
use utils::Rectangle;
use wayland_server::{
protocol::{
wl_buffer, wl_callback, wl_compositor, wl_output, wl_region, wl_subcompositor, wl_surface::WlSurface,
},
Display, Global, NewResource, Resource,
};
use wayland_server::{Display, Global, NewResource, Resource};
/// Description of which part of a surface
/// should be considered damaged and needs to be redrawn

View File

@ -1,8 +1,6 @@
use super::roles::*;
use super::{SubsurfaceRole, SurfaceAttributes};
use super::{roles::*, SubsurfaceRole, SurfaceAttributes};
use std::sync::Mutex;
use wayland_server::protocol::wl_surface::WlSurface;
use wayland_server::Resource;
use wayland_server::{protocol::wl_surface::WlSurface, Resource};
/// Node of a subsurface tree, holding some user specified data type U
/// at each node

View File

@ -53,9 +53,11 @@
use std::sync::{Arc, Mutex};
use wayland_server::protocol::wl_output::{Event, Mode as WMode, Request, WlOutput};
pub use wayland_server::protocol::wl_output::{Subpixel, Transform};
use wayland_server::{Display, Global, NewResource, Resource};
use wayland_server::{
protocol::wl_output::{Event, Mode as WMode, Request, WlOutput},
Display, Global, NewResource, Resource,
};
/// An output mode
///

View File

@ -1,14 +1,18 @@
use backend::input::KeyState;
use std::default::Default;
use std::io::{Error as IoError, Write};
use std::os::unix::io::AsRawFd;
use std::sync::{Arc, Mutex};
use tempfile::tempfile;
use wayland_server::protocol::wl_keyboard::{
Event, KeyState as WlKeyState, KeymapFormat, Request, WlKeyboard,
use std::{
default::Default,
io::{Error as IoError, Write},
os::unix::io::AsRawFd,
sync::{Arc, Mutex},
};
use tempfile::tempfile;
use wayland_server::{
protocol::{
wl_keyboard::{Event, KeyState as WlKeyState, KeymapFormat, Request, WlKeyboard},
wl_surface::WlSurface,
},
NewResource, Resource,
};
use wayland_server::protocol::wl_surface::WlSurface;
use wayland_server::{NewResource, Resource};
use xkbcommon::xkb;
pub use xkbcommon::xkb::{keysyms, Keysym};

View File

@ -59,12 +59,11 @@ use std::sync::{Arc, Mutex};
mod keyboard;
mod pointer;
pub use self::keyboard::{
keysyms, Error as KeyboardError, KeyboardHandle, Keysym, ModifiersState, XkbConfig,
pub use self::{
keyboard::{keysyms, Error as KeyboardError, KeyboardHandle, Keysym, ModifiersState, XkbConfig},
pointer::{PointerAxisHandle, PointerHandle},
};
pub use self::pointer::{PointerAxisHandle, PointerHandle};
use wayland_server::protocol::wl_seat;
use wayland_server::{Display, Global, NewResource, Resource};
use wayland_server::{protocol::wl_seat, Display, Global, NewResource, Resource};
struct Inner {
log: ::slog::Logger,

View File

@ -1,7 +1,11 @@
use std::sync::{Arc, Mutex, MutexGuard};
use wayland_server::protocol::wl_pointer::{Axis, AxisSource, ButtonState, Event, Request, WlPointer};
use wayland_server::protocol::wl_surface::WlSurface;
use wayland_server::{NewResource, Resource};
use wayland_server::{
protocol::{
wl_pointer::{Axis, AxisSource, ButtonState, Event, Request, WlPointer},
wl_surface::WlSurface,
},
NewResource, Resource,
};
// TODO: handle pointer surface role

View File

@ -70,15 +70,18 @@
//! # }
//! ```
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::{
cell::RefCell,
rc::Rc,
sync::{Arc, Mutex},
};
use wayland::compositor::roles::Role;
use wayland::compositor::CompositorToken;
use wayland::compositor::{roles::Role, CompositorToken};
use wayland_server::protocol::{wl_output, wl_seat, wl_shell, wl_shell_surface, wl_surface};
use wayland_server::{Display, Global, Resource};
use wayland_server::{
protocol::{wl_output, wl_seat, wl_shell, wl_shell_surface, wl_surface},
Display, Global, Resource,
};
mod wl_handlers;

View File

@ -1,12 +1,15 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::{
cell::RefCell,
rc::Rc,
sync::{Arc, Mutex},
};
use wayland_server::protocol::{wl_shell, wl_shell_surface, wl_surface};
use wayland_server::{DisplayToken, NewResource, Resource};
use wayland_server::{
protocol::{wl_shell, wl_shell_surface, wl_surface},
DisplayToken, NewResource, Resource,
};
use wayland::compositor::roles::Role;
use wayland::compositor::CompositorToken;
use wayland::compositor::{roles::Role, CompositorToken};
use super::{ShellRequest, ShellState, ShellSurface, ShellSurfaceKind, ShellSurfaceRole};

View File

@ -85,20 +85,21 @@
//! the subhandler you provided, or via methods on the `ShellState` that you are given
//! (in an `Arc<Mutex<_>>`) as return value of the init function.
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::{
cell::RefCell,
rc::Rc,
sync::{Arc, Mutex},
};
use utils::Rectangle;
use wayland::compositor::roles::Role;
use wayland::compositor::CompositorToken;
use wayland_protocols::unstable::xdg_shell::v6::server::{
zxdg_popup_v6, zxdg_shell_v6, zxdg_surface_v6, zxdg_toplevel_v6,
use wayland::compositor::{roles::Role, CompositorToken};
use wayland_protocols::{
unstable::xdg_shell::v6::server::{zxdg_popup_v6, zxdg_shell_v6, zxdg_surface_v6, zxdg_toplevel_v6},
xdg_shell::server::{xdg_popup, xdg_positioner, xdg_surface, xdg_toplevel, xdg_wm_base},
};
use wayland_protocols::xdg_shell::server::{
xdg_popup, xdg_positioner, xdg_surface, xdg_toplevel, xdg_wm_base,
use wayland_server::{
protocol::{wl_output, wl_seat, wl_surface},
Display, DisplayToken, Global, Resource,
};
use wayland_server::protocol::{wl_output, wl_seat, wl_surface};
use wayland_server::{Display, DisplayToken, Global, Resource};
// handlers for the xdg_shell protocol
mod xdg_handlers;

View File

@ -1,13 +1,10 @@
use std::cell::RefCell;
use std::sync::Mutex;
use std::{cell::RefCell, sync::Mutex};
use wayland::compositor::roles::*;
use wayland::compositor::CompositorToken;
use wayland::compositor::{roles::*, CompositorToken};
use wayland_protocols::xdg_shell::server::{
xdg_popup, xdg_positioner, xdg_surface, xdg_toplevel, xdg_wm_base,
};
use wayland_server::protocol::wl_surface;
use wayland_server::{DisplayToken, NewResource, Resource};
use wayland_server::{protocol::wl_surface, DisplayToken, NewResource, Resource};
use utils::Rectangle;

View File

@ -1,14 +1,13 @@
use std::cell::RefCell;
use std::sync::Mutex;
use std::{cell::RefCell, sync::Mutex};
use wayland::compositor::roles::*;
use wayland::compositor::CompositorToken;
use wayland_protocols::unstable::xdg_shell::v6::server::{
use wayland::compositor::{roles::*, CompositorToken};
use wayland_protocols::{
unstable::xdg_shell::v6::server::{
zxdg_popup_v6, zxdg_positioner_v6, zxdg_shell_v6, zxdg_surface_v6, zxdg_toplevel_v6,
},
xdg_shell::server::{xdg_positioner, xdg_toplevel},
};
use wayland_protocols::xdg_shell::server::{xdg_positioner, xdg_toplevel};
use wayland_server::protocol::wl_surface;
use wayland_server::{DisplayToken, NewResource, Resource};
use wayland_server::{protocol::wl_surface, DisplayToken, NewResource, Resource};
use utils::Rectangle;

View File

@ -78,10 +78,11 @@
//! If you are already using an handler for this signal, you probably don't want to use this handler.
use self::pool::{Pool, ResizeError};
use std::rc::Rc;
use std::sync::Arc;
use wayland_server::protocol::{wl_buffer, wl_shm, wl_shm_pool};
use wayland_server::{Display, DisplayToken, Global, NewResource, Resource};
use std::{rc::Rc, sync::Arc};
use wayland_server::{
protocol::{wl_buffer, wl_shm, wl_shm_pool},
Display, DisplayToken, Global, NewResource, Resource,
};
mod pool;

View File

@ -1,10 +1,17 @@
use nix::sys::mman;
use nix::sys::signal::{self, SigAction, SigHandler, Signal};
use nix::{libc, unistd};
use std::cell::Cell;
use std::os::unix::io::RawFd;
use std::ptr;
use std::sync::{Once, RwLock, ONCE_INIT};
use nix::{
libc,
sys::{
mman,
signal::{self, SigAction, SigHandler, Signal},
},
unistd,
};
use std::{
cell::Cell,
os::unix::io::RawFd,
ptr,
sync::{Once, RwLock, ONCE_INIT},
};
thread_local!(static SIGBUS_GUARD: Cell<(*const MemMap, bool)> = Cell::new((ptr::null_mut(), false)));

View File

@ -1,10 +1,9 @@
use std::io::{Read, Write};
use std::os::unix::io::FromRawFd;
use std::os::unix::net::UnixStream;
use std::{
io::{Read, Write},
os::unix::{io::FromRawFd, net::UnixStream},
};
use nix::errno::Errno;
use nix::sys::socket;
use nix::{Error as NixError, Result as NixResult};
use nix::{errno::Errno, sys::socket, Error as NixError, Result as NixResult};
/// Find a free X11 display slot and setup
pub(crate) fn prepare_x11_sockets(log: ::slog::Logger) -> Result<(X11Lock, [UnixStream; 2]), ()> {

View File

@ -24,21 +24,31 @@
* cf https://github.com/swaywm/wlroots/blob/master/xwayland/xwayland.c
*
*/
use std::cell::RefCell;
use std::env;
use std::ffi::CString;
use std::os::unix::io::{AsRawFd, IntoRawFd};
use std::os::unix::net::UnixStream;
use std::rc::Rc;
use std::{
cell::RefCell,
env,
ffi::CString,
os::unix::{
io::{AsRawFd, IntoRawFd},
net::UnixStream,
},
rc::Rc,
};
use nix::errno::Errno;
use nix::sys::signal;
use nix::unistd::{fork, ForkResult, Pid};
use nix::{Error as NixError, Result as NixResult};
use nix::{
errno::Errno,
sys::signal,
unistd::{fork, ForkResult, Pid},
Error as NixError, Result as NixResult,
};
use wayland_server::calloop::signals::{Signal, Signals};
use wayland_server::calloop::{LoopHandle, Source};
use wayland_server::{Client, Display};
use wayland_server::{
calloop::{
signals::{Signal, Signals},
LoopHandle, Source,
},
Client, Display,
};
use super::x11_sockets::{prepare_x11_sockets, X11Lock};