anvil: Use nested imports

This commit is contained in:
Jonas Platte 2018-10-02 23:37:24 +02:00 committed by Victor Berger
parent 943f02b447
commit 850ff6983a
9 changed files with 175 additions and 121 deletions

View File

@ -1,24 +1,32 @@
use glium; use std::{
use glium::index::PrimitiveType; cell::{Ref, RefCell},
use glium::texture::{MipmapsOption, Texture2d, UncompressedFloatFormat}; rc::Rc,
use glium::{Frame, GlObject, Surface};
use smithay::backend::graphics::egl::error::Result as EGLResult;
use smithay::backend::graphics::egl::wayland::{
BufferAccessError, EGLDisplay, EGLImages, EGLWaylandExtensions, Format,
}; };
use smithay::backend::graphics::egl::EGLGraphicsBackend;
use smithay::backend::graphics::glium::GliumGraphicsBackend;
use smithay::wayland::compositor::roles::Role;
use smithay::wayland::compositor::{SubsurfaceRole, TraversalAction};
use smithay::wayland::shm::with_buffer_contents as shm_buffer_contents;
use smithay::wayland_server::protocol::wl_buffer;
use smithay::wayland_server::{Display, Resource};
use std::cell::{Ref, RefCell};
use std::rc::Rc;
use glium::{
self,
index::PrimitiveType,
texture::{MipmapsOption, Texture2d, UncompressedFloatFormat},
Frame, GlObject, Surface,
};
use slog::Logger; use slog::Logger;
use smithay::{
backend::graphics::{
egl::{
error::Result as EGLResult,
wayland::{BufferAccessError, EGLDisplay, EGLImages, EGLWaylandExtensions, Format},
EGLGraphicsBackend,
},
glium::GliumGraphicsBackend,
},
wayland::{
compositor::{roles::Role, SubsurfaceRole, TraversalAction},
shm::with_buffer_contents as shm_buffer_contents,
},
wayland_server::{protocol::wl_buffer, Display, Resource},
};
use shaders; use shaders;
use shell::{MyCompositorToken, MyWindowMap}; use shell::{MyCompositorToken, MyWindowMap};

View File

@ -1,19 +1,25 @@
use std::cell::RefCell; use std::{
use std::process::Command; cell::RefCell,
use std::rc::Rc; process::Command,
use std::sync::atomic::{AtomicBool, Ordering}; rc::Rc,
use std::sync::Arc; sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
};
use slog::Logger; use slog::Logger;
use smithay::backend::input::{
self, Event, InputBackend, InputHandler, KeyState, KeyboardKeyEvent, PointerAxisEvent,
PointerButtonEvent, PointerMotionAbsoluteEvent, PointerMotionEvent,
};
#[cfg(feature = "udev")] #[cfg(feature = "udev")]
use smithay::backend::session::auto::AutoSession; use smithay::backend::session::auto::AutoSession;
use smithay::wayland::seat::{keysyms as xkb, KeyboardHandle, Keysym, ModifiersState, PointerHandle}; use smithay::{
use smithay::wayland_server::protocol::wl_pointer; backend::input::{
self, Event, InputBackend, InputHandler, KeyState, KeyboardKeyEvent, PointerAxisEvent,
PointerButtonEvent, PointerMotionAbsoluteEvent, PointerMotionEvent,
},
wayland::seat::{keysyms as xkb, KeyboardHandle, Keysym, ModifiersState, PointerHandle},
wayland_server::protocol::wl_pointer,
};
use shell::MyWindowMap; use shell::MyWindowMap;

View File

@ -10,8 +10,7 @@ extern crate smithay;
extern crate xkbcommon; extern crate xkbcommon;
use slog::Drain; use slog::Drain;
use smithay::wayland_server::calloop::EventLoop; use smithay::wayland_server::{calloop::EventLoop, Display};
use smithay::wayland_server::Display;
#[macro_use] #[macro_use]
mod shaders; mod shaders;

View File

