aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2020-07-28 13:00:55 +0300
committerGitHub <noreply@github.com>2020-07-28 13:00:55 +0300
commit6c4e45f3a69c71958e65fae9a15f82d0c5a27742 (patch)
tree311a32b95b705e9cded8fa2c6f06b297586513fe
parentb7faa9f4378cf922c44f53a8003731fb0de13670 (diff)
downloadalacritty-6c4e45f3a69c71958e65fae9a15f82d0c5a27742.tar.gz
alacritty-6c4e45f3a69c71958e65fae9a15f82d0c5a27742.zip
Bump minimum supported Rust version to 1.43.0
-rw-r--r--.builds/freebsd.yml6
-rw-r--r--.travis.yml12
-rw-r--r--CHANGELOG.md4
-rw-r--r--alacritty/build.rs3
-rw-r--r--alacritty/src/clipboard.rs13
-rw-r--r--alacritty/src/config/mod.rs2
-rw-r--r--alacritty/src/display.rs40
-rw-r--r--alacritty/src/event.rs30
-rw-r--r--alacritty/src/main.rs2
-rw-r--r--alacritty/src/window.rs28
-rw-r--r--alacritty_terminal/src/event_loop.rs24
-rw-r--r--alacritty_terminal/src/term/mod.rs8
-rw-r--r--alacritty_terminal/src/tty/unix.rs11
-rw-r--r--alacritty_terminal/src/tty/windows/conpty.rs1
-rw-r--r--alacritty_terminal/src/tty/windows/winpty.rs2
15 files changed, 79 insertions, 107 deletions
diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml
index 65281182..d95b0fb0 100644
--- a/.builds/freebsd.yml
+++ b/.builds/freebsd.yml
@@ -12,10 +12,10 @@ sources:
tasks:
- rustup: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal
- - 1-41-0: |
- $HOME/.cargo/bin/rustup toolchain install --profile minimal 1.41.0
+ - 1-43-1: |
+ $HOME/.cargo/bin/rustup toolchain install --profile minimal 1.43.1
cd alacritty
- $HOME/.cargo/bin/cargo +1.41.0 test
+ $HOME/.cargo/bin/cargo +1.43.1 test
- stable: |
cd alacritty
$HOME/.cargo/bin/cargo +stable test
diff --git a/.travis.yml b/.travis.yml
index b6c28ee7..6e1e125f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,7 +13,7 @@ os:
- osx
rust:
- - 1.41.0
+ - 1.43.1
- stable
matrix:
@@ -26,18 +26,18 @@ matrix:
- name: "Clippy Linux"
os: linux
env: CLIPPY=true
- rust: 1.41.0
+ rust: 1.43.1
- name: "Clippy OSX"
os: osx
env: CLIPPY=true
- rust: 1.41.0
+ rust: 1.43.1
- name: "Clippy Windows"
os: windows
env: CLIPPY=true
- rust: 1.41.0-x86_64-pc-windows-msvc
- - name: "Windows 1.41.0"
+ rust: 1.43.1-x86_64-pc-windows-msvc
+ - name: "Windows 1.43.1"
os: windows
- rust: 1.41.0-x86_64-pc-windows-msvc
+ rust: 1.43.1-x86_64-pc-windows-msvc
- name: "Windows Stable"
os: windows
rust: stable-x86_64-pc-windows-msvc
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a9beb7f..9f8a65a8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## 0.6.0-dev
+### Packaging
+
+- Minimum Rust version has been bumped to 1.43.0
+
### Added
- Secondary device attributes escape (`CSI > 0 c`)
diff --git a/alacritty/build.rs b/alacritty/build.rs
index 05e7bb2d..2cf99cc4 100644
--- a/alacritty/build.rs
+++ b/alacritty/build.rs
@@ -21,9 +21,6 @@ use std::env;
use std::fs::File;
use std::path::Path;
-#[cfg(windows)]
-use embed_resource;
-
fn main() {
let hash = rustc_tools_util::get_commit_hash().unwrap_or_default();
println!("cargo:rustc-env=GIT_HASH={}", hash);
diff --git a/alacritty/src/clipboard.rs b/alacritty/src/clipboard.rs
index df0b1c78..b9708d6f 100644
--- a/alacritty/src/clipboard.rs
+++ b/alacritty/src/clipboard.rs
@@ -29,15 +29,10 @@ impl Clipboard {
#[cfg(not(any(target_os = "macos", windows)))]
pub fn new(_display: Option<*mut c_void>) -> Self {
#[cfg(feature = "wayland")]
- {
- if let Some(display) = _display {
- let (selection, clipboard) =
- unsafe { wayland_clipboard::create_clipboards_from_external(display) };
- return Self {
- clipboard: Box::new(clipboard),
- selection: Some(Box::new(selection)),
- };
- }
+ if let Some(display) = _display {
+ let (selection, clipboard) =
+ unsafe { wayland_clipboard::create_clipboards_from_external(display) };
+ return Self { clipboard: Box::new(clipboard), selection: Some(Box::new(selection)) };
}
#[cfg(feature = "x11")]
diff --git a/alacritty/src/config/mod.rs b/alacritty/src/config/mod.rs
index 7fffcc39..226c6775 100644
--- a/alacritty/src/config/mod.rs
+++ b/alacritty/src/config/mod.rs
@@ -4,8 +4,6 @@ use std::fs;
use std::io;
use std::path::PathBuf;
-#[cfg(windows)]
-use dirs;
use log::{error, warn};
use alacritty_terminal::config::{Config as TermConfig, LOG_TARGET_CONFIG};
diff --git a/alacritty/src/display.rs b/alacritty/src/display.rs
index ad22c852..8fa82338 100644
--- a/alacritty/src/display.rs
+++ b/alacritty/src/display.rs
@@ -188,11 +188,9 @@ impl Display {
// Initialize Wayland event queue, to handle Wayland callbacks.
#[cfg(not(any(target_os = "macos", windows)))]
- {
- if let Some(display) = event_loop.wayland_display() {
- let display = unsafe { WaylandDisplay::from_external_display(display as _) };
- wayland_event_queue = Some(display.create_event_queue());
- }
+ if let Some(display) = event_loop.wayland_display() {
+ let display = unsafe { WaylandDisplay::from_external_display(display as _) };
+ wayland_event_queue = Some(display.create_event_queue());
}
// Create the window where Alacritty will be displayed.
@@ -271,16 +269,14 @@ impl Display {
#[cfg(not(any(target_os = "macos", windows)))]
let is_x11 = event_loop.is_x11();
+ // On Wayland we can safely ignore this call, since the window isn't visible until you
+ // actually draw something into it and commit those changes.
#[cfg(not(any(target_os = "macos", windows)))]
- {
- // On Wayland we can safely ignore this call, since the window isn't visible until you
- // actually draw something into it and commit those changes.
- if is_x11 {
- window.swap_buffers();
- renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| {
- api.finish();
- });
- }
+ if is_x11 {
+ window.swap_buffers();
+ renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| {
+ api.finish();
+ });
}
window.set_visible(true);
@@ -608,15 +604,13 @@ impl Display {
self.window.swap_buffers();
#[cfg(not(any(target_os = "macos", windows)))]
- {
- if self.is_x11 {
- // On X11 `swap_buffers` does not block for vsync. However the next OpenGl command
- // will block to synchronize (this is `glClear` in Alacritty), which causes a
- // permanent one frame delay.
- self.renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| {
- api.finish();
- });
- }
+ if self.is_x11 {
+ // On X11 `swap_buffers` does not block for vsync. However the next OpenGl command
+ // will block to synchronize (this is `glClear` in Alacritty), which causes a
+ // permanent one frame delay.
+ self.renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| {
+ api.finish();
+ });
}
}
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index 803e4398..c30765ae 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -830,14 +830,10 @@ impl<N: Notify + OnResize> Processor<N> {
self.submit_display_update(&mut terminal, old_is_searching, display_update_pending);
}
+ // Skip rendering on Wayland until we get frame event from compositor.
#[cfg(not(any(target_os = "macos", windows)))]
- {
- // Skip rendering on Wayland until we get frame event from compositor.
- if event_loop.is_wayland()
- && !self.display.window.should_draw.load(Ordering::Relaxed)
- {
- return;
- }
+ if event_loop.is_wayland() && !self.display.window.should_draw.load(Ordering::Relaxed) {
+ return;
}
if terminal.dirty {
@@ -934,15 +930,13 @@ impl<N: Notify + OnResize> Processor<N> {
match event {
WindowEvent::CloseRequested => processor.ctx.terminal.exit(),
WindowEvent::Resized(size) => {
+ // Minimizing the window sends a Resize event with zero width and
+ // height. But there's no need to ever actually resize to this.
+ // Both WinPTY & ConPTY have issues when resizing down to zero size
+ // and back.
#[cfg(windows)]
- {
- // Minimizing the window sends a Resize event with zero width and
- // height. But there's no need to ever actually resize to this.
- // Both WinPTY & ConPTY have issues when resizing down to zero size
- // and back.
- if size.width == 0 && size.height == 0 {
- return;
- }
+ if size.width == 0 && size.height == 0 {
+ return;
}
processor.ctx.display_update_pending.set_dimensions(size);
@@ -1091,10 +1085,8 @@ impl<N: Notify + OnResize> Processor<N> {
}
#[cfg(not(any(target_os = "macos", windows)))]
- {
- if processor.ctx.event_loop.is_wayland() {
- processor.ctx.window.set_wayland_theme(&config.colors);
- }
+ if processor.ctx.event_loop.is_wayland() {
+ processor.ctx.window.set_wayland_theme(&config.colors);
}
// Set subpixel anti-aliasing.
diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs
index ae3ef346..e6884204 100644
--- a/alacritty/src/main.rs
+++ b/alacritty/src/main.rs
@@ -15,8 +15,6 @@ use std::fs;
use std::io::{self, Write};
use std::sync::Arc;
-#[cfg(target_os = "macos")]
-use dirs;
use glutin::event_loop::EventLoop as GlutinEventLoop;
use log::{error, info};
#[cfg(windows)]
diff --git a/alacritty/src/window.rs b/alacritty/src/window.rs
index 81a61218..6659a9e0 100644
--- a/alacritty/src/window.rs
+++ b/alacritty/src/window.rs
@@ -176,22 +176,20 @@ impl Window {
let mut wayland_surface = None;
#[cfg(not(any(target_os = "macos", windows)))]
- {
- if event_loop.is_x11() {
- // On X11, embed the window inside another if the parent ID has been set.
- if let Some(parent_window_id) = window_config.embed {
- x_embed_window(windowed_context.window(), parent_window_id);
- }
- } else {
- // Apply client side decorations theme.
- let theme = AlacrittyWaylandTheme::new(&config.colors);
- windowed_context.window().set_wayland_theme(theme);
-
- // Attach surface to Alacritty's internal wayland queue to handle frame callbacks.
- let surface = windowed_context.window().wayland_surface().unwrap();
- let proxy: Proxy<WlSurface> = unsafe { Proxy::from_c_ptr(surface as _) };
- wayland_surface = Some(proxy.attach(wayland_event_queue.as_ref().unwrap().token()));
+ if event_loop.is_x11() {
+ // On X11, embed the window inside another if the parent ID has been set.
+ if let Some(parent_window_id) = window_config.embed {
+ x_embed_window(windowed_context.window(), parent_window_id);
}
+ } else {
+ // Apply client side decorations theme.
+ let theme = AlacrittyWaylandTheme::new(&config.colors);
+ windowed_context.window().set_wayland_theme(theme);
+
+ // Attach surface to Alacritty's internal wayland queue to handle frame callbacks.
+ let surface = windowed_context.window().wayland_surface().unwrap();
+ let proxy: Proxy<WlSurface> = unsafe { Proxy::from_c_ptr(surface as _) };
+ wayland_surface = Some(proxy.attach(wayland_event_queue.as_ref().unwrap().token()));
}
Ok(Self {
diff --git a/alacritty_terminal/src/event_loop.rs b/alacritty_terminal/src/event_loop.rs
index 43e8a302..035c1e73 100644
--- a/alacritty_terminal/src/event_loop.rs
+++ b/alacritty_terminal/src/event_loop.rs
@@ -355,26 +355,22 @@ where
|| token == self.pty.write_token() =>
{
#[cfg(unix)]
- {
- if UnixReady::from(event.readiness()).is_hup() {
- // Don't try to do I/O on a dead PTY.
- continue;
- }
+ if UnixReady::from(event.readiness()).is_hup() {
+ // Don't try to do I/O on a dead PTY.
+ continue;
}
if event.readiness().is_readable() {
if let Err(err) = self.pty_read(&mut state, &mut buf, pipe.as_mut())
{
+ // On Linux, a `read` on the master side of a PTY can fail
+ // with `EIO` if the client side hangs up. In that case,
+ // just loop back round for the inevitable `Exited` event.
+ // This sucks, but checking the process is either racy or
+ // blocking.
#[cfg(target_os = "linux")]
- {
- // On Linux, a `read` on the master side of a PTY can fail
- // with `EIO` if the client side hangs up. In that case,
- // just loop back round for the inevitable `Exited` event.
- // This sucks, but checking the process is either racy or
- // blocking.
- if err.kind() == ErrorKind::Other {
- continue;
- }
+ if err.kind() == ErrorKind::Other {
+ continue;
}
error!("Error reading from PTY in event loop: {}", err);
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index ef61ebdf..7a409e2e 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -425,9 +425,11 @@ impl<'a, C> Iterator for RenderableCellsIter<'a, C> {
// Apply cursor color, or invert the cursor if it has a fixed background close
// to the cell's background.
- match self.cursor.cursor_color {
- CellRgb::Rgb(color) if color.contrast(cell.bg) < MIN_CURSOR_CONTRAST => (),
- _ => cell.fg = self.cursor.cursor_color.color(cell.fg, cell.bg),
+ if !matches!(
+ self.cursor.cursor_color,
+ CellRgb::Rgb(color) if color.contrast(cell.bg) < MIN_CURSOR_CONTRAST
+ ) {
+ cell.fg = self.cursor.cursor_color.color(cell.fg, cell.bg);
}
return Some(cell);
diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs
index b373ada2..3998d9e6 100644
--- a/alacritty_terminal/src/tty/unix.rs
+++ b/alacritty_terminal/src/tty/unix.rs
@@ -1,6 +1,7 @@
//! TTY related functionality.
use std::borrow::Cow;
+#[cfg(not(target_os = "macos"))]
use std::env;
use std::ffi::CStr;
use std::fs::File;
@@ -148,12 +149,10 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, window_id: Option<usize>) ->
let (master, slave) = make_pty(size.to_winsize());
#[cfg(any(target_os = "linux", target_os = "macos"))]
- {
- if let Ok(mut termios) = termios::tcgetattr(master) {
- // Set character encoding to UTF-8.
- termios.input_flags.set(InputFlags::IUTF8, true);
- let _ = termios::tcsetattr(master, SetArg::TCSANOW, &termios);
- }
+ if let Ok(mut termios) = termios::tcgetattr(master) {
+ // Set character encoding to UTF-8.
+ termios.input_flags.set(InputFlags::IUTF8, true);
+ let _ = termios::tcsetattr(master, SetArg::TCSANOW, &termios);
}
let mut buf = [0; 1024];
diff --git a/alacritty_terminal/src/tty/windows/conpty.rs b/alacritty_terminal/src/tty/windows/conpty.rs
index fa9f8b5a..b9748c8b 100644
--- a/alacritty_terminal/src/tty/windows/conpty.rs
+++ b/alacritty_terminal/src/tty/windows/conpty.rs
@@ -5,7 +5,6 @@ use std::os::windows::io::IntoRawHandle;
use std::ptr;
use mio_anonymous_pipes::{EventedAnonRead, EventedAnonWrite};
-use miow;
use winapi::shared::basetsd::{PSIZE_T, SIZE_T};
use winapi::shared::minwindef::{BYTE, DWORD};
use winapi::shared::ntdef::{HANDLE, HRESULT, LPWSTR};
diff --git a/alacritty_terminal/src/tty/windows/winpty.rs b/alacritty_terminal/src/tty/windows/winpty.rs
index 76c4c0b6..f9dd56bb 100644
--- a/alacritty_terminal/src/tty/windows/winpty.rs
+++ b/alacritty_terminal/src/tty/windows/winpty.rs
@@ -34,7 +34,7 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) ->
SpawnFlags::AUTO_SHUTDOWN | SpawnFlags::EXIT_AFTER_SHUTDOWN,
None, // appname.
Some(&cmdline),
- config.working_directory.as_ref().map(|p| p.as_path()),
+ config.working_directory.as_deref(),
None, // Env.
)
.unwrap();