Event loop

This commit is contained in:
daa84 2016-03-24 12:21:27 +03:00
parent edaa867103
commit 8e57752e97
6 changed files with 23 additions and 9 deletions

14
Cargo.lock generated
View File

@ -5,7 +5,7 @@ dependencies = [
"cairo-rs 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "cairo-rs 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "glib 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
"gtk 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "gtk 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
"neovim-lib 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "neovim-lib 0.1.0",
"rmp 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rmp 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -193,10 +193,18 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "neovim-lib" name = "log"
version = "0.1.0" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "neovim-lib"
version = "0.1.0"
dependencies = [
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rmp 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rmp 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rmp-serialize 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rmp-serialize 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -7,9 +7,12 @@ build = "build.rs"
[dependencies] [dependencies]
cairo-rs = "0.0.8" cairo-rs = "0.0.8"
glib = "0.0.8" glib = "0.0.8"
neovim-lib = "0.1" #neovim-lib = "0.1"
rmp = "0.7" rmp = "0.7"
[dependencies.neovim-lib]
path = "../neovim-lib/"
[dependencies.gtk] [dependencies.gtk]
version = "0.0.7" version = "0.0.7"
features = ["v3_10"] features = ["v3_10"]

View File

@ -1,2 +1,2 @@
test: test:
cargo test RUST_BACKTRACE=1 cargo test

View File

@ -1,6 +1,5 @@
fn main() { fn main() {
if cfg!(target = "windows") { if cfg!(target_os = "windows") {
println!("cargo:rustc-link-search=native=C:\\msys64\\mingw64\\lib"); println!("cargo:rustc-link-search=native=C:\\msys64\\mingw64\\lib");
} }
} }

View File

@ -14,7 +14,7 @@ fn main() {
let ui = Ui::new(); let ui = Ui::new();
ui.show(); ui.show();
Nvim::start(ui).expect("Can't start nvim instance"); let nvim = Nvim::start(ui).expect("Can't start nvim instance");
gtk::main(); gtk::main();
} }

View File

@ -13,7 +13,11 @@ pub trait RedrawEvents {
impl Nvim { impl Nvim {
pub fn start(mut ui: Ui) -> Result<Nvim> { pub fn start(mut ui: Ui) -> Result<Nvim> {
// let mut session = try!(Session::new_tcp("127.0.0.1:6666")); // let mut session = try!(Session::new_tcp("127.0.0.1:6666"));
let mut session = try!(Session::new_child()); let mut session = if cfg!(target_os = "windows") {
Session::new_child_path("E:\\Neovim\\bin\\nvim.exe").unwrap()
} else {
Session::new_child().unwrap()
};
let mut nvim = Neovim::new(session); let mut nvim = Neovim::new(session);
nvim.session.start_event_loop_cb(move |m, p| Nvim::cb(&mut ui, m, p)); nvim.session.start_event_loop_cb(move |m, p| Nvim::cb(&mut ui, m, p));