@ -1,22 +1,29 @@
use std::cell::RefCell; use std::{
use std::fs::{File, OpenOptions}; cell::RefCell,
use std::os::unix::io::AsRawFd; fs::{File, OpenOptions},
use std::os::unix::io::RawFd; os::unix::io::{AsRawFd, RawFd},
use std::rc::Rc; rc::Rc,
use std::time::Duration; time::Duration,
};
use smithay::backend::drm::{drm_device_bind, DrmBackend, DrmDevice, DrmHandler}; use smithay::{
use smithay::backend::graphics::egl::wayland::EGLWaylandExtensions; backend::{
use smithay::drm::control::connector::{Info as ConnectorInfo, State as ConnectorState}; drm::{drm_device_bind, DrmBackend, DrmDevice, DrmHandler},
use smithay::drm::control::crtc; graphics::egl::wayland::EGLWaylandExtensions,
use smithay::drm::control::encoder::Info as EncoderInfo; },
use smithay::drm::control::{Device as ControlDevice, ResourceInfo}; drm::{
use smithay::drm::result::Error as DrmError; control::{
use smithay::drm::Device as BasicDevice; connector::{Info as ConnectorInfo, State as ConnectorState},
use smithay::wayland::compositor::CompositorToken; crtc,
use smithay::wayland::shm::init_shm_global; encoder::Info as EncoderInfo,
use smithay::wayland_server::calloop::EventLoop; Device as ControlDevice, ResourceInfo,
use smithay::wayland_server::Display; },
result::Error as DrmError,
Device as BasicDevice,
},
wayland::{compositor::CompositorToken, shm::init_shm_global},
wayland_server::{calloop::EventLoop, Display},
};
use glium::Surface; use glium::Surface;
use slog::Logger; use slog::Logger;
@ -62,13 +69,16 @@ pub fn run_raw_drm(mut display: Display, mut event_loop: EventLoop<()>, log: Log
let encoder_info = EncoderInfo::load_from_device(&device, connector_info.encoders()[0]).unwrap(); let encoder_info = EncoderInfo::load_from_device(&device, connector_info.encoders()[0]).unwrap();
// use the connected crtc if any // use the connected crtc if any
let crtc = encoder_info.current_crtc() let crtc = encoder_info
.current_crtc()
// or use the first one that is compatible with the encoder // or use the first one that is compatible with the encoder
.unwrap_or_else(|| .unwrap_or_else(|| {
*res_handles.filter_crtcs(encoder_info.possible_crtcs()) *res_handles
.iter() .filter_crtcs(encoder_info.possible_crtcs())
.next() .iter()
.unwrap()); .next()
.unwrap()
});
// Assuming we found a good connector and loaded the info into `connector_info` // Assuming we found a good connector and loaded the info into `connector_info`
let mode = connector_info.modes()[0]; // Use first mode (usually highest resoltion, but in reality you should filter and sort and check and match with other connectors, if you use more then one.) let mode = connector_info.modes()[0]; // Use first mode (usually highest resoltion, but in reality you should filter and sort and check and match with other connectors, if you use more then one.)

View File

@ -1,19 +1,29 @@
use std::cell::RefCell; use std::{
use std::rc::Rc; cell::RefCell,
use std::sync::{Arc, Mutex}; rc::Rc,
sync::{Arc, Mutex},
};
use rand; use rand;
use smithay::wayland::compositor::{compositor_init, CompositorToken, SurfaceAttributes, SurfaceEvent}; use smithay::{
use smithay::wayland::shell::legacy::{ wayland::{
wl_shell_init, ShellRequest, ShellState as WlShellState, ShellSurfaceKind, ShellSurfaceRole, compositor::{compositor_init, CompositorToken, SurfaceAttributes, SurfaceEvent},
shell::{
legacy::{
wl_shell_init, ShellRequest, ShellState as WlShellState, ShellSurfaceKind, ShellSurfaceRole,
},
xdg::{
xdg_shell_init, PopupConfigure, ShellState as XdgShellState, ToplevelConfigure, XdgRequest,
XdgSurfaceRole,
},
},
},
wayland_server::{
protocol::{wl_buffer, wl_callback, wl_shell_surface, wl_surface},
Display, Resource,
},
}; };
use smithay::wayland::shell::xdg::{
xdg_shell_init, PopupConfigure, ShellState as XdgShellState, ToplevelConfigure, XdgRequest,
XdgSurfaceRole,
};
use smithay::wayland_server::protocol::{wl_buffer, wl_callback, wl_shell_surface, wl_surface};
use smithay::wayland_server::{Display, Resource};
use window_map::{Kind as SurfaceKind, WindowMap}; use window_map::{Kind as SurfaceKind, WindowMap};

View File

@ -1,7 +1,6 @@
use std::borrow::Cow; use std::borrow::Cow;
use smithay::wayland::shm::BufferData; use smithay::{wayland::shm::BufferData, wayland_server::protocol::wl_shm::Format};
use smithay::wayland_server::protocol::wl_shm::Format;
use glium::texture::{ClientFormat, RawImage2d}; use glium::texture::{ClientFormat, RawImage2d};

View File

@ -1,39 +1,53 @@
use std::cell::RefCell; use std::{
use std::collections::HashMap; cell::RefCell,
use std::io::Error as IoError; collections::HashMap,
use std::path::PathBuf; io::Error as IoError,
use std::rc::Rc; path::PathBuf,
use std::sync::atomic::{AtomicBool, Ordering}; rc::Rc,
use std::sync::Arc; sync::{
use std::time::Duration; atomic::{AtomicBool, Ordering},
Arc,
},
time::Duration,
};
use glium::Surface; use glium::Surface;
use smithay::image::{ImageBuffer, Rgba};
use slog::Logger; use slog::Logger;
use smithay::backend::drm::{DevPath, DrmBackend, DrmDevice, DrmHandler}; use smithay::{
use smithay::backend::graphics::egl::wayland::{EGLDisplay, EGLWaylandExtensions}; backend::{
use smithay::backend::graphics::GraphicsBackend; drm::{DevPath, DrmBackend, DrmDevice, DrmHandler},
use smithay::backend::input::InputBackend; graphics::{
use smithay::backend::libinput::{libinput_bind, LibinputInputBackend, LibinputSessionInterface}; egl::wayland::{EGLDisplay, EGLWaylandExtensions},
use smithay::backend::session::auto::{auto_session_bind, AutoSession}; GraphicsBackend,
use smithay::backend::session::{Session, SessionNotifier}; },
use smithay::backend::udev::{primary_gpu, udev_backend_bind, SessionFdDrmDevice, UdevBackend, UdevHandler}; input::InputBackend,
use smithay::drm::control::connector::{Info as ConnectorInfo, State as ConnectorState}; libinput::{libinput_bind, LibinputInputBackend, LibinputSessionInterface},
use smithay::drm::control::crtc; session::{
use smithay::drm::control::encoder::Info as EncoderInfo; auto::{auto_session_bind, AutoSession},
use smithay::drm::control::{Device as ControlDevice, ResourceInfo}; Session, SessionNotifier,
use smithay::drm::result::Error as DrmError; },
use smithay::input::Libinput; udev::{primary_gpu, udev_backend_bind, SessionFdDrmDevice, UdevBackend, UdevHandler},
use smithay::wayland::compositor::CompositorToken; },
use smithay::wayland::output::{Mode, Output, PhysicalProperties}; drm::{
use smithay::wayland::seat::{Seat, XkbConfig}; control::{
use smithay::wayland::shm::init_shm_global; connector::{Info as ConnectorInfo, State as ConnectorState},
use smithay::wayland_server::calloop::EventLoop; crtc,
use smithay::wayland_server::protocol::wl_output; encoder::Info as EncoderInfo,
use smithay::wayland_server::Display; Device as ControlDevice, ResourceInfo,
},
result::Error as DrmError,
},
image::{ImageBuffer, Rgba},
input::Libinput,
wayland::{
compositor::CompositorToken,
output::{Mode, Output, PhysicalProperties},
seat::{Seat, XkbConfig},
shm::init_shm_global,
},
wayland_server::{calloop::EventLoop, protocol::wl_output, Display},
};
use glium_drawer::GliumDrawer; use glium_drawer::GliumDrawer;
use input_handler::AnvilInputHandler; use input_handler::AnvilInputHandler;

View File

@ -1,10 +1,14 @@
use smithay::utils::Rectangle; use smithay::{
use smithay::wayland::compositor::roles::Role; utils::Rectangle,
use smithay::wayland::compositor::{CompositorToken, SubsurfaceRole, SurfaceAttributes, TraversalAction}; wayland::{
use smithay::wayland::shell::legacy::{ShellSurface, ShellSurfaceRole}; compositor::{roles::Role, CompositorToken, SubsurfaceRole, SurfaceAttributes, TraversalAction},
use smithay::wayland::shell::xdg::{ToplevelSurface, XdgSurfaceRole}; shell::{
use smithay::wayland_server::protocol::wl_surface; legacy::{ShellSurface, ShellSurfaceRole},
use smithay::wayland_server::Resource; xdg::{ToplevelSurface, XdgSurfaceRole},
},
},
wayland_server::{protocol::wl_surface, Resource},
};
pub enum Kind<U, R, SD, D> { pub enum Kind<U, R, SD, D> {
Xdg(ToplevelSurface<U, R, SD>), Xdg(ToplevelSurface<U, R, SD>),

View File

@ -1,18 +1,22 @@
use std::cell::RefCell; use std::{
use std::rc::Rc; cell::RefCell,
use std::sync::atomic::AtomicBool; rc::Rc,
use std::sync::Arc; sync::{atomic::AtomicBool, Arc},
};
use smithay::backend::graphics::egl::wayland::EGLWaylandExtensions; use smithay::{
use smithay::backend::graphics::egl::EGLGraphicsBackend; backend::{
use smithay::backend::input::InputBackend; graphics::egl::{wayland::EGLWaylandExtensions, EGLGraphicsBackend},
use smithay::backend::winit; input::InputBackend,
use smithay::wayland::output::{Mode, Output, PhysicalProperties}; winit,
use smithay::wayland::seat::{Seat, XkbConfig}; },
use smithay::wayland::shm::init_shm_global; wayland::{
use smithay::wayland_server::calloop::EventLoop; output::{Mode, Output, PhysicalProperties},
use smithay::wayland_server::protocol::wl_output; seat::{Seat, XkbConfig},
use smithay::wayland_server::Display; shm::init_shm_global,
},
wayland_server::{calloop::EventLoop, protocol::wl_output, Display},
};
use slog::Logger; use slog::Logger;