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 glium::index::PrimitiveType;
use glium::texture::{MipmapsOption, Texture2d, UncompressedFloatFormat};
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 std::{
cell::{Ref, RefCell},
rc::Rc,
};
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 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 shell::{MyCompositorToken, MyWindowMap};

View File

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

View File

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

View File

@ -1,22 +1,29 @@
use std::cell::RefCell;
use std::fs::{File, OpenOptions};
use std::os::unix::io::AsRawFd;
use std::os::unix::io::RawFd;
use std::rc::Rc;
use std::time::Duration;
use std::{
cell::RefCell,
fs::{File, OpenOptions},
os::unix::io::{AsRawFd, RawFd},
rc::Rc,
time::Duration,
};
use smithay::backend::drm::{drm_device_bind, DrmBackend, DrmDevice, DrmHandler};
use smithay::backend::graphics::egl::wayland::EGLWaylandExtensions;
use smithay::drm::control::connector::{Info as ConnectorInfo, State as ConnectorState};
use smithay::drm::control::crtc;
use smithay::drm::control::encoder::Info as EncoderInfo;
use smithay::drm::control::{Device as ControlDevice, ResourceInfo};
use smithay::drm::result::Error as DrmError;
use smithay::drm::Device as BasicDevice;
use smithay::wayland::compositor::CompositorToken;
use smithay::wayland::shm::init_shm_global;
use smithay::wayland_server::calloop::EventLoop;
use smithay::wayland_server::Display;
use smithay::{
backend::{
drm::{drm_device_bind, DrmBackend, DrmDevice, DrmHandler},
graphics::egl::wayland::EGLWaylandExtensions,
},
drm::{
control::{
connector::{Info as ConnectorInfo, State as ConnectorState},
crtc,
encoder::Info as EncoderInfo,
Device as ControlDevice, ResourceInfo,
},
result::Error as DrmError,
Device as BasicDevice,
},
wayland::{compositor::CompositorToken, shm::init_shm_global},
wayland_server::{calloop::EventLoop, Display},
};
use glium::Surface;
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();
// 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
.unwrap_or_else(||
*res_handles.filter_crtcs(encoder_info.possible_crtcs())
.unwrap_or_else(|| {
*res_handles
.filter_crtcs(encoder_info.possible_crtcs())
.iter()
.next()
.unwrap());
.unwrap()
});
// 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.)

View File

@ -1,19 +1,29 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::{
cell::RefCell,
rc::Rc,
sync::{Arc, Mutex},
};
use rand;
use smithay::wayland::compositor::{compositor_init, CompositorToken, SurfaceAttributes, SurfaceEvent};
use smithay::wayland::shell::legacy::{
use smithay::{
wayland::{
compositor::{compositor_init, CompositorToken, SurfaceAttributes, SurfaceEvent},
shell::{
legacy::{
wl_shell_init, ShellRequest, ShellState as WlShellState, ShellSurfaceKind, ShellSurfaceRole,
};
use smithay::wayland::shell::xdg::{
},
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_server::protocol::{wl_buffer, wl_callback, wl_shell_surface, wl_surface};
use smithay::wayland_server::{Display, Resource};
use window_map::{Kind as SurfaceKind, WindowMap};

View File

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

View File

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

View File

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

View File

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