2016-11-20 00:16:20 +00:00
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
//! Alacritty - The GPU Enhanced Terminal
|
2018-06-17 09:19:30 +00:00
|
|
|
#![cfg_attr(feature = "cargo-clippy", deny(clippy, if_not_else, enum_glob_use, wrong_pub_self_convention))]
|
2017-01-07 00:32:29 +00:00
|
|
|
#![cfg_attr(feature = "nightly", feature(core_intrinsics))]
|
2017-05-28 16:38:10 +00:00
|
|
|
#![cfg_attr(all(test, feature = "bench"), feature(test))]
|
2016-11-20 00:16:20 +00:00
|
|
|
|
2017-03-02 06:24:37 +00:00
|
|
|
#[macro_use] extern crate bitflags;
|
|
|
|
#[macro_use] extern crate clap;
|
|
|
|
#[macro_use] extern crate log;
|
|
|
|
#[macro_use] extern crate serde_derive;
|
2018-07-05 23:05:33 +00:00
|
|
|
#[macro_use] extern crate static_assertions;
|
2016-11-20 00:16:20 +00:00
|
|
|
|
2018-10-16 17:02:52 +00:00
|
|
|
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly",
|
|
|
|
target_os = "openbsd"))]
|
2017-04-26 17:26:46 +00:00
|
|
|
extern crate x11_dl;
|
|
|
|
|
2018-10-16 17:02:52 +00:00
|
|
|
#[cfg(windows)]
|
|
|
|
extern crate mio_named_pipes;
|
|
|
|
#[cfg(windows)]
|
|
|
|
extern crate winapi;
|
|
|
|
#[cfg(windows)]
|
|
|
|
extern crate winpty;
|
|
|
|
#[cfg(windows)]
|
|
|
|
extern crate dunce;
|
|
|
|
#[cfg(windows)]
|
|
|
|
extern crate winit;
|
|
|
|
#[cfg(windows)]
|
|
|
|
extern crate image;
|
|
|
|
|
2017-12-13 17:52:36 +00:00
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
#[macro_use]
|
|
|
|
extern crate objc;
|
|
|
|
|
2017-05-28 16:38:10 +00:00
|
|
|
extern crate arraydeque;
|
2016-11-20 00:16:20 +00:00
|
|
|
extern crate cgmath;
|
|
|
|
extern crate copypasta;
|
2017-10-08 22:42:38 +00:00
|
|
|
extern crate env_logger;
|
2018-10-16 17:02:52 +00:00
|
|
|
extern crate errno;
|
2017-01-13 18:03:51 +00:00
|
|
|
extern crate fnv;
|
2017-03-02 06:24:37 +00:00
|
|
|
extern crate font;
|
2016-11-20 00:16:20 +00:00
|
|
|
extern crate glutin;
|
|
|
|
extern crate libc;
|
|
|
|
extern crate mio;
|
2017-08-30 18:43:37 +00:00
|
|
|
extern crate mio_more;
|
2016-11-20 00:16:20 +00:00
|
|
|
extern crate notify;
|
|
|
|
extern crate parking_lot;
|
|
|
|
extern crate serde;
|
|
|
|
extern crate serde_json;
|
|
|
|
extern crate serde_yaml;
|
2017-03-02 06:24:37 +00:00
|
|
|
extern crate unicode_width;
|
2016-11-20 00:16:20 +00:00
|
|
|
extern crate vte;
|
2017-01-03 04:04:46 +00:00
|
|
|
extern crate xdg;
|
2018-01-02 16:32:50 +00:00
|
|
|
extern crate base64;
|
2018-09-24 19:06:12 +00:00
|
|
|
extern crate terminfo;
|
2016-11-20 00:16:20 +00:00
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
pub mod macros;
|
|
|
|
|
2016-12-10 05:10:49 +00:00
|
|
|
pub mod ansi;
|
2016-12-11 06:44:13 +00:00
|
|
|
pub mod cli;
|
2016-12-10 05:10:49 +00:00
|
|
|
pub mod config;
|
2016-12-11 06:44:13 +00:00
|
|
|
pub mod display;
|
2016-11-20 00:16:20 +00:00
|
|
|
pub mod event;
|
|
|
|
pub mod event_loop;
|
2016-12-10 05:10:49 +00:00
|
|
|
pub mod grid;
|
2016-11-20 00:16:20 +00:00
|
|
|
pub mod index;
|
|
|
|
pub mod input;
|
2017-12-13 17:52:36 +00:00
|
|
|
pub mod locale;
|
2017-01-13 07:15:06 +00:00
|
|
|
pub mod logging;
|
2016-11-20 00:16:20 +00:00
|
|
|
pub mod meter;
|
|
|
|
pub mod renderer;
|
2016-12-22 18:43:06 +00:00
|
|
|
pub mod selection;
|
2016-11-20 00:16:20 +00:00
|
|
|
pub mod sync;
|
|
|
|
pub mod term;
|
|
|
|
pub mod tty;
|
|
|
|
pub mod util;
|
2016-12-10 05:10:49 +00:00
|
|
|
pub mod window;
|
2016-11-20 00:16:20 +00:00
|
|
|
|
2017-06-23 17:01:53 +00:00
|
|
|
use std::ops::Mul;
|
|
|
|
|
2016-11-20 00:16:20 +00:00
|
|
|
pub use grid::Grid;
|
|
|
|
pub use term::Term;
|
|
|
|
|
2018-01-06 01:42:55 +00:00
|
|
|
/// Facade around [winit's `MouseCursor`](glutin::MouseCursor)
|
2017-12-24 20:15:42 +00:00
|
|
|
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
|
|
|
|
pub enum MouseCursor {
|
|
|
|
Arrow,
|
|
|
|
Text,
|
|
|
|
}
|
|
|
|
|
2016-11-20 00:16:20 +00:00
|
|
|
#[derive(Debug, Eq, PartialEq, Copy, Clone, Default, Serialize, Deserialize)]
|
|
|
|
pub struct Rgb {
|
|
|
|
pub r: u8,
|
|
|
|
pub g: u8,
|
|
|
|
pub b: u8,
|
|
|
|
}
|
|
|
|
|
2017-06-23 17:01:53 +00:00
|
|
|
// a multiply function for Rgb, as the default dim is just *2/3
|
|
|
|
impl Mul<f32> for Rgb {
|
|
|
|
type Output = Rgb;
|
|
|
|
|
|
|
|
fn mul(self, rhs: f32) -> Rgb {
|
|
|
|
let result = Rgb {
|
2018-01-06 01:42:55 +00:00
|
|
|
r: (f32::from(self.r) * rhs).max(0.0).min(255.0) as u8,
|
|
|
|
g: (f32::from(self.g) * rhs).max(0.0).min(255.0) as u8,
|
|
|
|
b: (f32::from(self.b) * rhs).max(0.0).min(255.0) as u8
|
2017-06-23 17:01:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
trace!("Scaling RGB by {} from {:?} to {:?}", rhs, self, result);
|
|
|
|
|
|
|
|
result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-23 20:33:35 +00:00
|
|
|
#[allow(unused_mut)]
|
2016-11-20 00:16:20 +00:00
|
|
|
pub mod gl {
|
|
|
|
#![allow(non_upper_case_globals)]
|
2018-06-17 09:19:30 +00:00
|
|
|
#![cfg_attr(feature = "cargo-clippy", allow(clippy))]
|
2016-11-20 00:16:20 +00:00
|
|
|
include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
|
|
|
|
}
|