summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-06-08 02:09:07 +0000
committerGitHub <noreply@github.com>2020-06-08 02:09:07 +0000
commit3c7a9601210cf5c982737d838b60b62f0ce1c9f0 (patch)
tree74c077e4d279823cce79b63dcc8fa24be899e1ea
parent3233ede028647cede40c661a35507fc7baf22b21 (diff)
downloadalacritty-3c7a9601210cf5c982737d838b60b62f0ce1c9f0.tar.gz
alacritty-3c7a9601210cf5c982737d838b60b62f0ce1c9f0.zip
Cleanup window.rs imports
The window.rs imports have been extremely messy due to heavy platform-specific import usage. While some of them are just stray imports for a single platform, a lot of these are specific to Linux/BSD. To make these a little easier to read and maintain, the Linux/BSD specific imports were grouped together, since this allows us to just have a single platform annotation. Most of our imports follow the order of how relevant and foreign these imports are to Alacritty, putting our own frequently used imports at the far bottom and STD with things people usually don't need to care about at the top. Since platform specific imports are generally important to fewer people, I've decided to put them before all the other imports rather than behind them.
-rw-r--r--alacritty/src/window.rs45
1 files changed, 19 insertions, 26 deletions
diff --git a/alacritty/src/window.rs b/alacritty/src/window.rs
index 49eaba00..22e84780 100644
--- a/alacritty/src/window.rs
+++ b/alacritty/src/window.rs
@@ -1,37 +1,38 @@
-use std::convert::From;
+#[rustfmt::skip]
#[cfg(not(any(target_os = "macos", windows)))]
-use std::ffi::c_void;
+use {
+ std::ffi::c_void,
+ std::os::raw::c_ulong,
+ std::sync::atomic::AtomicBool,
+ std::sync::Arc,
+
+ glutin::platform::unix::{EventLoopWindowTargetExtUnix, WindowBuilderExtUnix, WindowExtUnix},
+ image::ImageFormat,
+ log::error,
+ wayland_client::protocol::wl_surface::WlSurface,
+ wayland_client::{Attached, EventQueue, Proxy},
+ x11_dl::xlib::{Display as XDisplay, PropModeReplace, XErrorEvent, Xlib},
+
+ alacritty_terminal::config::Colors,
+
+ crate::wayland_theme::AlacrittyWaylandTheme,
+};
+
use std::fmt::{self, Display, Formatter};
-#[cfg(not(any(target_os = "macos", windows)))]
-use std::os::raw::c_ulong;
-#[cfg(not(any(target_os = "macos", windows)))]
-use std::sync::atomic::AtomicBool;
-#[cfg(not(any(target_os = "macos", windows)))]
-use std::sync::Arc;
use glutin::dpi::{PhysicalPosition, PhysicalSize};
use glutin::event_loop::EventLoop;
#[cfg(target_os = "macos")]
use glutin::platform::macos::{RequestUserAttentionType, WindowBuilderExtMacOS, WindowExtMacOS};
-#[cfg(not(any(target_os = "macos", windows)))]
-use glutin::platform::unix::{EventLoopWindowTargetExtUnix, WindowBuilderExtUnix, WindowExtUnix};
#[cfg(windows)]
use glutin::platform::windows::IconExtWindows;
#[cfg(not(target_os = "macos"))]
use glutin::window::Icon;
use glutin::window::{CursorIcon, Fullscreen, Window as GlutinWindow, WindowBuilder, WindowId};
use glutin::{self, ContextBuilder, PossiblyCurrent, WindowedContext};
-#[cfg(not(any(target_os = "macos", windows)))]
-use image::ImageFormat;
-#[cfg(not(any(target_os = "macos", windows)))]
-use log::error;
#[cfg(windows)]
use winapi::shared::minwindef::WORD;
-#[cfg(not(any(target_os = "macos", windows)))]
-use x11_dl::xlib::{Display as XDisplay, PropModeReplace, XErrorEvent, Xlib};
-#[cfg(not(any(target_os = "macos", windows)))]
-use alacritty_terminal::config::Colors;
use alacritty_terminal::config::{Decorations, StartupMode, WindowConfig};
use alacritty_terminal::event::Event;
#[cfg(not(windows))]
@@ -39,14 +40,6 @@ use alacritty_terminal::term::{SizeInfo, Term};
use crate::config::Config;
use crate::gl;
-#[cfg(not(any(target_os = "macos", windows)))]
-use crate::wayland_theme::AlacrittyWaylandTheme;
-
-#[cfg(not(any(target_os = "macos", windows)))]
-use wayland_client::{Attached, EventQueue, Proxy};
-
-#[cfg(not(any(target_os = "macos", windows)))]
-use wayland_client::protocol::wl_surface::WlSurface;
// It's required to be in this directory due to the `windows.rc` file.
#[cfg(not(any(target_os = "macos", windows)))]