Bump minimum supported Rust version to 1.43.0

This commit is contained in:
Kirill Chibisov 2020-07-28 13:00:55 +03:00 committed by GitHub
parent b7faa9f437
commit 6c4e45f3a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 79 additions and 107 deletions

View File

@ -12,10 +12,10 @@ sources:
tasks: tasks:
- rustup: | - rustup: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal
- 1-41-0: | - 1-43-1: |
$HOME/.cargo/bin/rustup toolchain install --profile minimal 1.41.0 $HOME/.cargo/bin/rustup toolchain install --profile minimal 1.43.1
cd alacritty cd alacritty
$HOME/.cargo/bin/cargo +1.41.0 test $HOME/.cargo/bin/cargo +1.43.1 test
- stable: | - stable: |
cd alacritty cd alacritty
$HOME/.cargo/bin/cargo +stable test $HOME/.cargo/bin/cargo +stable test

View File

@ -13,7 +13,7 @@ os:
- osx - osx
rust: rust:
- 1.41.0 - 1.43.1
- stable - stable
matrix: matrix:
@ -26,18 +26,18 @@ matrix:
- name: "Clippy Linux" - name: "Clippy Linux"
os: linux os: linux
env: CLIPPY=true env: CLIPPY=true
rust: 1.41.0 rust: 1.43.1
- name: "Clippy OSX" - name: "Clippy OSX"
os: osx os: osx
env: CLIPPY=true env: CLIPPY=true
rust: 1.41.0 rust: 1.43.1
- name: "Clippy Windows" - name: "Clippy Windows"
os: windows os: windows
env: CLIPPY=true env: CLIPPY=true
rust: 1.41.0-x86_64-pc-windows-msvc rust: 1.43.1-x86_64-pc-windows-msvc
- name: "Windows 1.41.0" - name: "Windows 1.43.1"
os: windows os: windows
rust: 1.41.0-x86_64-pc-windows-msvc rust: 1.43.1-x86_64-pc-windows-msvc
- name: "Windows Stable" - name: "Windows Stable"
os: windows os: windows
rust: stable-x86_64-pc-windows-msvc rust: stable-x86_64-pc-windows-msvc

View File

@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## 0.6.0-dev ## 0.6.0-dev
### Packaging
- Minimum Rust version has been bumped to 1.43.0
### Added ### Added
- Secondary device attributes escape (`CSI > 0 c`) - Secondary device attributes escape (`CSI > 0 c`)

View File

