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)",
"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)",
"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)",
]
@ -193,10 +193,18 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "neovim-lib"
version = "0.1.0"
name = "log"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
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-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)",

View File

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

View File

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

View File

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

View File

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

View File

@ -13,7 +13,11 @@ pub trait RedrawEvents {
impl 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_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);
nvim.session.start_event_loop_cb(move |m, p| Nvim::cb(&mut ui, m, p));