in progress

macos-click-through
keith 5 years ago
parent 65895b6d6e
commit 9fe0adcb38

1328
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -5,7 +5,7 @@ authors = ["keith <keith@the-simmons.net>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
druid-shell = { git = "https://github.com/xi-editor/druid.git", version = "0.4" } skulpin = "0.3"
derive-new = "0.5" derive-new = "0.5"
env_logger = "0.7.1" env_logger = "0.7.1"
neovim-lib = { git = "https://github.com/daa84/neovim-lib", version = "0.6" } neovim-lib = { git = "https://github.com/daa84/neovim-lib", version = "0.6" }

@ -1,29 +1,14 @@
use std::collections::HashMap; use std::collections::HashMap;
use druid_shell::piet::Color; use skia_safe::Color4f;
use skia_safe::colors::*;
use neovim_lib::{Neovim, NeovimApi}; use neovim_lib::{Neovim, NeovimApi};
#[derive(new, Debug, Clone)] #[derive(new, PartialEq, Debug, Clone)]
pub struct Colors { pub struct Colors {
pub foreground: Option<Color>, pub foreground: Option<Color4f>,
pub background: Option<Color>, pub background: Option<Color4f>,
pub special: Option<Color> pub special: Option<Color4f>
}
impl PartialEq for Colors {
fn eq(&self, other: &Colors) -> bool {
fn compare_options(a: &Option<Color>, b: &Option<Color>) -> bool {
match (a, b) {
(Some(a), Some(b)) => a.as_rgba_u32() == b.as_rgba_u32(),
(None, None) => true,
_ => false
}
}
compare_options(&self.foreground, &other.foreground) &&
compare_options(&self.background, &other.background) &&
compare_options(&self.special, &other.special)
}
} }
#[derive(new, Debug, Clone, PartialEq)] #[derive(new, Debug, Clone, PartialEq)]
@ -81,7 +66,7 @@ impl Editor {
grid: Vec::new(), grid: Vec::new(),
cursor_pos: (0, 0), cursor_pos: (0, 0),
size: (width, height), size: (width, height),
default_colors: Colors::new(Some(Color::rgb(0xff, 0xff, 0xff)), Some(Color::rgb(0x00, 0x00, 0x00)), Some(Color::rgb(0x88, 0x88, 0x88))), default_colors: Colors::new(Some(colors::WHITE), Some(colors::BLACK), Some(colors::GREY)),
defined_styles: HashMap::new(), defined_styles: HashMap::new(),
previous_style: None previous_style: None
}; };
@ -174,7 +159,7 @@ impl Editor {
self.defined_styles.insert(id, style); self.defined_styles.insert(id, style);
} }
pub fn set_default_colors(&mut self, foreground: Color, background: Color, special: Color) { pub fn set_default_colors(&mut self, foreground: Color4f, background: Color4f, special: Color4f) {
self.default_colors = Colors::new(Some(foreground), Some(background), Some(special)); self.default_colors = Colors::new(Some(foreground), Some(background), Some(special));
} }

@ -17,7 +17,7 @@ use rmpv::Value;
use window::ui_loop; use window::ui_loop;
use editor::{Colors, Editor, GridLineCell, Style}; use editor::{Colors, Editor, GridLineCell, Style};
use druid_shell::piet::Color; use skia_safe::Color4f;
const INITIAL_WIDTH: u16 = 100; const INITIAL_WIDTH: u16 = 100;
const INITIAL_HEIGHT: u16 = 50; const INITIAL_HEIGHT: u16 = 50;
@ -72,6 +72,7 @@ fn handle_cursor_goto(cursor_goto_arguments: &Vec<Value>, editor: &Arc<Mutex<Edi
} }
fn unpack_color(packed_color: u64) -> Color { fn unpack_color(packed_color: u64) -> Color {
Color::from_rgba32_u32(((packed_color as u32) << 8) + 255) Color::from_rgba32_u32(((packed_color as u32) << 8) + 255)
} }

Loading…
Cancel
Save