@ -21,9 +21,6 @@ use std::env;
use std::fs::File; use std::fs::File;
use std::path::Path; use std::path::Path;
#[cfg(windows)]
use embed_resource;
fn main() { fn main() {
let hash = rustc_tools_util::get_commit_hash().unwrap_or_default(); let hash = rustc_tools_util::get_commit_hash().unwrap_or_default();
println!("cargo:rustc-env=GIT_HASH={}", hash); println!("cargo:rustc-env=GIT_HASH={}", hash);

View File

@ -29,15 +29,10 @@ impl Clipboard {
#[cfg(not(any(target_os = "macos", windows)))] #[cfg(not(any(target_os = "macos", windows)))]
pub fn new(_display: Option<*mut c_void>) -> Self { pub fn new(_display: Option<*mut c_void>) -> Self {
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
{ if let Some(display) = _display {
if let Some(display) = _display { let (selection, clipboard) =
let (selection, clipboard) = unsafe { wayland_clipboard::create_clipboards_from_external(display) };
unsafe { wayland_clipboard::create_clipboards_from_external(display) }; return Self { clipboard: Box::new(clipboard), selection: Some(Box::new(selection)) };
return Self {
clipboard: Box::new(clipboard),
selection: Some(Box::new(selection)),
};
}
} }
#[cfg(feature = "x11")] #[cfg(feature = "x11")]

View File

@ -4,8 +4,6 @@ use std::fs;
use std::io; use std::io;
use std::path::PathBuf; use std::path::PathBuf;
#[cfg(windows)]
use dirs;
use log::{error, warn}; use log::{error, warn};
use alacritty_terminal::config::{Config as TermConfig, LOG_TARGET_CONFIG}; use alacritty_terminal::config::{Config as TermConfig, LOG_TARGET_CONFIG};

View File

@ -188,11 +188,9 @@ impl Display {
// Initialize Wayland event queue, to handle Wayland callbacks. // Initialize Wayland event queue, to handle Wayland callbacks.
#[cfg(not(any(target_os = "macos", windows)))] #[cfg(not(any(target_os = "macos", windows)))]
{ if let Some(display) = event_loop.wayland_display() {
if let Some(display) = event_loop.wayland_display() { let display = unsafe { WaylandDisplay::from_external_display(display as _) };
let display = unsafe { WaylandDisplay::from_external_display(display as _) }; wayland_event_queue = Some(display.create_event_queue());
wayland_event_queue = Some(display.create_event_queue());
}
} }
// Create the window where Alacritty will be displayed. // Create the window where Alacritty will be displayed.
@ -271,16 +269,14 @@ impl Display {
#[cfg(not(any(target_os = "macos", windows)))] #[cfg(not(any(target_os = "macos", windows)))]
let is_x11 = event_loop.is_x11(); 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)))] #[cfg(not(any(target_os = "macos", windows)))]
{ if is_x11 {
// On Wayland we can safely ignore this call, since the window isn't visible until you window.swap_buffers();
// actually draw something into it and commit those changes. renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| {
if is_x11 { api.finish();
window.swap_buffers(); });
renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| {
api.finish();
});
}
} }
window.set_visible(true); window.set_visible(true);
@ -608,15 +604,13 @@ impl Display {
self.window.swap_buffers(); self.window.swap_buffers();
#[cfg(not(any(target_os = "macos", windows)))] #[cfg(not(any(target_os = "macos", windows)))]
{ if self.is_x11 {
if self.is_x11 { // On X11 `swap_buffers` does not block for vsync. However the next OpenGl command
// 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
// will block to synchronize (this is `glClear` in Alacritty), which causes a // permanent one frame delay.
// permanent one frame delay. self.renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| {
self.renderer.with_api(&config.ui_config, config.cursor, &size_info, |api| { api.finish();
api.finish(); });
});
}
} }
} }

View File

@ -830,14 +830,10 @@ impl<N: Notify + OnResize> Processor<N> {
self.submit_display_update(&mut terminal, old_is_searching, display_update_pending); 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)))] #[cfg(not(any(target_os = "macos", windows)))]
{ if event_loop.is_wayland() && !self.display.window.should_draw.load(Ordering::Relaxed) {
// Skip rendering on Wayland until we get frame event from compositor. return;
if event_loop.is_wayland()
&& !self.display.window.should_draw.load(Ordering::Relaxed)
{
return;
}
} }
if terminal.dirty { if terminal.dirty {
@ -934,15 +930,13 @@ impl<N: Notify + OnResize> Processor<N> {
match event { match event {
WindowEvent::CloseRequested => processor.ctx.terminal.exit(), WindowEvent::CloseRequested => processor.ctx.terminal.exit(),
WindowEvent::Resized(size) => { 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)] #[cfg(windows)]
{ if size.width == 0 && size.height == 0 {
// Minimizing the window sends a Resize event with zero width and return;
// 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;
}
} }
processor.ctx.display_update_pending.set_dimensions(size); 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)))] #[cfg(not(any(target_os = "macos", windows)))]
{ if processor.ctx.event_loop.is_wayland() {
if processor.ctx.event_loop.is_wayland() { processor.ctx.window.set_wayland_theme(&config.colors);
processor.ctx.window.set_wayland_theme(&config.colors);
}
} }
// Set subpixel anti-aliasing. // Set subpixel anti-aliasing.

View File

@ -15,8 +15,6 @@ use std::fs;
use std::io::{self, Write}; use std::io::{self, Write};
use std::sync::Arc; use std::sync::Arc;
#[cfg(target_os = "macos")]
use dirs;
use glutin::event_loop::EventLoop as GlutinEventLoop; use glutin::event_loop::EventLoop as GlutinEventLoop;
use log::{error, info}; use log::{error, info};
#[cfg(windows)] #[cfg(windows)]

View File

