1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 21:32:13 +03:00

migrate wezterm to 2018 edition

This commit is contained in:
Wez Furlong 2019-02-18 23:10:37 -08:00
parent 4c39faffbe
commit 571562351d
18 changed files with 61 additions and 98 deletions

View File

@ -2,6 +2,7 @@
authors = ["Wez Furlong <wez@wezfurlong.org>"]
name = "wezterm"
version = "0.1.0"
edition = "2018"
[dependencies]
bitflags = "~1.0"

View File

@ -8,7 +8,7 @@ use std::io::prelude::*;
use termwiz::hyperlink;
use toml;
use font::FontSystemSelection;
use crate::font::FontSystemSelection;
use term;
use term::color::RgbColor;

View File

@ -1,11 +1,11 @@
//! Systems that use fontconfig and freetype
pub use self::fcwrap::Pattern as FontPattern;
use config::{Config, TextStyle};
use crate::config::{Config, TextStyle};
use crate::font::ftfont::FreeTypeFontImpl;
use crate::font::{fcwrap, ftwrap};
use crate::font::{shape_with_harfbuzz, FallbackIdx, Font, FontSystem, GlyphInfo, NamedFont};
use failure::{self, Error};
use font::ftfont::FreeTypeFontImpl;
use font::{fcwrap, ftwrap};
use font::{shape_with_harfbuzz, FallbackIdx, Font, FontSystem, GlyphInfo, NamedFont};
pub type FontSystemImpl = FontConfigAndFreeType;

View File

@ -1,4 +1,4 @@
use config::{Config, TextStyle};
use crate::config::{Config, TextStyle};
use failure::Error;
use font_loader::system_fonts;

View File

