summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <wchibisovkirill@gmail.com>2019-11-23 20:08:52 +0300
committerChristian Duerr <contact@christianduerr.com>2019-11-23 18:08:52 +0100
commit474032742b3bf325e655eb6cddb19632cb989c1a (patch)
tree9ae4ed52a0fe756474329c5c57076690525d511a
parent624b3e2189df93145559ebba96e0a7754845c033 (diff)
downloadalacritty-474032742b3bf325e655eb6cddb19632cb989c1a.tar.gz
alacritty-474032742b3bf325e655eb6cddb19632cb989c1a.zip
Move renderer from alacritty_terminal to alacritty
-rw-r--r--Cargo.lock4
-rw-r--r--alacritty/Cargo.toml2
-rw-r--r--alacritty/build.rs13
-rw-r--r--alacritty/src/cursor.rs (renamed from alacritty_terminal/src/cursor.rs)11
-rw-r--r--alacritty/src/display.rs4
-rw-r--r--alacritty/src/main.rs7
-rw-r--r--alacritty/src/renderer/mod.rs (renamed from alacritty_terminal/src/renderer/mod.rs)17
-rw-r--r--alacritty/src/renderer/rects.rs (renamed from alacritty_terminal/src/renderer/rects.rs)8
-rw-r--r--alacritty/src/url.rs2
-rw-r--r--alacritty/src/window.rs2
-rw-r--r--alacritty_terminal/Cargo.toml5
-rw-r--r--alacritty_terminal/build.rs28
-rw-r--r--alacritty_terminal/src/lib.rs7
-rw-r--r--alacritty_terminal/src/term/mod.rs8
14 files changed, 48 insertions, 70 deletions
diff --git a/Cargo.lock b/Cargo.lock
index bbd7c6c1..3aeb5dfd 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -29,7 +29,9 @@ dependencies = [
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"font 0.1.0",
+ "gl_generator 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin 0.22.0-alpha5 (git+https://github.com/chrisduerr/glutin)",
"image 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -56,9 +58,7 @@ dependencies = [
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"copypasta 0.6.0",
"dunce 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"font 0.1.0",
- "gl_generator 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
index c28f0564..647a35e6 100644
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -14,6 +14,7 @@ clap = "2"
log = "0.4"
time = "0.1.40"
env_logger = "0.7.1"
+fnv = "1"
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.8"
serde_json = "1"
@@ -26,6 +27,7 @@ font = { path = "../font" }
urlocator = "0.1.0"
[build-dependencies]
+gl_generator = "0.14.0"
rustc_tools_util = "0.2.0"
[target.'cfg(not(windows))'.dependencies]
diff --git a/alacritty/build.rs b/alacritty/build.rs
index b39921c0..3c58b0cf 100644
--- a/alacritty/build.rs
+++ b/alacritty/build.rs
@@ -12,7 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+use gl_generator::{Api, Fallbacks, GlobalGenerator, Profile, Registry};
+
+use std::env;
+use std::fs::File;
+use std::path::Path;
+
fn main() {
let hash = rustc_tools_util::get_commit_hash().unwrap_or_default();
println!("cargo:rustc-env=GIT_HASH={}", hash);
+
+ let dest = env::var("OUT_DIR").unwrap();
+ let mut file = File::create(&Path::new(&dest).join("gl_bindings.rs")).unwrap();
+
+ Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, ["GL_ARB_blend_func_extended"])
+ .write_bindings(GlobalGenerator, &mut file)
+ .unwrap();
}
diff --git a/alacritty_terminal/src/cursor.rs b/alacritty/src/cursor.rs
index d1df14e2..e671bf4b 100644
--- a/alacritty_terminal/src/cursor.rs
+++ b/alacritty/src/cursor.rs
@@ -16,22 +16,13 @@
use std::cmp;
-use serde::Deserialize;
+use alacritty_terminal::ansi::CursorStyle;
use font::{Metrics, RasterizedGlyph};
-use crate::ansi::CursorStyle;
-
/// Width/Height of the cursor relative to the font width
pub const CURSOR_WIDTH_PERCENTAGE: i32 = 15;
-/// A key for caching cursor glyphs
-#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash, Deserialize)]
-pub struct CursorKey {
- pub style: CursorStyle,
- pub is_wide: bool,
-}
-
pub fn get_cursor_glyph(
cursor: CursorStyle,
metrics: Metrics,
diff --git a/alacritty/src/display.rs b/alacritty/src/display.rs
index 5c4c7313..f64deaed 100644
--- a/alacritty/src/display.rs
+++ b/alacritty/src/display.rs
@@ -32,14 +32,14 @@ use alacritty_terminal::event::{Event, OnResize};
use alacritty_terminal::index::Line;
use alacritty_terminal::message_bar::MessageBuffer;
use alacritty_terminal::meter::Meter;
-use alacritty_terminal::renderer::rects::{RenderLines, RenderRect};
-use alacritty_terminal::renderer::{self, GlyphCache, QuadRenderer};
use alacritty_terminal::selection::Selection;
use alacritty_terminal::term::color::Rgb;
use alacritty_terminal::term::{RenderableCell, SizeInfo, Term, TermMode};
use crate::config::Config;
use crate::event::{DisplayUpdate, Mouse};
+use crate::renderer::rects::{RenderLines, RenderRect};
+use crate::renderer::{self, GlyphCache, QuadRenderer};
use crate::url::{Url, Urls};
use crate::window::{self, Window};
diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs
index 80d31709..871c816e 100644
--- a/alacritty/src/main.rs
+++ b/alacritty/src/main.rs
@@ -51,13 +51,20 @@ use alacritty_terminal::tty;
mod cli;
mod config;
+mod cursor;
mod display;
mod event;
mod input;
mod logging;
+mod renderer;
mod url;
mod window;
+mod gl {
+ #![allow(clippy::all)]
+ include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
+}
+
use crate::cli::Options;
use crate::config::monitor::Monitor;
use crate::config::Config;
diff --git a/alacritty_terminal/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs
index b200743a..64b14a46 100644
--- a/alacritty_terminal/src/renderer/mod.rs
+++ b/alacritty/src/renderer/mod.rs
@@ -26,17 +26,16 @@ use font::{self, FontDesc, FontKey, GlyphKey, Rasterize, RasterizedGlyph, Raster
use log::{error, info};
use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
-use crate::config::{self, Config, Delta, Font, StartupMode};
-use crate::cursor::{get_cursor_glyph, CursorKey};
+use crate::cursor;
use crate::gl;
use crate::gl::types::*;
-use crate::index::{Column, Line};
use crate::renderer::rects::RenderRect;
-use crate::term::cell::{self, Flags};
-use crate::term::color::Rgb;
-use crate::term::SizeInfo;
-use crate::term::{self, RenderableCell, RenderableCellContent};
-use crate::util;
+use alacritty_terminal::config::{self, Config, Delta, Font, StartupMode};
+use alacritty_terminal::index::{Column, Line};
+use alacritty_terminal::term::cell::{self, Flags};
+use alacritty_terminal::term::color::Rgb;
+use alacritty_terminal::term::{self, CursorKey, RenderableCell, RenderableCellContent, SizeInfo};
+use alacritty_terminal::util;
pub mod rects;
@@ -1016,7 +1015,7 @@ impl<'a, C> RenderApi<'a, C> {
// Raw cell pixel buffers like cursors don't need to go through font lookup
let metrics = glyph_cache.metrics;
let glyph = glyph_cache.cursor_cache.entry(cursor_key).or_insert_with(|| {
- self.load_glyph(&get_cursor_glyph(
+ self.load_glyph(&cursor::get_cursor_glyph(
cursor_key.style,
metrics,
self.config.font.offset.x,
diff --git a/alacritty_terminal/src/renderer/rects.rs b/alacritty/src/renderer/rects.rs
index d5645828..5bc353ff 100644
--- a/alacritty_terminal/src/renderer/rects.rs
+++ b/alacritty/src/renderer/rects.rs
@@ -15,10 +15,10 @@ use std::collections::HashMap;
use font::Metrics;
-use crate::index::{Column, Point};
-use crate::term::cell::Flags;
-use crate::term::color::Rgb;
-use crate::term::{RenderableCell, SizeInfo};
+use alacritty_terminal::index::{Column, Point};
+use alacritty_terminal::term::cell::Flags;
+use alacritty_terminal::term::color::Rgb;
+use alacritty_terminal::term::{RenderableCell, SizeInfo};
#[derive(Debug, Copy, Clone)]
pub struct RenderRect {
diff --git a/alacritty/src/url.rs b/alacritty/src/url.rs
index 5c10bcfd..09f66886 100644
--- a/alacritty/src/url.rs
+++ b/alacritty/src/url.rs
@@ -7,13 +7,13 @@ use urlocator::{UrlLocation, UrlLocator};
use font::Metrics;
use alacritty_terminal::index::Point;
-use alacritty_terminal::renderer::rects::{RenderLine, RenderRect};
use alacritty_terminal::term::cell::Flags;
use alacritty_terminal::term::color::Rgb;
use alacritty_terminal::term::{RenderableCell, RenderableCellContent, SizeInfo};
use crate::config::{Config, RelaxedEq};
use crate::event::Mouse;
+use crate::renderer::rects::{RenderLine, RenderRect};
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Url {
diff --git a/alacritty/src/window.rs b/alacritty/src/window.rs
index 0559cbc7..b471918c 100644
--- a/alacritty/src/window.rs
+++ b/alacritty/src/window.rs
@@ -37,11 +37,11 @@ use x11_dl::xlib::{Display as XDisplay, PropModeReplace, XErrorEvent, Xlib};
use alacritty_terminal::config::{Decorations, StartupMode, WindowConfig};
use alacritty_terminal::event::Event;
-use alacritty_terminal::gl;
#[cfg(not(windows))]
use alacritty_terminal::term::{SizeInfo, Term};
use crate::config::Config;
+use crate::gl;
// It's required to be in this directory due to the `windows.rc` file
#[cfg(not(target_os = "macos"))]
diff --git a/alacritty_terminal/Cargo.toml b/alacritty_terminal/Cargo.toml
index 36efde99..00598357 100644
--- a/alacritty_terminal/Cargo.toml
+++ b/alacritty_terminal/Cargo.toml
@@ -3,7 +3,6 @@ name = "alacritty_terminal"
version = "0.4.1-dev"
authors = ["Joe Wilm <joe@jwilm.com>"]
license = "Apache-2.0"
-build = "build.rs"
description = "Library for writing terminal emulators"
readme = "../README.md"
homepage = "https://github.com/jwilm/alacritty"
@@ -21,7 +20,6 @@ vte = "0.3"
mio = "0.6"
mio-extras = "2"
log = "0.4"
-fnv = "1"
unicode-width = "0.1"
base64 = "0.10.0"
terminfo = "0.6.1"
@@ -51,8 +49,5 @@ live-shader-reload = []
nightly = []
bench = []
-[build-dependencies]
-gl_generator = "0.14.0"
-
[dev-dependencies]
serde_json = "1.0.0"
diff --git a/alacritty_terminal/build.rs b/alacritty_terminal/build.rs
deleted file mode 100644
index 5d5bc451..00000000
--- a/alacritty_terminal/build.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 Joe Wilm, The Alacritty Project Contributors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-use gl_generator::{Api, Fallbacks, GlobalGenerator, Profile, Registry};
-
-use std::env;
-use std::fs::File;
-use std::path::Path;
-
-fn main() {
- let dest = env::var("OUT_DIR").unwrap();
- let mut file = File::create(&Path::new(&dest).join("gl_bindings.rs")).unwrap();
-
- Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, ["GL_ARB_blend_func_extended"])
- .write_bindings(GlobalGenerator, &mut file)
- .unwrap();
-}
diff --git a/alacritty_terminal/src/lib.rs b/alacritty_terminal/src/lib.rs
index 82c83856..039f2b81 100644
--- a/alacritty_terminal/src/lib.rs
+++ b/alacritty_terminal/src/lib.rs
@@ -24,7 +24,6 @@ extern crate objc;
pub mod ansi;
pub mod clipboard;
pub mod config;
-mod cursor;
pub mod event;
pub mod event_loop;
pub mod grid;
@@ -33,7 +32,6 @@ pub mod locale;
pub mod message_bar;
pub mod meter;
pub mod panic;
-pub mod renderer;
pub mod selection;
pub mod sync;
pub mod term;
@@ -42,8 +40,3 @@ pub mod util;
pub use crate::grid::Grid;
pub use crate::term::Term;
-
-pub mod gl {
- #![allow(clippy::all)]
- include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
-}
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index 6a51ba35..a5bc8313 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -27,7 +27,6 @@ use crate::ansi::{
};
use crate::clipboard::{Clipboard, ClipboardType};
use crate::config::{Config, VisualBellAnimation, DEFAULT_NAME};
-use crate::cursor::CursorKey;
use crate::event::{Event, EventListener};
use crate::grid::{
BidirectionalIterator, DisplayIter, Grid, GridCell, IndexRegion, Indexed, Scroll,
@@ -161,6 +160,13 @@ impl<T> selection::Dimensions for Term<T> {
}
}
+/// A key for caching cursor glyphs
+#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash, Deserialize)]
+pub struct CursorKey {
+ pub style: CursorStyle,
+ pub is_wide: bool,
+}
+
/// Iterator that yields cells needing render
///
/// Yields cells that require work to be displayed (that is, not a an empty