Merge branch 'master' into framerate-independent-cursor

macos-click-through
Jon Valdés 5 years ago committed by GitHub
commit 2dc28c633e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

90
Cargo.lock generated

@ -81,9 +81,9 @@ version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "750b1c38a1dfadd108da0f01c08f4cdc7ff1bb39b325f9c82cc972361780a6e1" checksum = "750b1c38a1dfadd108da0f01c08f4cdc7ff1bb39b325f9c82cc972361780a6e1"
dependencies = [ dependencies = [
"proc-macro2 1.0.8", "proc-macro2 1.0.9",
"quote 1.0.2", "quote 1.0.2",
"syn 1.0.14", "syn 1.0.16",
] ]
[[package]] [[package]]
@ -131,7 +131,7 @@ dependencies = [
"lazycell", "lazycell",
"log", "log",
"peeking_take_while", "peeking_take_while",
"proc-macro2 1.0.8", "proc-macro2 1.0.9",
"quote 1.0.2", "quote 1.0.2",
"regex", "regex",
"rustc-hash", "rustc-hash",
@ -398,24 +398,26 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-deque" name = "crossbeam-deque"
version = "0.7.2" version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3aa945d63861bfe624b55d153a39684da1e8c0bc8fba932f7ee3a3c16cea3ca" checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
dependencies = [ dependencies = [
"crossbeam-epoch", "crossbeam-epoch",
"crossbeam-utils", "crossbeam-utils",
"maybe-uninit",
] ]
[[package]] [[package]]
name = "crossbeam-epoch" name = "crossbeam-epoch"
version = "0.8.0" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5064ebdbf05ce3cb95e45c8b086f72263f4166b29b97f6baff7ef7fe047b55ac" checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
dependencies = [ dependencies = [
"autocfg 0.1.7", "autocfg 1.0.0",
"cfg-if", "cfg-if",
"crossbeam-utils", "crossbeam-utils",
"lazy_static", "lazy_static",
"maybe-uninit",
"memoffset", "memoffset",
"scopeguard", "scopeguard",
] ]
@ -432,11 +434,11 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.7.0" version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce446db02cdc3165b94ae73111e570793400d0794e46125cc4056c81cbb039f4" checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
dependencies = [ dependencies = [
"autocfg 0.1.7", "autocfg 1.0.0",
"cfg-if", "cfg-if",
"lazy_static", "lazy_static",
] ]
@ -487,9 +489,9 @@ version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71f31892cd5c62e414316f2963c5689242c43d8e7bbcaaeca97e5e28c95d91d9" checksum = "71f31892cd5c62e414316f2963c5689242c43d8e7bbcaaeca97e5e28c95d91d9"
dependencies = [ dependencies = [
"proc-macro2 1.0.8", "proc-macro2 1.0.9",
"quote 1.0.2", "quote 1.0.2",
"syn 1.0.14", "syn 1.0.16",
] ]
[[package]] [[package]]
@ -746,9 +748,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7"
dependencies = [ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2 1.0.8", "proc-macro2 1.0.9",
"quote 1.0.2", "quote 1.0.2",
"syn 1.0.14", "syn 1.0.16",
] ]
[[package]] [[package]]
@ -855,9 +857,9 @@ dependencies = [
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.7" version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2c55f143919fbc0bc77e427fe2d74cf23786d7c1875666f2fde3ac3c659bb67" checksum = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8"
dependencies = [ dependencies = [
"libc", "libc",
] ]
@ -946,9 +948,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.66" version = "0.2.67"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -1034,11 +1036,17 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "maybe-uninit"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.3.2" version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53445de381a1f436797497c61d851644d0e8e88e6140f22872ad33a704933978" checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
[[package]] [[package]]
name = "memoffset" name = "memoffset"
@ -1349,9 +1357,9 @@ version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f" checksum = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f"
dependencies = [ dependencies = [
"proc-macro2 1.0.8", "proc-macro2 1.0.9",
"quote 1.0.2", "quote 1.0.2",
"syn 1.0.14", "syn 1.0.16",
] ]
[[package]] [[package]]
@ -1390,9 +1398,9 @@ version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" checksum = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
dependencies = [ dependencies = [
"proc-macro2 1.0.8", "proc-macro2 1.0.9",
"quote 1.0.2", "quote 1.0.2",
"syn 1.0.14", "syn 1.0.16",
] ]
[[package]] [[package]]
@ -1412,9 +1420,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.8" version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" checksum = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
dependencies = [ dependencies = [
"unicode-xid 0.2.0", "unicode-xid 0.2.0",
] ]
@ -1440,7 +1448,7 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
dependencies = [ dependencies = [
"proc-macro2 1.0.8", "proc-macro2 1.0.9",
] ]
[[package]] [[package]]
@ -1545,9 +1553,9 @@ dependencies = [
[[package]] [[package]]
name = "rust-embed" name = "rust-embed"
version = "5.3.0" version = "5.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "412cddb9905679491f2829ef7fea79179b9a76fa942e06ab52b420dbab94a406" checksum = "20eb43fdf7722a83abfcbc60e10a99c0940d3f07ca69a643edee10bf174240ff"
dependencies = [ dependencies = [
"rust-embed-impl", "rust-embed-impl",
"rust-embed-utils", "rust-embed-utils",
@ -1556,13 +1564,13 @@ dependencies = [
[[package]] [[package]]
name = "rust-embed-impl" name = "rust-embed-impl"
version = "5.3.0" version = "5.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50212d0e652f580e6d297537c31237d4b2f4497e5912eebe25fde97ac06a51df" checksum = "c44c2cbb1a7168b8232ce002b83ebe0c669414d53d6deb38994222d995027f97"
dependencies = [ dependencies = [
"quote 1.0.2", "quote 1.0.2",
"rust-embed-utils", "rust-embed-utils",
"syn 1.0.14", "syn 1.0.16",
"walkdir", "walkdir",
] ]
@ -1630,7 +1638,7 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "sdl2" name = "sdl2"
version = "0.33.0" version = "0.33.0"
source = "git+https://github.com/Rust-SDL2/rust-sdl2#c3f0088ea49f6c1b29b9e110313cd7b2a9833dc9" source = "git+https://github.com/Rust-SDL2/rust-sdl2#4e81db58fb93f2e09e42e2f088cb2a038d9ebfac"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"lazy_static", "lazy_static",
@ -1641,7 +1649,7 @@ dependencies = [
[[package]] [[package]]
name = "sdl2-sys" name = "sdl2-sys"
version = "0.33.0" version = "0.33.0"
source = "git+https://github.com/Rust-SDL2/rust-sdl2#c3f0088ea49f6c1b29b9e110313cd7b2a9833dc9" source = "git+https://github.com/Rust-SDL2/rust-sdl2#4e81db58fb93f2e09e42e2f088cb2a038d9ebfac"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"cmake", "cmake",
@ -1784,7 +1792,7 @@ dependencies = [
[[package]] [[package]]
name = "skulpin" name = "skulpin"
version = "0.5.2" version = "0.5.2"
source = "git+https://github.com/Kethku/skulpin?branch=sdl2#b4451490e457cd7ad504819a99d978a8d0f38ff4" source = "git+https://github.com/Kethku/skulpin?branch=sdl2#9c62459e55d46c824c16135f73a93b7f3c85a908"
dependencies = [ dependencies = [
"ash", "ash",
"cocoa", "cocoa",
@ -1840,11 +1848,11 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.14" version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" checksum = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859"
dependencies = [ dependencies = [
"proc-macro2 1.0.8", "proc-macro2 1.0.9",
"quote 1.0.2", "quote 1.0.2",
"unicode-xid 0.2.0", "unicode-xid 0.2.0",
] ]
@ -1951,9 +1959,9 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4b1e7ed7d5d4c2af3d999904b0eebe76544897cdbfb2b9684bed2174ab20f7c" checksum = "f4b1e7ed7d5d4c2af3d999904b0eebe76544897cdbfb2b9684bed2174ab20f7c"
dependencies = [ dependencies = [
"proc-macro2 1.0.8", "proc-macro2 1.0.9",
"quote 1.0.2", "quote 1.0.2",
"syn 1.0.14", "syn 1.0.16",
] ]
[[package]] [[package]]

@ -64,7 +64,7 @@ async fn start_process(mut receiver: UnboundedReceiver<UiCommand>) {
tokio::spawn(async move { tokio::spawn(async move {
info!("Close watcher started"); info!("Close watcher started");
match io_handler.await { match io_handler.await {
Err(join_error) => eprintln!("Error joining IO loop: '{}'", join_error), Err(join_error) => error!("Error joining IO loop: '{}'", join_error),
Ok(Err(error)) => { Ok(Err(error)) => {
if !error.is_channel_closed() { if !error.is_channel_closed() {
error!("Error: '{}'", error); error!("Error: '{}'", error);
@ -77,11 +77,11 @@ async fn start_process(mut receiver: UnboundedReceiver<UiCommand>) {
if let Ok(Value::Integer(correct_version)) = nvim.eval("has(\"nvim-0.4\")").await { if let Ok(Value::Integer(correct_version)) = nvim.eval("has(\"nvim-0.4\")").await {
if correct_version.as_i64() != Some(1) { if correct_version.as_i64() != Some(1) {
eprintln!("Neovide requires version 0.4 or higher"); error!("Neovide requires version 0.4 or higher");
std::process::exit(0); std::process::exit(0);
} }
} else { } else {
eprintln!("Neovide requires version 0.4 or higher"); error!("Neovide requires version 0.4 or higher");
std::process::exit(0); std::process::exit(0);
}; };

@ -16,6 +16,15 @@ const EMOJI_FONT: &str = "NotoColorEmoji.ttf";
const WIDE_FONT: &str = "NotoSansMonoCJKjp-Regular.otf"; const WIDE_FONT: &str = "NotoSansMonoCJKjp-Regular.otf";
const WIDE_BOLD_FONT: &str = "NotoSansMonoCJKjp-Bold.otf"; const WIDE_BOLD_FONT: &str = "NotoSansMonoCJKjp-Bold.otf";
#[cfg(target_os = "windows")]
const SYSTEM_SYMBOL_FONT: &str = "Segoe UI Symbol";
#[cfg(target_os = "linux")]
const SYSTEM_SYMBOL_FONT: &str = "Unifont";
#[cfg(target_os = "macos")]
const SYSTEM_SYMBOL_FONT: &str = "Apple Symbols";
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
const SYSTEM_EMOJI_FONT: &str = "Segoe UI Emoji"; const SYSTEM_EMOJI_FONT: &str = "Segoe UI Emoji";
@ -25,6 +34,7 @@ const SYSTEM_EMOJI_FONT: &str = "Apple Color Emoji";
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
const SYSTEM_EMOJI_FONT: &str = "Noto Color Emoji"; const SYSTEM_EMOJI_FONT: &str = "Noto Color Emoji";
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "assets/fonts/"] #[folder = "assets/fonts/"]
struct Asset; struct Asset;
@ -86,6 +96,11 @@ fn build_collection_by_font_name(font_name: Option<&str>, bold: bool, italic: bo
collection.add_family(FontFamily::new_from_font(font)); collection.add_family(FontFamily::new_from_font(font));
} }
if let Ok(sys_symbol) = source.select_family_by_name(SYSTEM_SYMBOL_FONT) {
let font = sys_symbol.fonts()[0].load().unwrap();
collection.add_family(FontFamily::new_from_font(font));
}
if cfg!(not(target_os = "macos")) { if cfg!(not(target_os = "macos")) {
let emoji_data = Asset::get(EMOJI_FONT).expect("Failed to read emoji font data"); let emoji_data = Asset::get(EMOJI_FONT).expect("Failed to read emoji font data");
let emoji_font = Font::from_bytes(emoji_data.to_vec().into(), 0).expect("Failed to parse emoji font data"); let emoji_font = Font::from_bytes(emoji_data.to_vec().into(), 0).expect("Failed to parse emoji font data");

@ -5,7 +5,7 @@ use std::any::{Any, TypeId};
pub use rmpv::Value; pub use rmpv::Value;
use nvim_rs::Neovim; use nvim_rs::Neovim;
use nvim_rs::compat::tokio::Compat; use nvim_rs::compat::tokio::Compat;
use flexi_logger::{Logger, Criterion, Naming, Cleanup}; use flexi_logger::{Logger, Criterion, Naming, Cleanup, Duplicate};
use tokio::process::ChildStdin; use tokio::process::ChildStdin;
use parking_lot::RwLock; use parking_lot::RwLock;
use log::{error,warn}; use log::{error,warn};
@ -136,19 +136,29 @@ pub struct Settings {
impl Settings { impl Settings {
fn new() -> Settings { fn new() -> Settings {
let mut log_to_file = false;
let neovim_arguments = std::env::args().filter(|arg| { let neovim_arguments = std::env::args().filter(|arg| {
if arg == "--log" { if arg == "--log" {
Logger::with_str("neovide") log_to_file = true;
.log_to_file()
.rotate(Criterion::Size(10_000_000), Naming::Timestamps, Cleanup::KeepLogFiles(1))
.start()
.expect("Could not start logger");
false false
} else { } else {
true true
} }
}).collect::<Vec<String>>(); }).collect::<Vec<String>>();
if log_to_file {
Logger::with_env_or_str("neovide")
.duplicate_to_stderr(Duplicate::Error)
.log_to_file()
.rotate(Criterion::Size(10_000_000), Naming::Timestamps, Cleanup::KeepLogFiles(1))
.start()
.expect("Could not start logger");
} else {
Logger::with_env_or_str("neovide = error")
.start()
.expect("Could not start logger");
}
Settings{ Settings{
neovim_arguments, neovim_arguments,
settings: RwLock::new(HashMap::new()), settings: RwLock::new(HashMap::new()),

@ -160,14 +160,16 @@ impl WindowWrapper {
pub fn handle_pointer_motion(&mut self, x: i32, y: i32) { pub fn handle_pointer_motion(&mut self, x: i32, y: i32) {
let previous_position = self.mouse_position; let previous_position = self.mouse_position;
self.mouse_position = LogicalSize::from_physical_size_tuple(( if let Ok(new_mouse_position) = LogicalSize::from_physical_size_tuple((
(x as f32 / self.renderer.font_width) as u32, (x as f32 / self.renderer.font_width) as u32,
(y as f32 / self.renderer.font_height) as u32 (y as f32 / self.renderer.font_height) as u32
), ),
&self.window &self.window
).expect("Could not calculate logical mouse position"); ) {
if self.mouse_down && previous_position != self.mouse_position { self.mouse_position = new_mouse_position;
BRIDGE.queue_command(UiCommand::Drag(self.mouse_position.width, self.mouse_position.height)); if self.mouse_down && previous_position != self.mouse_position {
BRIDGE.queue_command(UiCommand::Drag(self.mouse_position.width, self.mouse_position.height));
}
} }
} }
@ -220,30 +222,32 @@ impl WindowWrapper {
} }
pub fn draw_frame(&mut self) -> bool { pub fn draw_frame(&mut self) -> bool {
let new_size = LogicalSize::new(&self.window).unwrap(); if let Ok(new_size) = LogicalSize::new(&self.window) {
if self.previous_size != new_size { if self.previous_size != new_size {
handle_new_grid_size(new_size, &self.renderer); handle_new_grid_size(new_size, &self.renderer);
self.previous_size = new_size; self.previous_size = new_size;
}
} }
let new_dpis = dpis(&self.window).unwrap(); if let Ok(new_dpis) = dpis(&self.window) {
if self.previous_dpis != new_dpis { if self.previous_dpis != new_dpis {
let physical_size = PhysicalSize::new(&self.window); let physical_size = PhysicalSize::new(&self.window);
self.window.set_size( self.window.set_size(
(physical_size.width as f32 * new_dpis.0 / self.previous_dpis.0) as u32, (physical_size.width as f32 * new_dpis.0 / self.previous_dpis.0) as u32,
(physical_size.height as f32 * new_dpis.1 / self.previous_dpis.1) as u32).unwrap(); (physical_size.height as f32 * new_dpis.1 / self.previous_dpis.1) as u32).unwrap();
self.previous_dpis = new_dpis; self.previous_dpis = new_dpis;
}
} }
debug!("Render Triggered"); debug!("Render Triggered");
let current_size = self.previous_size;
if REDRAW_SCHEDULER.should_draw() || SETTINGS.get::<WindowSettings>().no_idle { if REDRAW_SCHEDULER.should_draw() || SETTINGS.get::<WindowSettings>().no_idle {
let renderer = &mut self.renderer; let renderer = &mut self.renderer;
if self.skulpin_renderer.draw(&self.window, |canvas, coordinate_system_helper| { if self.skulpin_renderer.draw(&self.window, |canvas, coordinate_system_helper| {
let dt = 1.0 / (SETTINGS.get::<WindowSettings>().refresh_rate as f32); let dt = 1.0 / (SETTINGS.get::<WindowSettings>().refresh_rate as f32);
if renderer.draw(canvas, coordinate_system_helper, dt) { if renderer.draw(canvas, coordinate_system_helper, dt) {
handle_new_grid_size(new_size, &renderer) handle_new_grid_size(current_size, &renderer)
} }
}).is_err() { }).is_err() {
error!("Render failed. Closing"); error!("Render failed. Closing");

Loading…
Cancel
Save