@ -176,22 +176,20 @@ impl Window {
let mut wayland_surface = None; let mut wayland_surface = None;
#[cfg(not(any(target_os = "macos", windows)))] #[cfg(not(any(target_os = "macos", windows)))]
{ if event_loop.is_x11() {
if event_loop.is_x11() { // On X11, embed the window inside another if the parent ID has been set.
// On X11, embed the window inside another if the parent ID has been set. if let Some(parent_window_id) = window_config.embed {
if let Some(parent_window_id) = window_config.embed { x_embed_window(windowed_context.window(), parent_window_id);
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()));
} }
} 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 { Ok(Self {

View File

@ -355,26 +355,22 @@ where
|| token == self.pty.write_token() => || token == self.pty.write_token() =>
{ {
#[cfg(unix)] #[cfg(unix)]
{ if UnixReady::from(event.readiness()).is_hup() {
if UnixReady::from(event.readiness()).is_hup() { // Don't try to do I/O on a dead PTY.
// Don't try to do I/O on a dead PTY. continue;
continue;
}
} }
if event.readiness().is_readable() { if event.readiness().is_readable() {
if let Err(err) = self.pty_read(&mut state, &mut buf, pipe.as_mut()) 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")] #[cfg(target_os = "linux")]
{ if err.kind() == ErrorKind::Other {
// On Linux, a `read` on the master side of a PTY can fail continue;
// 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;
}
} }
error!("Error reading from PTY in event loop: {}", err); error!("Error reading from PTY in event loop: {}", err);

View File

@ -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 // Apply cursor color, or invert the cursor if it has a fixed background close
// to the cell's background. // to the cell's background.
match self.cursor.cursor_color { if !matches!(
CellRgb::Rgb(color) if color.contrast(cell.bg) < MIN_CURSOR_CONTRAST => (), self.cursor.cursor_color,
_ => cell.fg = self.cursor.cursor_color.color(cell.fg, cell.bg), 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); return Some(cell);

View File

@ -1,6 +1,7 @@
//! TTY related functionality. //! TTY related functionality.
use std::borrow::Cow; use std::borrow::Cow;
#[cfg(not(target_os = "macos"))]
use std::env; use std::env;
use std::ffi::CStr; use std::ffi::CStr;
use std::fs::File; 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()); let (master, slave) = make_pty(size.to_winsize());
#[cfg(any(target_os = "linux", target_os = "macos"))] #[cfg(any(target_os = "linux", target_os = "macos"))]
{ if let Ok(mut termios) = termios::tcgetattr(master) {
if let Ok(mut termios) = termios::tcgetattr(master) { // Set character encoding to UTF-8.
// Set character encoding to UTF-8. termios.input_flags.set(InputFlags::IUTF8, true);
termios.input_flags.set(InputFlags::IUTF8, true); let _ = termios::tcsetattr(master, SetArg::TCSANOW, &termios);
let _ = termios::tcsetattr(master, SetArg::TCSANOW, &termios);
}
} }
let mut buf = [0; 1024]; let mut buf = [0; 1024];

View File

@ -5,7 +5,6 @@ use std::os::windows::io::IntoRawHandle;
use std::ptr; use std::ptr;
use mio_anonymous_pipes::{EventedAnonRead, EventedAnonWrite}; use mio_anonymous_pipes::{EventedAnonRead, EventedAnonWrite};
use miow;
use winapi::shared::basetsd::{PSIZE_T, SIZE_T}; use winapi::shared::basetsd::{PSIZE_T, SIZE_T};
use winapi::shared::minwindef::{BYTE, DWORD}; use winapi::shared::minwindef::{BYTE, DWORD};
use winapi::shared::ntdef::{HANDLE, HRESULT, LPWSTR}; use winapi::shared::ntdef::{HANDLE, HRESULT, LPWSTR};

View File

@ -34,7 +34,7 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) ->
SpawnFlags::AUTO_SHUTDOWN | SpawnFlags::EXIT_AFTER_SHUTDOWN, SpawnFlags::AUTO_SHUTDOWN | SpawnFlags::EXIT_AFTER_SHUTDOWN,
None, // appname. None, // appname.
Some(&cmdline), Some(&cmdline),
config.working_directory.as_ref().map(|p| p.as_path()), config.working_directory.as_deref(),
None, // Env. None, // Env.
) )
.unwrap(); .unwrap();