From be6c8722800427727517feaaa74ccd9e24434155 Mon Sep 17 00:00:00 2001 From: daa84 Date: Fri, 2 Jun 2017 17:54:24 +0300 Subject: [PATCH 1/6] Implement imcontext (also must fix #6 on linux) --- Cargo.lock | 226 ++++++++++++++++++++++++------------------------ Cargo.toml | 39 +++++++-- src/input.rs | 10 ++- src/main.rs | 2 + src/settings.rs | 2 + src/shell.rs | 130 +++++++++++++++++++++------- src/ui.rs | 4 +- 7 files changed, 257 insertions(+), 156 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 97f4f94..b5b218b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,20 +2,22 @@ name = "nvim-gtk" version = "0.1.2" dependencies = [ - "cairo-rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", + "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gtk 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gtk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.5.3 (git+https://github.com/gtk-rs/gdk)", + "gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gio 0.1.3 (git+https://github.com/gtk-rs/gio)", + "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gtk 0.1.3 (git+https://github.com/daa84/gtk)", + "gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "neovim-lib 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "pangocairo 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.1.3 (git+https://github.com/gtk-rs/pango)", + "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "pangocairo 0.1.3 (git+https://github.com/RazrFalcon/pangocairo-rs)", "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -34,11 +36,11 @@ dependencies = [ [[package]] name = "atk-sys" version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/sys#518d3a5dad0d8af2c0ff02180e369bf4f4f16a73" dependencies = [ "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -66,11 +68,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cairo-rs" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/cairo#94beb78be68b1aca2cba0ece84b526687f6fd623" dependencies = [ "c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", + "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -78,7 +80,7 @@ dependencies = [ [[package]] name = "cairo-sys-rs" version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/cairo#94beb78be68b1aca2cba0ece84b526687f6fd623" dependencies = [ "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -102,40 +104,40 @@ dependencies = [ [[package]] name = "gdk" version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/gdk#7c6ed03f875a6cedb5b77343db42eb45de481a1c" dependencies = [ "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", + "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", + "gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)", + "gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gio 0.1.3 (git+https://github.com/gtk-rs/gio)", + "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.1.3 (git+https://github.com/gtk-rs/pango)", ] [[package]] name = "gdk-pixbuf" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/gdk-pixbuf#09fafcfc515b9866d4aa88b026cc2261bf322350" dependencies = [ - "gdk-pixbuf-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-pixbuf-sys" version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/sys#518d3a5dad0d8af2c0ff02180e369bf4f4f16a73" dependencies = [ "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -143,40 +145,40 @@ dependencies = [ [[package]] name = "gdk-sys" version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/sys#518d3a5dad0d8af2c0ff02180e369bf4f4f16a73" dependencies = [ "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", + "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gio" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/gio#7f54acd011ae831a7827c02170d9b90208128a26" dependencies = [ "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gio-sys" version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/sys#518d3a5dad0d8af2c0ff02180e369bf4f4f16a73" dependencies = [ "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -184,11 +186,11 @@ dependencies = [ [[package]] name = "glib" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/glib#691ad4a4b715c1747d1acf627999b755eb1745fd" dependencies = [ "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -196,7 +198,7 @@ dependencies = [ [[package]] name = "glib-sys" version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/sys#518d3a5dad0d8af2c0ff02180e369bf4f4f16a73" dependencies = [ "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -206,10 +208,10 @@ dependencies = [ [[package]] name = "gobject-sys" version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/sys#518d3a5dad0d8af2c0ff02180e369bf4f4f16a73" dependencies = [ "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -217,40 +219,40 @@ dependencies = [ [[package]] name = "gtk" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/daa84/gtk#3868aa883ab6ee18c7e2f8076dc71facae30cffc" dependencies = [ "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gtk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", + "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", + "gdk 0.5.3 (git+https://github.com/gtk-rs/gdk)", + "gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)", + "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gio 0.1.3 (git+https://github.com/gtk-rs/gio)", + "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.1.3 (git+https://github.com/gtk-rs/pango)", ] [[package]] name = "gtk-sys" version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/sys#518d3a5dad0d8af2c0ff02180e369bf4f4f16a73" dependencies = [ - "atk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "atk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", + "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -310,22 +312,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pango" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/pango#4a974b5bda739077e4ef9fc6720b1f76dc8f3491" dependencies = [ "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", ] [[package]] name = "pango-sys" version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/gtk-rs/sys#518d3a5dad0d8af2c0ff02180e369bf4f4f16a73" dependencies = [ "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -333,24 +335,24 @@ dependencies = [ [[package]] name = "pangocairo" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/RazrFalcon/pangocairo-rs#532494fde8c4296b232582e23a28498adb5486a1" dependencies = [ - "cairo-rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pangocairo-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", + "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", + "pango 0.1.3 (git+https://github.com/gtk-rs/pango)", + "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "pangocairo-sys 0.3.4 (git+https://github.com/RazrFalcon/pangocairo-rs)", ] [[package]] name = "pangocairo-sys" version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/RazrFalcon/pangocairo-rs#532494fde8c4296b232582e23a28498adb5486a1" dependencies = [ - "cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -558,26 +560,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" -"checksum atk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d7a9635b2b56a4925bf9c9b14cb7cad91eb2c3ca1eb04671a525b9e729b5c0a2" +"checksum atk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" "checksum bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23" "checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4" "checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8" "checksum c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6237ac5a4b1e81c213c24c6437964c61e646df910a914b4ab1487b46df20bd13" -"checksum cairo-rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0180a8b65dc13e78479c6a47c4d5f094d64dc34465a9433c6daef9ae2fbfb3ee" -"checksum cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a2414b86c20c40dfb56a98b1dbca05bde56411f488d268c4289a86df1b648c61" +"checksum cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)" = "" +"checksum cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)" = "" "checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c" "checksum env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e3856f1697098606fc6cb97a93de88ca3f3bc35bb878c725920e6e82ecf05e83" -"checksum gdk 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f5cc612be763b8a63cee5fb8d444d9869a8690f12c199535329bcba716de5e5" -"checksum gdk-pixbuf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65506bc318d83947c3ee458cec22c35377a941770e0b762e35fbb491e91d012f" -"checksum gdk-pixbuf-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3c977528255ba4f1dfaecfb697c630996c4f5a6a3b1fbc08ff7bdeb3f754c3" -"checksum gdk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c11dcde28f6ddf0bc6a93cec5205aafb034c318d99147a9668d455d66e5ba749" -"checksum gio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1b5f3ca1ee702ff9f5fea73ebb33ad8d007f2e77b8179d90689c919ef328da32" -"checksum gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "963cf38f6575843b98fe7d39d426c4c0025b6f965a9a8b8c0165aface866400a" -"checksum glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "81f514a8abd315ede0e94e39ce5987fdb99191c5f812e5066bc5bdb965104fc4" -"checksum glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8826cbc94631507bdd91ee40f7e099bfaa3cc4f43c086b4d1c15cff5b4e8220b" -"checksum gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "87373f64e136e9ea192ff5d3ef676a51e9ac6ab06b629223a081e0523c5f04e2" -"checksum gtk 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78d69fb7425fd6efba3b0c99f952b130fa4a0fdfdffbceb2b40ba018b2ed6a77" -"checksum gtk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9391d0b50af734dbd54582d1836d0346d8daf6dc5e7f272afea96f4dcaf50b74" +"checksum gdk 0.5.3 (git+https://github.com/gtk-rs/gdk)" = "" +"checksum gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)" = "" +"checksum gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" +"checksum gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" +"checksum gio 0.1.3 (git+https://github.com/gtk-rs/gio)" = "" +"checksum gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" +"checksum glib 0.1.3 (git+https://github.com/gtk-rs/glib)" = "" +"checksum glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" +"checksum gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" +"checksum gtk 0.1.3 (git+https://github.com/daa84/gtk)" = "" +"checksum gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" "checksum htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" @@ -586,10 +588,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" "checksum neovim-lib 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cd81cd2140309fcbe61775ebe5901b0730e5fdae2558a6cd27539e6e730fa76a" "checksum num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "e1cbfa3781f3fe73dc05321bed52a06d2d491eaa764c52335cf4399f046ece99" -"checksum pango 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4215233226ff03c9a3ed7c85cbc3c58257203723e3a93d5a20ce3560f66261b7" -"checksum pango-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e401ee469540e60a80d1df63dcea4e9c201115e79344b77529fa3705ea8eadcd" -"checksum pangocairo 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1994752fcd20dbefd084a3c231bbcd79ebe67ca2e7f9cd11db0243b64f155c35" -"checksum pangocairo-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02eeea9019eeb6ea32c170664247cac130d871f28902376de3c8b30f001b9e7b" +"checksum pango 0.1.3 (git+https://github.com/gtk-rs/pango)" = "" +"checksum pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" +"checksum pangocairo 0.1.3 (git+https://github.com/RazrFalcon/pangocairo-rs)" = "" +"checksum pangocairo-sys 0.3.4 (git+https://github.com/RazrFalcon/pangocairo-rs)" = "" "checksum phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "cb325642290f28ee14d8c6201159949a872f220c62af6e110a56ea914fbe42fc" "checksum phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d62594c0bb54c464f633175d502038177e90309daf2e0158be42ed5f023ce88f" "checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03" diff --git a/Cargo.toml b/Cargo.toml index 21b9c8b..9512cea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,16 +5,26 @@ authors = ["daa84 "] build = "build.rs" [dependencies] -cairo-rs = "0.1" -pango = "0.1" -pangocairo = "0.1" -glib = "0.1" -glib-sys = "0.3" -gdk = "0.5" -gdk-sys = "0.3" +#cairo-rs = "0.1" +#pango = "0.1" +#pangocairo = "0.1" +#glib = "0.1" +#glib-sys = "0.3" +#gdk = "0.5" +#gdk-sys = "0.3" +#gio = "0.1" +gdk = { git = 'https://github.com/gtk-rs/gdk' } +gdk-sys = { git = 'https://github.com/gtk-rs/sys' } +glib = { git = 'https://github.com/gtk-rs/glib' } +glib-sys = { git = 'https://github.com/gtk-rs/sys' } +cairo-rs = { git = 'https://github.com/gtk-rs/cairo' } +cairo-sys-rs = { git = 'https://github.com/gtk-rs/cairo' } +pango = { git = 'https://github.com/gtk-rs/pango' } +pango-sys = { git = 'https://github.com/gtk-rs/sys' } +gio = { git = 'https://github.com/gtk-rs/gio' } +pangocairo = { git = 'https://github.com/RazrFalcon/pangocairo-rs' } neovim-lib = "0.4" phf = "0.7" -gio = "0.1" log = "0.3" env_logger = "0.4" htmlescape = "0.3" @@ -32,8 +42,21 @@ phf_codegen = "0.7" [dependencies.gtk] version = "0.1" features = ["v3_22"] +git = "https://github.com/daa84/gtk" [dependencies.gtk-sys] version = "0.3" features = ["v3_22"] +git = 'https://github.com/gtk-rs/sys' +[replace] +"gdk:0.5.3" = { git = 'https://github.com/gtk-rs/gdk' } +"gdk-sys:0.3.4" = { git = 'https://github.com/gtk-rs/sys' } +"glib:0.1.3" = { git = 'https://github.com/gtk-rs/glib' } +"glib-sys:0.3.4" = { git = 'https://github.com/gtk-rs/sys' } +"cairo-rs:0.1.3" = { git = 'https://github.com/gtk-rs/cairo' } +"cairo-sys-rs:0.3.4" = { git = 'https://github.com/gtk-rs/cairo' } +"pango:0.1.3" = { git = 'https://github.com/gtk-rs/pango' } +"pango-sys:0.3.4" = { git = 'https://github.com/gtk-rs/sys' } +"gtk-sys:0.3.4" = { git = 'https://github.com/gtk-rs/sys' } +"gio:0.1.3" = { git = 'https://github.com/gtk-rs/gio' } diff --git a/src/input.rs b/src/input.rs index cd553b8..be3edfb 100644 --- a/src/input.rs +++ b/src/input.rs @@ -77,11 +77,17 @@ pub fn convert_key(ev: &EventKey) -> Option { } } +pub fn im_input(nvim: &mut Neovim, input: &str) { + println!("im input {}", input); + debug!("nvim_input -> {}", input); + nvim.input(&input).expect("Error run input command to nvim"); +} + pub fn gtk_key_press(nvim: &mut Neovim, ev: &EventKey) -> Inhibit { + println!("keyval {:?}", gdk::keyval_name(ev.get_keyval())); if let Some(input) = convert_key(ev) { debug!("nvim_input -> {}", input); - nvim.input(&input) - .expect("Error run input command to nvim"); + nvim.input(&input).expect("Error run input command to nvim"); Inhibit(true) } else { Inhibit(false) diff --git a/src/main.rs b/src/main.rs index 982fcfd..ea8cdf0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,6 +32,8 @@ mod popup_menu; mod project; mod tabline; +use gtk::prelude::*; + use std::env; use gio::ApplicationExt; diff --git a/src/settings.rs b/src/settings.rs index 1e64cfa..1e942a8 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -1,6 +1,8 @@ use std::rc::{Rc, Weak}; use std::cell::RefCell; +use gio::SettingsExt; + #[cfg(unix)] use nvim::RepaintMode; diff --git a/src/shell.rs b/src/shell.rs index 044c12b..f801d63 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -7,7 +7,8 @@ use std::ops::Deref; use cairo; use pangocairo::CairoContextExt; use pango; -use pango::FontDescription; +use pango::{LayoutExt, FontDescription}; +use gdk; use gdk::{ModifierType, EventConfigure, EventButton, EventMotion, EventType, EventScroll}; use gdk_sys; use glib; @@ -55,6 +56,7 @@ pub struct State { drawing_area: gtk::DrawingArea, tabs: Tabline, + im_context: gtk::IMMulticontext, line_height: Option, char_width: Option, @@ -85,6 +87,7 @@ impl State { drawing_area, tabs: Tabline::new(), + im_context: gtk::IMMulticontext::new(), line_height: None, char_width: None, @@ -146,14 +149,12 @@ impl State { pub fn open_file(&self, path: &str) { let mut nvim = self.nvim(); - nvim.command(&format!("e {}", path)) - .report_err(&mut *nvim); + nvim.command(&format!("e {}", path)).report_err(&mut *nvim); } pub fn cd(&self, path: &str) { let mut nvim = self.nvim(); - nvim.command(&format!("cd {}", path)) - .report_err(&mut *nvim); + nvim.command(&format!("cd {}", path)).report_err(&mut *nvim); } fn request_resize(&mut self) { @@ -183,6 +184,12 @@ impl State { _ => self.drawing_area.queue_draw(), } } + + fn im_commit(&self, ch: &str) { + if let Some(ref nvim) = self.nvim { + input::im_input(&mut *nvim.borrow_mut(), ch); + } + } } pub struct UiState { @@ -224,6 +231,8 @@ impl Shell { state.drawing_area.set_vexpand(true); state.drawing_area.set_can_focus(true); + state.im_context.set_use_preedit(false); + self.widget.pack_start(&*state.tabs, false, true, 0); self.widget.pack_start(&state.drawing_area, true, true, 0); @@ -276,11 +285,32 @@ impl Shell { state .drawing_area .connect_key_press_event(move |_, ev| { - let mut shell = ref_state.borrow_mut(); - shell.cursor.as_mut().unwrap().reset_state(); - let mut nvim = shell.nvim(); - input::gtk_key_press(&mut *nvim, ev) - }); + let mut shell = ref_state.borrow_mut(); + shell.cursor.as_mut().unwrap().reset_state(); + // TODO: improve + // GtkIMContext will eat a Shift-Space and not tell us about shift. + // Also don't let IME eat any GDK_KEY_KP_ events + if !ev.get_state().contains(gdk::SHIFT_MASK) && + ev.get_keyval() < gdk_sys::GDK_KEY_KP_Space as u32 && + ev.get_keyval() > gdk_sys::GDK_KEY_KP_Divide as u32 && + shell.im_context.filter_keypress(ev) { + println!("Filter"); + Inhibit(true) + } else { + if let Some(ref nvim) = shell.nvim { + input::gtk_key_press(&mut *nvim.borrow_mut(), ev) + } else { + Inhibit(false) + } + } + }); + let ref_state = self.state.clone(); + state + .drawing_area + .connect_key_release_event(move |_, ev| { + ref_state.borrow().im_context.filter_keypress(ev); + Inhibit(false) + }); let ref_state = self.state.clone(); state @@ -296,6 +326,22 @@ impl Shell { state .drawing_area .connect_focus_out_event(move |_, _| gtk_focus_out(&mut *ref_state.borrow_mut())); + + let ref_state = self.state.clone(); + state + .drawing_area + .connect_realize(move |w| { + ref_state + .borrow() + .im_context + .set_client_window(w.get_window().as_ref()) + }); + + let ref_state = self.state.clone(); + state + .im_context + .connect_commit(move |_, ch| ref_state.borrow().im_commit(ch)); + } #[cfg(unix)] @@ -320,8 +366,8 @@ impl Shell { } pub fn init_nvim(&mut self, nvim_bin_path: Option<&String>) { - let nvim = - nvim::initialize(self.state.clone(), nvim_bin_path).expect("Can't start nvim instance"); + let nvim = nvim::initialize(self.state.clone(), nvim_bin_path) + .expect("Can't start nvim instance"); let mut state = self.state.borrow_mut(); state.nvim = Some(Rc::new(RefCell::new(nvim))); } @@ -364,13 +410,14 @@ impl Shell { impl Deref for Shell { type Target = gtk::Box; - + fn deref(&self) -> >k::Box { &self.widget } } fn gtk_focus_in(state: &mut State) -> Inhibit { + state.im_context.focus_in(); state.cursor.as_mut().unwrap().enter_focus(); let point = state.model.cur_point(); state.on_redraw(&RepaintMode::Area(point)); @@ -378,6 +425,7 @@ fn gtk_focus_in(state: &mut State) -> Inhibit { } fn gtk_focus_out(state: &mut State) -> Inhibit { + state.im_context.focus_out(); state.cursor.as_mut().unwrap().leave_focus(); let point = state.model.cur_point(); state.on_redraw(&RepaintMode::Area(point)); @@ -457,6 +505,19 @@ fn gtk_draw(parent: &ui::Components, state: &mut State, ctx: &cairo::Context) -> state.char_width = Some(width as f64); } + //TODO: to much call of this function + let (row, col) = state.model.get_cursor(); + let (x, y, width, height) = ModelRect::point(col, row) + .to_area(state.line_height.unwrap(), state.char_width.unwrap()); + state + .im_context + .set_cursor_location(&gdk::Rectangle { + x, + y, + width, + height, + }); + draw(state, ctx); request_window_resize(parent, state); @@ -500,7 +561,7 @@ fn draw_backgound(state: &State, if !draw_bitmap.get(col_idx, line_idx) { let (bg, _) = state.colors(cell); - + if &state.bg_color != bg { ctx.set_source_rgb(bg.0, bg.1, bg.2); ctx.rectangle(current_point.0, current_point.1, char_width, line_height); @@ -533,15 +594,21 @@ fn draw(state: &State, ctx: &cairo::Context) { for clip_idx in 0..clip_rects.len() { let clip = clip_rects.get(clip_idx).unwrap(); - let model_clip = get_model_clip(state, - line_height, - char_width, - (clip.x, clip.y, clip.x + clip.width, clip.y + clip.height)); + let model_clip = + get_model_clip(state, + line_height, + char_width, + (clip.x, clip.y, clip.x + clip.width, clip.y + clip.height)); let line_x = model_clip.left as f64 * char_width; let mut line_y: f64 = model_clip.top as f64 * line_height; - draw_backgound(state, &draw_bitmap, ctx, line_height, char_width, &model_clip); + draw_backgound(state, + &draw_bitmap, + ctx, + line_height, + char_width, + &model_clip); for (line_idx, line) in state.model.clip_model(&model_clip) { @@ -705,9 +772,7 @@ fn gtk_configure_event(state: &Arc>, ev: &EventConfigure) -> bool let rows = (height as f64 / line_height).trunc() as usize; let columns = (width as f64 / char_width).trunc() as usize; if state_ref.model.rows != rows || state_ref.model.columns != columns { - if let Err(err) = state_ref - .nvim() - .ui_try_resize(columns as u64, rows as u64) { + if let Err(err) = state_ref.nvim().ui_try_resize(columns as u64, rows as u64) { println!("Error trying resize nvim {}", err); } } @@ -859,13 +924,9 @@ impl RedrawEvents for State { let point = ModelRect::point(col as usize, row as usize); let (x, y, width, height) = point.to_area(line_height, char_width); - self.popup_menu.borrow_mut().show(&self, - menu, - selected, - x, - y, - width, - height); + self.popup_menu + .borrow_mut() + .show(&self, menu, selected, x, y, width, height); } _ => (), }; @@ -884,8 +945,12 @@ impl RedrawEvents for State { } - fn tabline_update(&mut self, selected: Tabpage, tabs: Vec<(Tabpage, Option<&str>)>) -> RepaintMode { - self.tabs.update_tabs(&self.nvim.as_ref().unwrap(), &selected, &tabs); + fn tabline_update(&mut self, + selected: Tabpage, + tabs: Vec<(Tabpage, Option<&str>)>) + -> RepaintMode { + self.tabs + .update_tabs(&self.nvim.as_ref().unwrap(), &selected, &tabs); RepaintMode::Nothing } @@ -910,7 +975,7 @@ impl ModelBitamp { pub fn new(cols: usize, rows: usize) -> ModelBitamp { let words_for_cols = cols / 64 + 1; - ModelBitamp { + ModelBitamp { words_for_cols: words_for_cols, model: vec![0; rows * words_for_cols], } @@ -950,4 +1015,3 @@ mod tests { assert_eq!(false, bitmap.get(62, 22)); } } - diff --git a/src/ui.rs b/src/ui.rs index 24f4010..94e7f3a 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -6,8 +6,10 @@ use std::sync::Arc; use gtk; use gtk_sys; use gtk::prelude::*; +use gtk::ApplicationExt; use gtk::{ApplicationWindow, HeaderBar, ToolButton, Image, AboutDialog}; -use gio::{Menu, MenuItem, SimpleAction}; +use gio::prelude::*; +use gio::{Menu, MenuExt, MenuItem, MenuItemExt, SimpleAction}; use glib; use settings::Settings; From d0f31fb979fbf982d91f3c0d8d587516c84a178b Mon Sep 17 00:00:00 2001 From: daa Date: Sat, 3 Jun 2017 14:41:11 +0300 Subject: [PATCH 2/6] Update Cargo.toml --- Cargo.lock | 6 +++--- Cargo.toml | 13 +------------ 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5b218b..881f1bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,7 +10,7 @@ dependencies = [ "gio 0.1.3 (git+https://github.com/gtk-rs/gio)", "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gtk 0.1.3 (git+https://github.com/daa84/gtk)", + "gtk 0.1.3 (git+https://github.com/gtk-rs/gtk)", "gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -219,7 +219,7 @@ dependencies = [ [[package]] name = "gtk" version = "0.1.3" -source = "git+https://github.com/daa84/gtk#3868aa883ab6ee18c7e2f8076dc71facae30cffc" +source = "git+https://github.com/gtk-rs/gtk#9c2c15e34beac5d2bd7e329160d4e79c0dcb7d02" dependencies = [ "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", @@ -578,7 +578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum glib 0.1.3 (git+https://github.com/gtk-rs/glib)" = "" "checksum glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" "checksum gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" -"checksum gtk 0.1.3 (git+https://github.com/daa84/gtk)" = "" +"checksum gtk 0.1.3 (git+https://github.com/gtk-rs/gtk)" = "" "checksum gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" "checksum htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" diff --git a/Cargo.toml b/Cargo.toml index 9512cea..6631a0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,21 +42,10 @@ phf_codegen = "0.7" [dependencies.gtk] version = "0.1" features = ["v3_22"] -git = "https://github.com/daa84/gtk" +git = "https://github.com/gtk-rs/gtk" [dependencies.gtk-sys] version = "0.3" features = ["v3_22"] git = 'https://github.com/gtk-rs/sys' -[replace] -"gdk:0.5.3" = { git = 'https://github.com/gtk-rs/gdk' } -"gdk-sys:0.3.4" = { git = 'https://github.com/gtk-rs/sys' } -"glib:0.1.3" = { git = 'https://github.com/gtk-rs/glib' } -"glib-sys:0.3.4" = { git = 'https://github.com/gtk-rs/sys' } -"cairo-rs:0.1.3" = { git = 'https://github.com/gtk-rs/cairo' } -"cairo-sys-rs:0.3.4" = { git = 'https://github.com/gtk-rs/cairo' } -"pango:0.1.3" = { git = 'https://github.com/gtk-rs/pango' } -"pango-sys:0.3.4" = { git = 'https://github.com/gtk-rs/sys' } -"gtk-sys:0.3.4" = { git = 'https://github.com/gtk-rs/sys' } -"gio:0.1.3" = { git = 'https://github.com/gtk-rs/gio' } From c2bdaac4baf8abebe596dae0cd17a843114e991e Mon Sep 17 00:00:00 2001 From: daa84 Date: Thu, 8 Jun 2017 17:17:08 +0300 Subject: [PATCH 3/6] Use open signal for files --- Cargo.lock | 10 +++++++-- src/main.rs | 64 ++++++++++++++++++----------------------------------- src/ui.rs | 2 +- 3 files changed, 31 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 881f1bb..e50722d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,6 +55,11 @@ name = "bitflags" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bitflags" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "1.0.0" @@ -161,9 +166,9 @@ dependencies = [ [[package]] name = "gio" version = "0.1.3" -source = "git+https://github.com/gtk-rs/gio#7f54acd011ae831a7827c02170d9b90208128a26" +source = "git+https://github.com/gtk-rs/gio#52757aced2f5e7a24a66fadae1a261cf8a3dd209" dependencies = [ - "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", @@ -563,6 +568,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum atk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" "checksum bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23" "checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4" +"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8" "checksum c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6237ac5a4b1e81c213c24c6437964c61e646df910a914b4ab1487b46df20bd13" "checksum cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)" = "" diff --git a/src/main.rs b/src/main.rs index ea8cdf0..7d5edb1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,10 +32,10 @@ mod popup_menu; mod project; mod tabline; -use gtk::prelude::*; use std::env; -use gio::ApplicationExt; +use gtk::prelude::*; +use gio::{ApplicationExt, FileExt}; use ui::Ui; @@ -44,33 +44,46 @@ const BIN_PATH_ARG: &'static str = "--nvim-bin-path"; fn main() { env_logger::init().expect("Can't initialize env_logger"); + let app_flags = gio::APPLICATION_HANDLES_OPEN; + let app = if cfg!(debug_assertions) { gtk::Application::new(Some("org.daa.NeovimGtkDebug"), - gio::ApplicationFlags::empty()) + app_flags) } else { - gtk::Application::new(Some("org.daa.NeovimGtk"), gio::ApplicationFlags::empty()) + gtk::Application::new(Some("org.daa.NeovimGtk"), app_flags) } .expect("Failed to initialize GTK application"); app.connect_activate(activate); + { + use gio::ApplicationExtManual; + app.connect_open(open); + } let args: Vec = env::args().collect(); - let mut argv: Vec<&str> = args.iter() + let argv: Vec<&str> = args.iter() .filter(|a| !a.starts_with(BIN_PATH_ARG)) .map(String::as_str) .collect(); - if open_arg().is_some() { - argv.pop(); - } app.run(argv.len() as i32, &argv); } +fn open(app: >k::Application, files: &[gio::File], _: &str) { + for f in files { + let mut ui = Ui::new(); + + ui.init(app, + nvim_bin_path(std::env::args()).as_ref(), + f.get_path().as_ref().map(|p| p.to_str()).unwrap_or(None)); + } +} + fn activate(app: >k::Application) { let mut ui = Ui::new(); ui.init(app, nvim_bin_path(std::env::args()).as_ref(), - open_arg().as_ref()); + None); } fn nvim_bin_path(args: I) -> Option @@ -82,23 +95,6 @@ fn nvim_bin_path(args: I) -> Option .unwrap_or(None) } -fn open_arg() -> Option { - open_arg_impl(std::env::args()) -} - -fn open_arg_impl(args: I) -> Option - where I: Iterator -{ - args.skip(1) - .last() - .map(|a| if !a.starts_with("-") { - Some(a.to_owned()) - } else { - None - }) - .unwrap_or(None) -} - #[cfg(test)] mod tests { use super::*; @@ -110,20 +106,4 @@ mod tests { .iter() .map(|s| s.to_string()))); } - - #[test] - fn test_open_arg() { - assert_eq!(Some("some_file.txt".to_string()), - open_arg_impl(vec!["neovim-gtk", - "--nvim-bin-path=/test_path", - "some_file.txt"] - .iter() - .map(|s| s.to_string()))); - } - - #[test] - fn test_empty_open_arg() { - assert_eq!(None, - open_arg_impl(vec!["neovim-gtk"].iter().map(|s| s.to_string()))); - } } diff --git a/src/ui.rs b/src/ui.rs index 94e7f3a..300cd54 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -73,7 +73,7 @@ impl Ui { pub fn init(&mut self, app: >k::Application, nvim_bin_path: Option<&String>, - open_path: Option<&String>) { + open_path: Option<&str>) { if self.initialized { return; } From 367a7815f86103048d718c4ebbec7f393eac692a Mon Sep 17 00:00:00 2001 From: daa84 Date: Wed, 16 Aug 2017 12:41:22 +0300 Subject: [PATCH 4/6] Update to new lib versions, small cleanup --- Cargo.lock | 162 +++++++++++++++-------- src/shell.rs | 365 ++++++++++++++++++++++++++------------------------- src/ui.rs | 1 - 3 files changed, 294 insertions(+), 234 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8118d67..d5c7fac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,9 +20,9 @@ dependencies = [ "pangocairo 0.1.3 (git+https://github.com/RazrFalcon/pangocairo-rs)", "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -36,15 +36,20 @@ dependencies = [ [[package]] name = "atk-sys" version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#9354d21dfdb9174bfecafbd75cf2a7c0c8ba5759" +source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "bitflags" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bitflags" version = "0.9.1" @@ -63,21 +68,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cairo-rs" version = "0.1.3" -source = "git+https://github.com/gtk-rs/cairo#ef0c3315a57b5cd7134801779c111c6b7d84a410" +source = "git+https://github.com/gtk-rs/cairo#7ab279c6393f87d86019671dda5206622e68fb7d" dependencies = [ "c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cairo-sys-rs" version = "0.3.4" -source = "git+https://github.com/gtk-rs/cairo#ef0c3315a57b5cd7134801779c111c6b7d84a410" +source = "git+https://github.com/gtk-rs/cairo#7ab279c6393f87d86019671dda5206622e68fb7d" dependencies = [ - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -87,6 +93,19 @@ name = "cfg-if" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "conv" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "custom_derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "env_logger" version = "0.4.3" @@ -99,7 +118,7 @@ dependencies = [ [[package]] name = "gdk" version = "0.5.3" -source = "git+https://github.com/gtk-rs/gdk#6f6487a46874be4e96659f6697b480a8345d2690" +source = "git+https://github.com/gtk-rs/gdk#cdb612c726c6b5e507534dcdd1dc549459b3869a" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", @@ -110,37 +129,39 @@ dependencies = [ "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pango 0.1.3 (git+https://github.com/gtk-rs/pango)", ] [[package]] name = "gdk-pixbuf" version = "0.1.3" -source = "git+https://github.com/gtk-rs/gdk-pixbuf#1888102253747deda678d0ec99b7e4f018c8a6d0" +source = "git+https://github.com/gtk-rs/gdk-pixbuf#cc1c9ab464bcf58624c3969cbe080292f98a43cf" dependencies = [ "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-pixbuf-sys" version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#9354d21dfdb9174bfecafbd75cf2a7c0c8ba5759" +source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-sys" version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#9354d21dfdb9174bfecafbd75cf2a7c0c8ba5759" +source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", @@ -148,7 +169,7 @@ dependencies = [ "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -156,65 +177,65 @@ dependencies = [ [[package]] name = "gio" version = "0.1.3" -source = "git+https://github.com/gtk-rs/gio#795aafa2a0ade0bdaec86f96f1bc85b0363f6793" +source = "git+https://github.com/gtk-rs/gio#2b2b061baf5c9410b3faac0fff28650dc773e750" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gio-sys" version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#9354d21dfdb9174bfecafbd75cf2a7c0c8ba5759" +source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glib" version = "0.1.3" -source = "git+https://github.com/gtk-rs/glib#f874842c0a660165c08c2b522551cd6673431b39" +source = "git+https://github.com/gtk-rs/glib#dc304963b10e8950b71a73ab7c9620c931ef7950" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glib-sys" version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#9354d21dfdb9174bfecafbd75cf2a7c0c8ba5759" +source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gobject-sys" version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#9354d21dfdb9174bfecafbd75cf2a7c0c8ba5759" +source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gtk" version = "0.1.3" -source = "git+https://github.com/gtk-rs/gtk#d2aa123e5d791affb681347e42b73cb383ab620b" +source = "git+https://github.com/gtk-rs/gtk#d3fb35605254f794c4cf669f49d0cdfe09dfc9dc" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", @@ -229,14 +250,14 @@ dependencies = [ "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pango 0.1.3 (git+https://github.com/gtk-rs/pango)", ] [[package]] name = "gtk-sys" version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#9354d21dfdb9174bfecafbd75cf2a7c0c8ba5759" +source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" dependencies = [ "atk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -246,7 +267,7 @@ dependencies = [ "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -263,7 +284,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.26" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -271,12 +292,29 @@ name = "log" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "magenta" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "magenta-sys" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "memchr" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -292,39 +330,43 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.1.39" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pango" version = "0.1.3" -source = "git+https://github.com/gtk-rs/pango#6ab128152a174a84cf32bfedffa337792d0ca9e4" +source = "git+https://github.com/gtk-rs/pango#df1ed7040f41aba0266fabf1c000e36d77c75106" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", ] [[package]] name = "pango-sys" version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#9354d21dfdb9174bfecafbd75cf2a7c0c8ba5759" +source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pangocairo" version = "0.1.3" -source = "git+https://github.com/RazrFalcon/pangocairo-rs#55478cb05eb716e262d3a88777995d4aa33146a0" +source = "git+https://github.com/RazrFalcon/pangocairo-rs#ad91334f8a9a473b767c045d001d373038fd6db1" dependencies = [ "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", + "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "pango 0.1.3 (git+https://github.com/gtk-rs/pango)", "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "pangocairo-sys 0.3.4 (git+https://github.com/RazrFalcon/pangocairo-rs)", @@ -333,11 +375,11 @@ dependencies = [ [[package]] name = "pangocairo-sys" version = "0.3.4" -source = "git+https://github.com/RazrFalcon/pangocairo-rs#55478cb05eb716e262d3a88777995d4aa33146a0" +source = "git+https://github.com/RazrFalcon/pangocairo-rs#ad91334f8a9a473b767c045d001d373038fd6db1" dependencies = [ "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -365,7 +407,7 @@ version = "0.7.21" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -388,10 +430,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rand" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", + "magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -417,7 +460,7 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -425,18 +468,18 @@ name = "rmpv" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "rmp 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -487,10 +530,10 @@ dependencies = [ [[package]] name = "toml" -version = "0.4.2" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -504,7 +547,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -533,12 +576,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" "checksum atk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" +"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d" "checksum c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6237ac5a4b1e81c213c24c6437964c61e646df910a914b4ab1487b46df20bd13" "checksum cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)" = "" "checksum cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)" = "" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" +"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" +"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" "checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" "checksum gdk 0.5.3 (git+https://github.com/gtk-rs/gdk)" = "" "checksum gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)" = "" @@ -553,11 +599,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" "checksum htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163" "checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" -"checksum libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "30885bcb161cf67054244d10d4a7f4835ffd58773bc72e07d35fecf472295503" +"checksum libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)" = "8a014d9226c2cc402676fbe9ea2e15dd5222cd1dd57f576b5b283178c944a264" "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" +"checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527" +"checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699" "checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" "checksum neovim-lib 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cd81cd2140309fcbe61775ebe5901b0730e5fdae2558a6cd27539e6e730fa76a" -"checksum num-traits 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "1708c0628602a98b52fad936cf3edb9a107af06e52e49fdf0707e884456a6af6" +"checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" "checksum pango 0.1.3 (git+https://github.com/gtk-rs/pango)" = "" "checksum pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" "checksum pangocairo 0.1.3 (git+https://github.com/RazrFalcon/pangocairo-rs)" = "" @@ -568,19 +616,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2" "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d" +"checksum rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "eb250fd207a4729c976794d03db689c9be1d634ab5a1c9da9492a13d8fecbcdf" "checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b" "checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db" "checksum rmp 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7ce560a5728f4eec697f07f8d7fa20608893d44b4f5b8f9f5f51a2987f3cffe2" "checksum rmpv 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "45368daa6c60116376d8813ec6a2556df640229709becb8f80df1651f882e7af" -"checksum serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6a7c6b751a2e8d5df57a5ff71b5b4fc8aaee9ee28ff1341d640dd130bb5f4f7a" -"checksum serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "2f6ca58905ebd3c3b285a8a6d4f3ac92b92c0d7951d5649b1bdd212549c06639" +"checksum serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f7726f29ddf9731b17ff113c461e362c381d9d69433f79de4f3dd572488823e9" +"checksum serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cf823e706be268e73e7747b147aa31c8f633ab4ba31f115efb57e5047c3a76dd" "checksum serde_derive_internals 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37aee4e0da52d801acfbc0cc219eb1eda7142112339726e427926a6f6ee65d3a" "checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" -"checksum toml 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b0601da6c97135c8d330c7a13a013ca6cd4143221b01de2f8d4edc50a9e551c7" +"checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" diff --git a/src/shell.rs b/src/shell.rs index 2328f67..1f87a20 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -134,7 +134,8 @@ impl State { } pub fn set_detach_cb(&mut self, cb: Option) - where F: FnMut() + Send + 'static + where + F: FnMut() + Send + 'static, { if cb.is_some() { self.detach_cb = Some(Box::new(RefCell::new(cb.unwrap()))); @@ -227,7 +228,7 @@ impl State { let desc = self.create_pango_font(); layout.set_font_description(Some(&desc)); - layout.set_text("A", -1); + layout.set_text("A"); layout.get_pixel_size() } @@ -244,8 +245,10 @@ impl State { if let Some(line_height) = self.line_height { if let Some(char_width) = self.char_width { let alloc = self.drawing_area.get_allocation(); - return Some(((alloc.width as f64 / char_width).trunc() as usize, - (alloc.height as f64 / line_height).trunc() as usize)); + return Some(( + (alloc.width as f64 / char_width).trunc() as usize, + (alloc.height as f64 / line_height).trunc() as usize, + )); } } @@ -255,9 +258,9 @@ impl State { fn show_error_area(&self) { let stack = self.stack.clone(); gtk::idle_add(move || { - stack.set_visible_child_name("Error"); - Continue(false) - }); + stack.set_visible_child_name("Error"); + Continue(false) + }); } } @@ -332,114 +335,106 @@ impl Shell { self.widget.pack_start(&state.stack, true, true, 0); - state - .drawing_area - .set_events((gdk_sys::GDK_BUTTON_RELEASE_MASK | gdk_sys::GDK_BUTTON_PRESS_MASK | - gdk_sys::GDK_BUTTON_MOTION_MASK | - gdk_sys::GDK_SCROLL_MASK) - .bits() as i32); + state.drawing_area.set_events( + (gdk_sys::GDK_BUTTON_RELEASE_MASK | gdk_sys::GDK_BUTTON_PRESS_MASK | + gdk_sys::GDK_BUTTON_MOTION_MASK | + gdk_sys::GDK_SCROLL_MASK) + .bits() as i32, + ); let ref_state = self.state.clone(); let ref_ui_state = self.ui_state.clone(); - state - .drawing_area - .connect_button_press_event(move |_, ev| { - gtk_button_press(&mut *ref_state.borrow_mut(), - &mut *ref_ui_state.borrow_mut(), - ev) - }); + state.drawing_area.connect_button_press_event(move |_, ev| { + gtk_button_press( + &mut *ref_state.borrow_mut(), + &mut *ref_ui_state.borrow_mut(), + ev, + ) + }); let ref_ui_state = self.ui_state.clone(); - state - .drawing_area - .connect_button_release_event(move |_, _| { - gtk_button_release(&mut *ref_ui_state.borrow_mut()) - }); + state.drawing_area.connect_button_release_event( + move |_, _| { + gtk_button_release(&mut *ref_ui_state.borrow_mut()) + }, + ); let ref_state = self.state.clone(); let ref_ui_state = self.ui_state.clone(); - state - .drawing_area - .connect_motion_notify_event(move |_, ev| { - gtk_motion_notify(&mut *ref_state.borrow_mut(), - &mut *ref_ui_state.borrow_mut(), - ev) - }); + state.drawing_area.connect_motion_notify_event( + move |_, ev| { + gtk_motion_notify( + &mut *ref_state.borrow_mut(), + &mut *ref_ui_state.borrow_mut(), + ev, + ) + }, + ); let ref_state = self.state.clone(); - state - .drawing_area - .connect_draw(move |_, ctx| gtk_draw(&ref_state, ctx)); + state.drawing_area.connect_draw( + move |_, ctx| gtk_draw(&ref_state, ctx), + ); let ref_state = self.state.clone(); - state - .drawing_area - .connect_key_press_event(move |_, ev| { - let mut shell = ref_state.borrow_mut(); - shell.cursor.as_mut().unwrap().reset_state(); - // TODO: improve - // GtkIMContext will eat a Shift-Space and not tell us about shift. - // Also don't let IME eat any GDK_KEY_KP_ events - if !ev.get_state().contains(gdk::SHIFT_MASK) && - ev.get_keyval() < gdk_sys::GDK_KEY_KP_Space as u32 && - ev.get_keyval() > gdk_sys::GDK_KEY_KP_Divide as u32 && - shell.im_context.filter_keypress(ev) { - println!("Filter"); - Inhibit(true) + state.drawing_area.connect_key_press_event(move |_, ev| { + let mut shell = ref_state.borrow_mut(); + shell.cursor.as_mut().unwrap().reset_state(); + // GtkIMContext will eat a Shift-Space and not tell us about shift. + // Also don't let IME eat any GDK_KEY_KP_ events + if !ev.get_state().contains(gdk::SHIFT_MASK) && + ev.get_keyval() < gdk_sys::GDK_KEY_KP_Space as u32 && + ev.get_keyval() > gdk_sys::GDK_KEY_KP_Divide as u32 && + shell.im_context.filter_keypress(ev) + { + Inhibit(true) + } else { + if shell.nvim.borrow().is_initialized() { + input::gtk_key_press(&mut shell.nvim.borrow_mut(), ev) } else { - if shell.nvim.borrow().is_initialized() { - input::gtk_key_press(&mut shell.nvim.borrow_mut(), ev) - } else { - Inhibit(false) - } + Inhibit(false) } - }); + } + }); let ref_state = self.state.clone(); - state - .drawing_area - .connect_key_release_event(move |_, ev| { - ref_state.borrow().im_context.filter_keypress(ev); - Inhibit(false) - }); + state.drawing_area.connect_key_release_event(move |_, ev| { + ref_state.borrow().im_context.filter_keypress(ev); + Inhibit(false) + }); let ref_state = self.state.clone(); - state - .drawing_area - .connect_scroll_event(move |_, ev| gtk_scroll_event(&mut *ref_state.borrow_mut(), ev)); + state.drawing_area.connect_scroll_event(move |_, ev| { + gtk_scroll_event(&mut *ref_state.borrow_mut(), ev) + }); let ref_state = self.state.clone(); - state - .drawing_area - .connect_focus_in_event(move |_, _| gtk_focus_in(&mut *ref_state.borrow_mut())); + state.drawing_area.connect_focus_in_event(move |_, _| { + gtk_focus_in(&mut *ref_state.borrow_mut()) + }); let ref_state = self.state.clone(); - state - .drawing_area - .connect_focus_out_event(move |_, _| gtk_focus_out(&mut *ref_state.borrow_mut())); + state.drawing_area.connect_focus_out_event(move |_, _| { + gtk_focus_out(&mut *ref_state.borrow_mut()) + }); let ref_state = self.state.clone(); - state - .drawing_area - .connect_realize(move |w| { - ref_state - .borrow() - .im_context - .set_client_window(w.get_window().as_ref()) - }); + state.drawing_area.connect_realize(move |w| { + ref_state.borrow().im_context.set_client_window( + w.get_window().as_ref(), + ) + }); let ref_state = self.state.clone(); - state - .im_context - .connect_commit(move |_, ch| ref_state.borrow().im_commit(ch)); + state.im_context.connect_commit(move |_, ch| { + ref_state.borrow().im_commit(ch) + }); let ref_state = self.state.clone(); - state - .drawing_area - .connect_configure_event(move |_, _| { - try_nvim_resize(&ref_state); - false - }); + state.drawing_area.connect_configure_event(move |_, _| { + try_nvim_resize(&ref_state); + false + }); } #[cfg(unix)] @@ -488,7 +483,8 @@ impl Shell { } pub fn set_detach_cb(&self, cb: Option) - where F: FnMut() + Send + 'static + where + F: FnMut() + Send + 'static, { let mut state = self.state.borrow_mut(); state.set_detach_cb(cb); @@ -567,8 +563,9 @@ fn mouse_input(shell: &mut State, input: &str, state: ModifierType, position: (f let col = (x / char_width).trunc() as u64; let row = (y / line_height).trunc() as u64; let input_str = format!("{}<{},{}>", keyval_to_input_string(input, state), col, row); - nvim.input(&input_str) - .expect("Can't send mouse input event"); + nvim.input(&input_str).expect( + "Can't send mouse input event", + ); } } } @@ -619,32 +616,34 @@ fn show_nvim_start_error(err: nvim::NvimInitError, state_arc: Arc let cmd = err.cmd().unwrap().to_owned(); glib::idle_add(move || { - let state = state_arc.borrow(); - state.nvim.borrow_mut().set_error(); - state.error_area.show_nvim_start_error(&source, &cmd); - state.show_error_area(); + let state = state_arc.borrow(); + state.nvim.borrow_mut().set_error(); + state.error_area.show_nvim_start_error(&source, &cmd); + state.show_error_area(); - Continue(false) - }); + Continue(false) + }); } fn show_nvim_init_error(err: nvim::NvimInitError, state_arc: Arc>) { let source = err.source(); glib::idle_add(move || { - let state = state_arc.borrow(); - state.nvim.borrow_mut().set_error(); - state.error_area.show_nvim_init_error(&source); - state.show_error_area(); + let state = state_arc.borrow(); + state.nvim.borrow_mut().set_error(); + state.error_area.show_nvim_init_error(&source); + state.show_error_area(); - Continue(false) - }); + Continue(false) + }); } -fn init_nvim_async(state_arc: Arc>, - options: ShellOptions, - cols: usize, - rows: usize) { +fn init_nvim_async( + state_arc: Arc>, + options: ShellOptions, + cols: usize, + rows: usize, +) { // execute nvim let mut nvim = match nvim::start(state_arc.clone(), options.nvim_bin_path.as_ref()) { Ok(nvim) => nvim, @@ -658,19 +657,22 @@ fn init_nvim_async(state_arc: Arc>, let guard = nvim.session.take_dispatch_guard(); let state_ref = state_arc.clone(); thread::spawn(move || { - guard.join().expect("Can't join dispatch thread"); + guard.join().expect("Can't join dispatch thread"); - idle_cb_call!(state_ref.detach_cb()); - }); + idle_cb_call!(state_ref.detach_cb()); + }); // attach ui let mut nvim = Some(nvim); glib::idle_add(move || { let mut nvim = nvim.take().unwrap(); - if let Err(err) = nvim::post_start_init(&mut nvim, - options.open_path.as_ref(), - cols as u64, - rows as u64) { + if let Err(err) = nvim::post_start_init( + &mut nvim, + options.open_path.as_ref(), + cols as u64, + rows as u64, + ) + { show_nvim_init_error(err, state_arc.clone()); } else { let mut state = state_arc.borrow_mut(); @@ -698,11 +700,12 @@ fn init_nvim(state_arc: &Arc>) { } #[inline] -fn get_model_clip(state: &State, - line_height: f64, - char_width: f64, - clip: (f64, f64, f64, f64)) - -> ModelRect { +fn get_model_clip( + state: &State, + line_height: f64, + char_width: f64, + clip: (f64, f64, f64, f64), +) -> ModelRect { let mut model_clip = ModelRect::from_area(line_height, char_width, clip.0, clip.1, clip.2, clip.3); // in some cases symbols from previous row affect next row @@ -716,12 +719,14 @@ fn get_model_clip(state: &State, } #[inline] -fn draw_backgound(state: &State, - draw_bitmap: &ModelBitamp, - ctx: &cairo::Context, - line_height: f64, - char_width: f64, - model_clip: &ModelRect) { +fn draw_backgound( + state: &State, + draw_bitmap: &ModelBitamp, + ctx: &cairo::Context, + line_height: f64, + char_width: f64, + model_clip: &ModelRect, +) { let line_x = model_clip.left as f64 * char_width; let mut line_y: f64 = model_clip.top as f64 * line_height; @@ -759,7 +764,7 @@ fn draw_initializing(state: &State, ctx: &cairo::Context) { ctx.paint(); layout.set_font_description(&desc); - layout.set_text("Loading..", -1); + layout.set_text("Loading.."); let (width, height) = layout.get_pixel_size(); let x = alloc.width as f64 / 2.0 - width as f64 / 2.0; @@ -772,17 +777,15 @@ fn draw_initializing(state: &State, ctx: &cairo::Context) { ctx.move_to(x + width as f64, y); - state - .cursor - .as_ref() - .unwrap() - .draw(ctx, - state, - char_width, - line_height, - y, - false, - &state.bg_color); + state.cursor.as_ref().unwrap().draw( + ctx, + state, + char_width, + line_height, + y, + false, + &state.bg_color, + ); } fn draw(state: &State, ctx: &cairo::Context) { @@ -803,21 +806,24 @@ fn draw(state: &State, ctx: &cairo::Context) { for clip_idx in 0..clip_rects.len() { let clip = clip_rects.get(clip_idx).unwrap(); - let model_clip = - get_model_clip(state, - line_height, - char_width, - (clip.x, clip.y, clip.x + clip.width, clip.y + clip.height)); + let model_clip = get_model_clip(state, line_height, char_width, ( + clip.x, + clip.y, + clip.x + clip.width, + clip.y + clip.height, + )); let line_x = model_clip.left as f64 * char_width; let mut line_y: f64 = model_clip.top as f64 * line_height; - draw_backgound(state, - &draw_bitmap, - ctx, - line_height, - char_width, - &model_clip); + draw_backgound( + state, + &draw_bitmap, + ctx, + line_height, + char_width, + &model_clip, + ); for (line_idx, line) in state.model.clip_model(&model_clip) { @@ -832,17 +838,15 @@ fn draw(state: &State, ctx: &cairo::Context) { let (bg, fg) = state.colors(cell); if row == line_idx && col == col_idx { - state - .cursor - .as_ref() - .unwrap() - .draw(ctx, - state, - char_width, - line_height, - line_y, - double_width, - bg); + state.cursor.as_ref().unwrap().draw( + ctx, + state, + char_width, + line_height, + line_y, + double_width, + bg, + ); ctx.move_to(current_point.0, current_point.1); } @@ -854,7 +858,7 @@ fn draw(state: &State, ctx: &cairo::Context) { layout.set_font_description(&desc); buf.clear(); buf.push(cell.ch); - layout.set_text(&buf, -1); + layout.set_text(&buf); // correct layout for double_width chars if double_width { @@ -1111,19 +1115,26 @@ impl RedrawEvents for State { RepaintMode::Area(self.model.cur_point()) } - fn popupmenu_show(&mut self, - menu: &[Vec<&str>], - selected: i64, - row: u64, - col: u64) - -> RepaintMode { + fn popupmenu_show( + &mut self, + menu: &[Vec<&str>], + selected: i64, + row: u64, + col: u64, + ) -> RepaintMode { if let (&Some(line_height), &Some(char_width)) = (&self.line_height, &self.char_width) { let point = ModelRect::point(col as usize, row as usize); let (x, y, width, height) = point.to_area(line_height, char_width); - self.popup_menu - .borrow_mut() - .show(self, menu, selected, x, y, width, height); + self.popup_menu.borrow_mut().show( + self, + menu, + selected, + x, + y, + width, + height, + ); } RepaintMode::Nothing @@ -1140,19 +1151,21 @@ impl RedrawEvents for State { } - fn tabline_update(&mut self, - selected: Tabpage, - tabs: Vec<(Tabpage, Option)>) - -> RepaintMode { + fn tabline_update( + &mut self, + selected: Tabpage, + tabs: Vec<(Tabpage, Option)>, + ) -> RepaintMode { self.tabs.update_tabs(&self.nvim, &selected, &tabs); RepaintMode::Nothing } - fn mode_info_set(&mut self, - cursor_style_enabled: bool, - mode_info: Vec) - -> RepaintMode { + fn mode_info_set( + &mut self, + cursor_style_enabled: bool, + mode_info: Vec, + ) -> RepaintMode { self.mode.set_info(cursor_style_enabled, mode_info); RepaintMode::Nothing } diff --git a/src/ui.rs b/src/ui.rs index cd56965..eb418f6 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -6,7 +6,6 @@ use std::sync::Arc; use gtk; use gtk_sys; use gtk::prelude::*; -use gtk::ApplicationExt; use gtk::{ApplicationWindow, HeaderBar, ToolButton, Image, AboutDialog}; use gio::prelude::*; use gio::{Menu, MenuExt, MenuItem, MenuItemExt, SimpleAction}; From b2ae40982f3850d12e29d40d24ce855a0c0ad163 Mon Sep 17 00:00:00 2001 From: daa84 Date: Thu, 17 Aug 2017 17:06:09 +0300 Subject: [PATCH 5/6] Cleanup --- src/input.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/input.rs b/src/input.rs index be3edfb..90e7dd6 100644 --- a/src/input.rs +++ b/src/input.rs @@ -78,13 +78,11 @@ pub fn convert_key(ev: &EventKey) -> Option { } pub fn im_input(nvim: &mut Neovim, input: &str) { - println!("im input {}", input); debug!("nvim_input -> {}", input); nvim.input(&input).expect("Error run input command to nvim"); } pub fn gtk_key_press(nvim: &mut Neovim, ev: &EventKey) -> Inhibit { - println!("keyval {:?}", gdk::keyval_name(ev.get_keyval())); if let Some(input) = convert_key(ev) { debug!("nvim_input -> {}", input); nvim.input(&input).expect("Error run input command to nvim"); From 14a2773fd34edc69244df6f93b2b643f0df0bd87 Mon Sep 17 00:00:00 2001 From: daa84 Date: Mon, 21 Aug 2017 18:14:13 +0300 Subject: [PATCH 6/6] Update versions --- Cargo.lock | 276 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 44 ++++----- 2 files changed, 159 insertions(+), 161 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d5c7fac..a45c949 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,22 +2,20 @@ name = "nvim-gtk" version = "0.1.2" dependencies = [ - "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", - "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", + "cairo-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk 0.5.3 (git+https://github.com/gtk-rs/gdk)", - "gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gio 0.1.3 (git+https://github.com/gtk-rs/gio)", - "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gtk 0.1.3 (git+https://github.com/gtk-rs/gtk)", - "gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gdk 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "neovim-lib 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.1.3 (git+https://github.com/gtk-rs/pango)", - "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "pangocairo 0.1.3 (git+https://github.com/RazrFalcon/pangocairo-rs)", + "pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pangocairo 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -35,12 +33,12 @@ dependencies = [ [[package]] name = "atk-sys" -version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -67,21 +65,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cairo-rs" -version = "0.1.3" -source = "git+https://github.com/gtk-rs/cairo#7ab279c6393f87d86019671dda5206622e68fb7d" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", - "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cairo-sys-rs" -version = "0.3.4" -source = "git+https://github.com/gtk-rs/cairo#7ab279c6393f87d86019671dda5206622e68fb7d" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -117,104 +115,104 @@ dependencies = [ [[package]] name = "gdk" -version = "0.5.3" -source = "git+https://github.com/gtk-rs/gdk#cdb612c726c6b5e507534dcdd1dc549459b3869a" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", - "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", - "gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)", - "gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gio 0.1.3 (git+https://github.com/gtk-rs/gio)", - "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "cairo-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.1.3 (git+https://github.com/gtk-rs/pango)", + "pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-pixbuf" -version = "0.1.3" -source = "git+https://github.com/gtk-rs/gdk-pixbuf#cc1c9ab464bcf58624c3969cbe080292f98a43cf" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gdk-pixbuf-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-pixbuf-sys" -version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-sys" -version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", - "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gio" -version = "0.1.3" -source = "git+https://github.com/gtk-rs/gio#2b2b061baf5c9410b3faac0fff28650dc773e750" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gio-sys" -version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glib" -version = "0.1.3" -source = "git+https://github.com/gtk-rs/glib#dc304963b10e8950b71a73ab7c9620c931ef7950" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glib-sys" -version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", @@ -223,52 +221,52 @@ dependencies = [ [[package]] name = "gobject-sys" -version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gtk" -version = "0.1.3" -source = "git+https://github.com/gtk-rs/gtk#d3fb35605254f794c4cf669f49d0cdfe09dfc9dc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", - "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", - "gdk 0.5.3 (git+https://github.com/gtk-rs/gdk)", - "gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)", - "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gio 0.1.3 (git+https://github.com/gtk-rs/gio)", - "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "cairo-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.1.3 (git+https://github.com/gtk-rs/pango)", + "pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gtk-sys" -version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "atk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "atk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", - "gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -335,52 +333,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pango" -version = "0.1.3" -source = "git+https://github.com/gtk-rs/pango#df1ed7040f41aba0266fabf1c000e36d77c75106" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pango-sys" -version = "0.3.4" -source = "git+https://github.com/gtk-rs/sys#af83826e0a31f68bcddee17d3791fb01453dc632" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pangocairo" -version = "0.1.3" -source = "git+https://github.com/RazrFalcon/pangocairo-rs#ad91334f8a9a473b767c045d001d373038fd6db1" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)", - "glib 0.1.3 (git+https://github.com/gtk-rs/glib)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "pango 0.1.3 (git+https://github.com/gtk-rs/pango)", - "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", - "pangocairo-sys 0.3.4 (git+https://github.com/RazrFalcon/pangocairo-rs)", + "cairo-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pangocairo-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pangocairo-sys" -version = "0.3.4" -source = "git+https://github.com/RazrFalcon/pangocairo-rs#ad91334f8a9a473b767c045d001d373038fd6db1" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)", - "glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)", + "pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -575,28 +573,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" -"checksum atk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" +"checksum atk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c69658a4e18d5c9575f716e24559645d08a4044d6946c30c2e0025952c84d842" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d" "checksum c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6237ac5a4b1e81c213c24c6437964c61e646df910a914b4ab1487b46df20bd13" -"checksum cairo-rs 0.1.3 (git+https://github.com/gtk-rs/cairo)" = "" -"checksum cairo-sys-rs 0.3.4 (git+https://github.com/gtk-rs/cairo)" = "" +"checksum cairo-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9d336f1b2ff46c17475a14360de7f456707008da475c54824887e52e453ab00" +"checksum cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9e8a1e2a76ac09b959788c2c30a355d693ce6f7f7d7268f6d1dd5d8c3359c521" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" "checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" "checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" -"checksum gdk 0.5.3 (git+https://github.com/gtk-rs/gdk)" = "" -"checksum gdk-pixbuf 0.1.3 (git+https://github.com/gtk-rs/gdk-pixbuf)" = "" -"checksum gdk-pixbuf-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" -"checksum gdk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" -"checksum gio 0.1.3 (git+https://github.com/gtk-rs/gio)" = "" -"checksum gio-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" -"checksum glib 0.1.3 (git+https://github.com/gtk-rs/glib)" = "" -"checksum glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" -"checksum gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" -"checksum gtk 0.1.3 (git+https://github.com/gtk-rs/gtk)" = "" -"checksum gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" +"checksum gdk 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f30018ecbbb1e6f1d59c4024ec08675850744b799abc5420be0629ac9ba0abd2" +"checksum gdk-pixbuf 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "caf05dab73febcc6e90abaff8f24cfe1cf1bd2222cd648ddfe337bf3b994489f" +"checksum gdk-pixbuf-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "85eb441420653b33e5a29d13227ea34995383e65bf4f33b16492ec95e44a8996" +"checksum gdk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "679d86da2a4522a623e3ce4b67f2126a12e057a1f7269eee7028199f78b5a854" +"checksum gio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7bc3126c94109e65871e4228b990d1ea2953259483d5b06eb96e8b36a7bf196" +"checksum gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "189969f8189604c371d42b613d928c9d17fcfbf6e175d6b0ce9475a950f76dc6" +"checksum glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67eb5b7251562f527d55d0ccf81bc5e6e75045df38b97cfee98ee7b2fc5aa7c0" +"checksum glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd7d911c5dc610aabe37caae7d3b9d2cfe6d8f4c85ff4c062f3d6f490e75067" +"checksum gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "edc95561e538381576425264a4ddd08c65d5da218f10b2a47b4479dd147775da" +"checksum gtk 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce17f98e7dcdc9d06b3a5f7621d796a24937c04953481205b1be267c5a02697a" +"checksum gtk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "854b56ce6d6b05945f7735651482835c5ac1f8582142ce67306726259a3dafb0" "checksum htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163" "checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" "checksum libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)" = "8a014d9226c2cc402676fbe9ea2e15dd5222cd1dd57f576b5b283178c944a264" @@ -606,10 +604,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" "checksum neovim-lib 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cd81cd2140309fcbe61775ebe5901b0730e5fdae2558a6cd27539e6e730fa76a" "checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" -"checksum pango 0.1.3 (git+https://github.com/gtk-rs/pango)" = "" -"checksum pango-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "" -"checksum pangocairo 0.1.3 (git+https://github.com/RazrFalcon/pangocairo-rs)" = "" -"checksum pangocairo-sys 0.3.4 (git+https://github.com/RazrFalcon/pangocairo-rs)" = "" +"checksum pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5afa4b4c5380315b12075e7767d9bdd62d53beeb6087d9287ef6990e57a6b643" +"checksum pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e6ec8d90306b5ff43f5836f4363267ea95be02b3df71d2b31ba8fbb1680bdee1" +"checksum pangocairo 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8edeb86f36f8f10a252a888fa3d9aff4d0681373da918c207eac2208aa091e6" +"checksum pangocairo-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c26c200ef32a682bf8b693b47996c3c33e0b2de32b30f7251cc60673ad513bef" "checksum phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "cb325642290f28ee14d8c6201159949a872f220c62af6e110a56ea914fbe42fc" "checksum phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d62594c0bb54c464f633175d502038177e90309daf2e0158be42ed5f023ce88f" "checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03" diff --git a/Cargo.toml b/Cargo.toml index 6631a0d..a6a4847 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,24 +5,24 @@ authors = ["daa84 "] build = "build.rs" [dependencies] -#cairo-rs = "0.1" -#pango = "0.1" -#pangocairo = "0.1" -#glib = "0.1" -#glib-sys = "0.3" -#gdk = "0.5" -#gdk-sys = "0.3" -#gio = "0.1" -gdk = { git = 'https://github.com/gtk-rs/gdk' } -gdk-sys = { git = 'https://github.com/gtk-rs/sys' } -glib = { git = 'https://github.com/gtk-rs/glib' } -glib-sys = { git = 'https://github.com/gtk-rs/sys' } -cairo-rs = { git = 'https://github.com/gtk-rs/cairo' } -cairo-sys-rs = { git = 'https://github.com/gtk-rs/cairo' } -pango = { git = 'https://github.com/gtk-rs/pango' } -pango-sys = { git = 'https://github.com/gtk-rs/sys' } -gio = { git = 'https://github.com/gtk-rs/gio' } -pangocairo = { git = 'https://github.com/RazrFalcon/pangocairo-rs' } +cairo-rs = "0.2" +pango = "0.2" +pangocairo = "0.2" +glib = "0.3" +glib-sys = "0.4" +gdk = "0.6" +gdk-sys = "0.4" +gio = "0.2" +#gdk = { git = 'https://github.com/gtk-rs/gdk' } +#gdk-sys = { git = 'https://github.com/gtk-rs/sys' } +#glib = { git = 'https://github.com/gtk-rs/glib' } +#glib-sys = { git = 'https://github.com/gtk-rs/sys' } +#cairo-rs = { git = 'https://github.com/gtk-rs/cairo' } +#cairo-sys-rs = { git = 'https://github.com/gtk-rs/cairo' } +#pango = { git = 'https://github.com/gtk-rs/pango' } +#pango-sys = { git = 'https://github.com/gtk-rs/sys' } +#gio = { git = 'https://github.com/gtk-rs/gio' } +#pangocairo = { git = 'https://github.com/RazrFalcon/pangocairo-rs' } neovim-lib = "0.4" phf = "0.7" log = "0.3" @@ -40,12 +40,12 @@ toml = "0.4" phf_codegen = "0.7" [dependencies.gtk] -version = "0.1" +version = "0.2" features = ["v3_22"] -git = "https://github.com/gtk-rs/gtk" +#git = "https://github.com/gtk-rs/gtk" [dependencies.gtk-sys] -version = "0.3" +version = "0.4" features = ["v3_22"] -git = 'https://github.com/gtk-rs/sys' +#git = 'https://github.com/gtk-rs/sys'