@ -1,9 +1,9 @@
//! Systems using rust native loader and freetype for rasterizing
use config::{Config, TextStyle};
use crate::config::{Config, TextStyle};
use crate::font::fontloader;
use crate::font::ftfont::FreeTypeFontImpl;
use crate::font::{ftwrap, FallbackIdx, Font, FontSystem, GlyphInfo, NamedFont};
use failure::Error;
use font::fontloader;
use font::ftfont::FreeTypeFontImpl;
use font::{ftwrap, FallbackIdx, Font, FontSystem, GlyphInfo, NamedFont};
use unicode_normalization::UnicodeNormalization;
struct NamedFontImpl {

View File

@ -1,9 +1,9 @@
//! Systems using rust native loader and rasterizer
use config::{Config, TextStyle};
use crate::config::{Config, TextStyle};
use crate::font::fontloader;
use crate::font::rtype::RustTypeFontImpl;
use crate::font::{FallbackIdx, Font, FontSystem, GlyphInfo, NamedFont};
use failure::Error;
use font::fontloader;
use font::rtype::RustTypeFontImpl;
use font::{FallbackIdx, Font, FontSystem, GlyphInfo, NamedFont};
use rusttype::{point, Codepoint, ScaledGlyph};
use unicode_normalization::UnicodeNormalization;

View File

@ -1,6 +1,6 @@
use crate::font::system::GlyphInfo;
use crate::font::{ftwrap, Font, FontMetrics, RasterizedGlyph};
use failure::Error;
use font::system::GlyphInfo;
use font::{ftwrap, Font, FontMetrics, RasterizedGlyph};
use std::cell::RefCell;
use std::mem;
use std::slice;

View File

@ -2,8 +2,8 @@
#[cfg(all(unix, not(target_os = "macos")))]
use super::hbwrap as harfbuzz;
use crate::font::{Font, FontMetrics, RasterizedGlyph};
use failure::Error;
use font::{Font, FontMetrics, RasterizedGlyph};
use rusttype::{
point, Codepoint, Font as RTFont, FontCollection, PositionedGlyph, Rect, Scale, VMetrics,
};

View File

@ -17,7 +17,7 @@ use std::cell::{Cell, RefCell};
use std::sync::mpsc;
use std::sync::{Arc, Mutex};
use guiloop::{GuiReceiver, GuiSender};
use crate::guiloop::{GuiReceiver, GuiSender};
pub struct Core {
tx: GuiSender<usize>,

View File

@ -1,17 +1,17 @@
//! Generic system dependent windows via glium+glutin
use super::Child;
use super::MasterPty;
use crate::config::Config;
use crate::failure::Error;
use crate::font::FontConfiguration;
use crate::guiloop::{GuiEventLoop, SessionTerminated};
use crate::opengl::render::Renderer;
use crate::opengl::textureatlas::OutOfTextureSpace;
use crate::Child;
use crate::MasterPty;
use clipboard::{ClipboardContext, ClipboardProvider};
use config::Config;
use failure::Error;
use font::FontConfiguration;
use glium;
use glium::glutin::dpi::{LogicalPosition, LogicalSize};
use glium::glutin::{self, ElementState, MouseCursor};
use guiloop::{GuiEventLoop, SessionTerminated};
use opengl::render::Renderer;
use opengl::textureatlas::OutOfTextureSpace;
use std::io::Write;
use std::rc::Rc;
use term::KeyCode;

View File

@ -9,14 +9,14 @@ use std::rc::Rc;
use std::sync::mpsc::{self, Receiver, Sender, TryRecvError};
use std::thread;
use super::SessionTerminated;
pub use crate::gliumwindows::TerminalWindow;
use crate::guiloop::SessionTerminated;
pub use glium::glutin::WindowId;
pub use gliumwindows::TerminalWindow;
use futurecore;
use gliumwindows;
use crate::futurecore;
use crate::gliumwindows;
#[cfg(unix)]
use sigchld;
use crate::sigchld;
#[derive(Clone)]
pub struct GuiSender<T: Send> {

View File

@ -11,7 +11,7 @@ pub use self::glutinloop::{GuiEventLoop, GuiSender, TerminalWindow, WindowId};
pub use std::sync::mpsc::Receiver as GuiReceiver;
#[cfg(all(unix, not(feature = "force-glutin"), not(target_os = "macos")))]
pub use xwindows::xwin::TerminalWindow;
pub use crate::xwindows::xwin::TerminalWindow;
#[cfg(all(unix, not(feature = "force-glutin"), not(target_os = "macos")))]
mod x11;

View File

@ -1,10 +1,12 @@
use super::SessionTerminated;
use crate::futurecore;
use crate::sigchld;
use crate::xwindows::xwin::TerminalWindow;
use crate::xwindows::Connection;
use failure::Error;
use futurecore;
use mio::unix::EventedFd;
use mio::{Event, Evented, Events, Poll, PollOpt, Ready, Token};
pub use mio_extras::channel::{channel, Receiver as GuiReceiver, Sender as GuiSender};
use sigchld;
use std::cell::RefCell;
use std::collections::HashMap;
use std::io;
@ -13,8 +15,6 @@ use std::rc::Rc;
use std::sync::mpsc::TryRecvError;
use std::time::{Duration, Instant};
use xcb;
use xwindows::xwin::TerminalWindow;
use xwindows::Connection;
#[cfg(all(unix, not(target_os = "macos")))]
pub use xcb::xproto::Window as WindowId;

View File

@ -1,54 +1,15 @@
extern crate clap;
#[cfg(target_os = "macos")]
extern crate core_text;
extern crate directories;
extern crate euclid;
#[macro_use]
extern crate failure;
#[macro_use]
extern crate failure_derive;
#[cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))]
extern crate fontconfig; // from servo-fontconfig
extern crate freetype;
extern crate futures;
extern crate gl;
#[macro_use]
extern crate glium;
#[cfg(unix)]
extern crate harfbuzz_sys;
extern crate libc;
#[cfg(unix)]
extern crate mio;
#[cfg(unix)]
extern crate mio_extras;
extern crate palette;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate clipboard;
extern crate font_loader;
extern crate open;
extern crate rusttype;
extern crate term;
extern crate termwiz;
extern crate toml;
extern crate unicode_normalization;
extern crate unicode_width;
#[macro_use]
pub mod log;
use clap::{App, Arg};
use failure::Error;
#[cfg(all(unix, not(target_os = "macos")))]
extern crate egli;
#[cfg(all(unix, not(target_os = "macos")))]
extern crate x11;
#[cfg(all(unix, not(target_os = "macos")))]
extern crate xcb;
#[cfg(all(unix, not(target_os = "macos")))]
extern crate xcb_util;
#[cfg(all(unix, not(feature = "force-glutin"), not(target_os = "macos")))]
mod xwindows;
@ -63,19 +24,19 @@ mod opengl;
mod gliumwindows;
mod guiloop;
use guiloop::{GuiEventLoop, TerminalWindow};
use crate::guiloop::{GuiEventLoop, TerminalWindow};
mod font;
use font::FontConfiguration;
use crate::font::FontConfiguration;
#[cfg(unix)]
mod pty;
#[cfg(unix)]
pub use pty::{openpty, Child, Command, ExitStatus, MasterPty, SlavePty};
pub use crate::pty::{openpty, Child, Command, ExitStatus, MasterPty, SlavePty};
#[cfg(windows)]
mod winpty;
#[cfg(windows)]
pub use winpty::{openpty, Child, Command, ExitStatus, MasterPty, SlavePty};
pub use crate::winpty::{openpty, Child, Command, ExitStatus, MasterPty, SlavePty};
#[cfg(unix)]
mod sigchld;

View File

@ -1,13 +1,14 @@
//! This module is responsible for rendering a terminal to an OpenGL context
use super::textureatlas::{Atlas, Sprite, SpriteSlice, TEX_SIZE};
use config::TextStyle;
use crate::config::TextStyle;
use crate::font::{FontConfiguration, GlyphInfo};
use euclid;
use failure::{err_msg, Error};
use font::{FontConfiguration, GlyphInfo};
use glium::backend::Facade;
use glium::texture::SrgbTexture2d;
use glium::{self, IndexBuffer, Surface, VertexBuffer};
use glium::{implement_vertex, uniform};
use std::cell::RefCell;
use std::collections::HashMap;
use std::mem;

View File

@ -1,7 +1,7 @@
//! Helper for detecting SIGCHLD
use crate::guiloop::GuiSender;
use failure::Error;
use guiloop::GuiSender;
use libc;
use std::io;
use std::mem;

View File

@ -1,6 +1,16 @@
use failure::Error;
use std::io::{self, Error as IoError, Result as IoResult};
extern crate winapi;
use crate::winpty::winapi::shared::minwindef::DWORD;
use crate::winpty::winapi::shared::winerror::{HRESULT, S_OK};
use crate::winpty::winapi::um::fileapi::{ReadFile, WriteFile};
use crate::winpty::winapi::um::handleapi::*;
use crate::winpty::winapi::um::minwinbase::STILL_ACTIVE;
use crate::winpty::winapi::um::namedpipeapi::CreatePipe;
use crate::winpty::winapi::um::processthreadsapi::*;
use crate::winpty::winapi::um::winbase::EXTENDED_STARTUPINFO_PRESENT;
use crate::winpty::winapi::um::winbase::STARTUPINFOEXW;
use crate::winpty::winapi::um::wincon::COORD;
use std::env;
use std::ffi::{OsStr, OsString};
use std::mem;
@ -10,16 +20,6 @@ use std::os::windows::raw::HANDLE;
use std::path::Path;
use std::ptr;
use std::sync::{Arc, Mutex};
use winpty::winapi::shared::minwindef::DWORD;
use winpty::winapi::shared::winerror::{HRESULT, S_OK};
use winpty::winapi::um::fileapi::{ReadFile, WriteFile};
use winpty::winapi::um::handleapi::*;
use winpty::winapi::um::minwinbase::STILL_ACTIVE;
use winpty::winapi::um::namedpipeapi::CreatePipe;
use winpty::winapi::um::processthreadsapi::*;
use winpty::winapi::um::winbase::EXTENDED_STARTUPINFO_PRESENT;
use winpty::winapi::um::winbase::STARTUPINFOEXW;
use winpty::winapi::um::wincon::COORD;
const PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE: usize = 0x00020016;

View File

@ -3,15 +3,15 @@ use super::super::{get_shell, spawn_window};
use super::super::{Child, Command};
use super::xkeysyms;
use super::{Connection, Window};
use crate::config::Config;
use crate::font::FontConfiguration;
use crate::guiloop::{GuiEventLoop, SessionTerminated, WindowId};
use crate::opengl::textureatlas::OutOfTextureSpace;
use crate::pty;
use crate::pty::MasterPty;
use clipboard::{ClipboardContext, ClipboardProvider};
use config::Config;
use failure::Error;
use font::FontConfiguration;
use futures;
use guiloop::{GuiEventLoop, SessionTerminated, WindowId};
use opengl::textureatlas::OutOfTextureSpace;
use pty;
use pty::MasterPty;
use std::cell::RefCell;
use std::io::{self, Read, Write};
use std::os::unix::io::{AsRawFd, RawFd};