From 7875b17e92cfe7f9e4afcaed1bc88b12c83079a0 Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Tue, 26 Feb 2019 17:32:29 -0500 Subject: [PATCH 01/78] First attempt at getting GTK brought up This approach has basically hit a brick wall, since Druid expects you to be able to create windows before the main loop starts up, while GTK Very Much Does Not. Trying to poke things to crank the event loop a bit before entering the main loop forever didn't bear much fruit. It may be possible if we dip down into C-land for a bit first. --- Cargo.lock | 746 ----------------------- druid-shell/Cargo.toml | 9 + druid-shell/src/druid_gtk/application.rs | 23 + druid-shell/src/druid_gtk/dialog.rs | 35 ++ druid-shell/src/druid_gtk/menu.rs | 35 ++ druid-shell/src/druid_gtk/mod.rs | 195 ++++++ druid-shell/src/druid_gtk/util.rs | 23 + druid-shell/src/druid_gtk/win_main.rs | 80 +++ druid-shell/src/lib.rs | 14 + 9 files changed, 414 insertions(+), 746 deletions(-) delete mode 100644 Cargo.lock create mode 100644 druid-shell/src/druid_gtk/application.rs create mode 100644 druid-shell/src/druid_gtk/dialog.rs create mode 100644 druid-shell/src/druid_gtk/menu.rs create mode 100644 druid-shell/src/druid_gtk/mod.rs create mode 100644 druid-shell/src/druid_gtk/util.rs create mode 100644 druid-shell/src/druid_gtk/win_main.rs diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 80d64b1b8b..0000000000 --- a/Cargo.lock +++ /dev/null @@ -1,746 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "arrayvec" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "autocfg" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "backtrace" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace-sys" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bitflags" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "boolinator" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bumpalo" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cairo-rs" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cairo-sys-rs" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cc" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cfg-if" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cocoa" -version = "0.18.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", - "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "core-foundation" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "core-foundation-sys" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "core-graphics" -version = "0.17.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "direct2d" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "direct3d11" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "directwrite" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "druid" -version = "0.3.0" -dependencies = [ - "druid-shell 0.3.0", -] - -[[package]] -name = "druid-shell" -version = "0.3.0" -dependencies = [ - "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", - "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "dxgi" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "either" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "failure" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure_derive" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "js-sys" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "kurbo" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lazy_static" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.60" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "log" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memchr" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "nodrop" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "nom" -version = "4.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-bigint" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-complex" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-integer" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-iter" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-rational" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "objc" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-cairo" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-common" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-cairo 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-direct2d 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-web 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-direct2d" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-web" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pkg-config" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "redox_syscall" -version = "0.1.56" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-demangle" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "sourcefile" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "syn" -version = "0.15.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "synstructure" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "time" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-segmentation" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wasm-bindgen" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wasm-bindgen-webidl" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "web-sys" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", - "sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-webidl 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "weedle" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wio" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" -"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" -"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" -"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" -"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" -"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" -"checksum boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" -"checksum bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd43d82f27d68911e6ee11ee791fb248f138f5d69424dc02e098d4f152b0b05" -"checksum cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e05db47de3b0f09a222fa4bba2eab957d920d4243962a86b2d77ab401e4a359c" -"checksum cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90a1ec04603a78c111886a385edcec396dbfbc57ea26b9e74aeea6a1fe55dcca" -"checksum cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "ce400c638d48ee0e9ab75aef7997609ec57367ccfe1463f21bf53c3eca67bf46" -"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" -"checksum cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf79daa4e11e5def06e55306aa3601b87de6b5149671529318da048f67cdd77b" -"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" -"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" -"checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" -"checksum direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7fa6ff10857eb253d1ae16987ebfd27372f4129b0c7a3fa41466fbdf7e453e75" -"checksum direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "315aa929e68ba066cb6fb86f1b22af24f517e02fd9b5734c4d07e42cb9f4aefa" -"checksum directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8cdcd739e9351c411b8caf5cab32a27c818cfe06260595da121382ecdd22083d" -"checksum dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1639bbfd6765e92a40267d217a7acbac5b49320b68013f39a8e4376aa8c1e091" -"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" -"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" -"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" -"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -"checksum js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "da3ea71161651a4cd97d999b2da139109c537b15ab33abc8ae4ead38deac8a03" -"checksum kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0caeb26248a62abf92dea93aad4f8244f54668e2f1060ed9cd9fd1d5545723" -"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" -"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" -"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" -"checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1" -"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" -"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" -"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" -"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" -"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" -"checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d" -"checksum piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "02e36470db0f6e8900c3f2d35ae137c96ebb726af2c070fc4369467ee57ab9bd" -"checksum piet-cairo 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1afd8ad4a74d1ef1591e0bad7f860841c5a0cab6edeb347fc67e2e37422c01df" -"checksum piet-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8e8cb78927118d65d350a677432e459d90ff72ea6fc875cf1ac1478d5570e196" -"checksum piet-direct2d 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ccea047f88a367ad86b2a972302070f0bf4183b51376ad840b9eb298f3bdafc1" -"checksum piet-web 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5f168f31a01eb3d0cc977258ae6b085f98d022f32b7e3edcdb4f565d912dcc60" -"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" -"checksum syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)" = "ee06ea4b620ab59a2267c6b48be16244a3389f8bfa0986bdd15c35b890b00af3" -"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" -"checksum wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "4de97fa1806bb1a99904216f6ac5e0c050dc4f8c676dc98775047c38e5c01b55" -"checksum wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "5d82c170ef9f5b2c63ad4460dfcee93f3ec04a9a36a4cc20bc973c39e59ab8e3" -"checksum wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f07d50f74bf7a738304f6b8157f4a581e1512cd9e9cdb5baad8c31bbe8ffd81d" -"checksum wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "95cf8fe77e45ba5f91bc8f3da0c3aa5d464b3d8ed85d84f4d4c7cc106436b1d7" -"checksum wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "d9c2d4d4756b2e46d3a5422e06277d02e4d3e1d62d138b76a4c681e925743623" -"checksum wasm-bindgen-webidl 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "24e47859b4eba3d3b9a5c2c299f9d6f8d0b613671315f6f0c5c7f835e524b36a" -"checksum web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "86d515d2f713d3a6ab198031d2181b7540f8e319e4637ec2d4a41a208335ef29" -"checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164" -"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" diff --git a/druid-shell/Cargo.toml b/druid-shell/Cargo.toml index 81cc89853a..0e28087dc2 100644 --- a/druid-shell/Cargo.toml +++ b/druid-shell/Cargo.toml @@ -31,3 +31,12 @@ cocoa = "0.18.4" objc = "0.2.5" core-graphics = "0.17.3" cairo-rs = { version = "0.7.1", default_features = false } + +[target.'cfg(target_os="linux")'.dependencies] +cairo-rs = { version = "0.5.0", default_features = false } +gio = "0.5.0" +gdk = "0.9.0" +gtk = "0.5.0" + +[dev-dependencies] +kurbo = "0.2.1" diff --git a/druid-shell/src/druid_gtk/application.rs b/druid-shell/src/druid_gtk/application.rs new file mode 100644 index 0000000000..cf8c43be6f --- /dev/null +++ b/druid-shell/src/druid_gtk/application.rs @@ -0,0 +1,23 @@ +// Copyright 2019 The xi-editor Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! GTK implementation of features at the application scope. + +pub struct Application; + +impl Application { + pub fn quit() { + unimplemented!("Quitting the application"); + } +} diff --git a/druid-shell/src/druid_gtk/dialog.rs b/druid-shell/src/druid_gtk/dialog.rs new file mode 100644 index 0000000000..36dd6fa058 --- /dev/null +++ b/druid-shell/src/druid_gtk/dialog.rs @@ -0,0 +1,35 @@ +// Copyright 2019 The xi-editor Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +//! File open/save dialogs, GTK implementation. + +/// Type of file dialog. +pub enum FileDialogType { + /// File open dialog. + Open, + /// File save dialog. + Save, +} + +/// Options for file dialog. +#[derive(Default)] +pub struct FileDialogOptions; + +impl FileDialogOptions { + pub fn set_show_hidden(&mut self) { + // TODO + unimplemented!("Showing file dialogs on GTK platforms") + } +} diff --git a/druid-shell/src/druid_gtk/menu.rs b/druid-shell/src/druid_gtk/menu.rs new file mode 100644 index 0000000000..3b946f03b0 --- /dev/null +++ b/druid-shell/src/druid_gtk/menu.rs @@ -0,0 +1,35 @@ +// Copyright 2019 The xi-editor Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! GTK implementation of menus. + +pub struct Menu; + +impl Menu { + pub fn new() -> Menu { + Menu + } + + pub fn add_dropdown(&mut self, menu: Menu, text: &str) { + unimplemented!("GTK dropdowns") + } + + pub fn add_item(&mut self, id: u32, text: &str) { + unimplemented!("GTK menu items") + } + + pub fn add_separator(&mut self) { + unimplemented!("GTK separators") + } +} diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs new file mode 100644 index 0000000000..03e7e077c4 --- /dev/null +++ b/druid-shell/src/druid_gtk/mod.rs @@ -0,0 +1,195 @@ +// Copyright 2019 The xi-editor Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! GTK-based platform support + +pub mod application; +pub mod dialog; +pub mod menu; +pub mod util; +pub mod win_main; + +use std::any::Any; +use std::ffi::OsString; +use std::sync::{Arc, Mutex, Weak}; + +use gtk::ApplicationWindow; + +use platform::dialog::{FileDialogOptions, FileDialogType}; +use platform::menu::Menu; +use window::{Cursor, WinHandler}; +use Error; + +use util::assert_main_thread; +use win_main::with_application; + +#[derive(Clone, Default)] +pub struct WindowHandle { + window: Option, +} + +/// Builder abstraction for creating new windows +pub struct WindowBuilder { + handler: Option>, + title: String, + cursor: Cursor, +} + +#[derive(Clone)] +pub struct IdleHandle { + queue: Option, // TODO: implement this properly + idle_queue: Weak>>>, +} + +// TODO: move this out of platform-dependent section. +trait IdleCallback: Send { + fn call(self: Box, a: &Any); +} + +impl IdleCallback for F { + fn call(self: Box, a: &Any) { + (*self)(a) + } +} + +impl WindowBuilder { + pub fn new() -> WindowBuilder { + WindowBuilder { + handler: None, + title: String::new(), + cursor: Cursor::Arrow, + } + } + + pub fn set_handler(&mut self, handler: Box) { + self.handler = Some(handler); + } + + pub fn set_title(&mut self, title: impl Into) { + self.title = title.into(); + } + + pub fn set_menu(&mut self, menu: Menu) { + // TODO + } + + pub fn build(self) -> Result { + use gdk::WindowExt; + use gtk::GtkWindowExt; + + assert_main_thread(); + + let mut window = with_application(|app| ApplicationWindow::new(&app)); + window.set_title(&self.title); + // TODO(bobtwinkles): enable this when I figure out how to set the cursor on application windows + // window.set_cursor(gdk::Cursor::new_from_nane( + // &window.get_display(), + // match self.cursor { + // Arrow => "default", + // IBeam => "text", + // }, + // )); + + Ok(WindowHandle { + window: Some(window), + }) + } +} + +impl WindowHandle { + pub fn show(&self) { + unimplemented!("WindowHandle::show"); + } + + /// Close the window. + pub fn close(&self) { + unimplemented!("WindowHandle::close"); + } + + // Request invalidation of the entire window contents. + pub fn invalidate(&self) { + unimplemented!("WindowHandle::invalidate"); + } + + /// Get a handle that can be used to schedule an idle task. + pub fn get_idle_handle(&self) -> Option { + unimplemented!("WindowHandle::get_idle_handle"); + } + + /// Get the dpi of the window. + /// + /// TODO: we want to migrate this from dpi (with 96 as nominal) to a scale + /// factor (with 1 as nominal). + pub fn get_dpi(&self) -> f32 { + // TODO: get actual dpi + 96.0 + } + + // TODO: the following methods are cut'n'paste code. A good way to DRY + // would be to have a platform-independent trait with these as methods with + // default implementations. + + /// Convert a dimension in px units to physical pixels (rounding). + pub fn px_to_pixels(&self, x: f32) -> i32 { + (x * self.get_dpi() * (1.0 / 96.0)).round() as i32 + } + + /// Convert a point in px units to physical pixels (rounding). + pub fn px_to_pixels_xy(&self, x: f32, y: f32) -> (i32, i32) { + let scale = self.get_dpi() * (1.0 / 96.0); + ((x * scale).round() as i32, (y * scale).round() as i32) + } + + /// Convert a dimension in physical pixels to px units. + pub fn pixels_to_px>(&self, x: T) -> f32 { + (x.into() as f32) * 96.0 / self.get_dpi() + } + + /// Convert a point in physical pixels to px units. + pub fn pixels_to_px_xy>(&self, x: T, y: T) -> (f32, f32) { + let scale = 96.0 / self.get_dpi(); + ((x.into() as f32) * scale, (y.into() as f32) * scale) + } + + pub fn file_dialog( + &self, + ty: FileDialogType, + options: FileDialogOptions, + ) -> Result { + unimplemented!() + } +} + +unsafe impl Send for IdleHandle {} + +impl IdleHandle { + /// Add an idle handler, which is called (once) when the message loop + /// is empty. The idle handler will be run from the main UI thread, and + /// won't be scheduled if the associated view has been dropped. + /// + /// Note: the name "idle" suggests that it will be scheduled with a lower + /// priority than other UI events, but that's not necessarily the case. + pub fn add_idle(&self, callback: F) + where + F: FnOnce(&Any) + Send + 'static, + { + if let Some(queue) = self.idle_queue.upgrade() { + let mut queue = queue.lock().unwrap(); + if queue.is_empty() { + unimplemented!("Idle queue wait"); + } + queue.push(Box::new(callback)); + } + } +} diff --git a/druid-shell/src/druid_gtk/util.rs b/druid-shell/src/druid_gtk/util.rs new file mode 100644 index 0000000000..231ef33c9f --- /dev/null +++ b/druid-shell/src/druid_gtk/util.rs @@ -0,0 +1,23 @@ +// Copyright 2019 The xi-editor Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Utilities, GTK specific. + +pub fn init() { + gtk::init().expect("GTK initialization failed"); +} + +pub fn assert_main_thread() { + assert!(gtk::is_initialized_main_thread()); +} diff --git a/druid-shell/src/druid_gtk/win_main.rs b/druid-shell/src/druid_gtk/win_main.rs new file mode 100644 index 0000000000..f5abb3802f --- /dev/null +++ b/druid-shell/src/druid_gtk/win_main.rs @@ -0,0 +1,80 @@ +// Copyright 2019 The xi-editor Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! GTK implementation of runloop. + +use gio::ApplicationFlags; +use gtk::{Application, ApplicationWindow}; +use std::cell::RefCell; +use util::assert_main_thread; + +/// XXX: The application needs to be global because WindowBuilder::build wants +/// to construct an ApplicationWindow, which needs the application, but +/// WindowBuilder::build does not get the RunLoop +thread_local!( + static GTK_APPLICATION: RefCell> = RefCell::new(None); +); + +/// Container for a GTK runloop +pub struct RunLoop {} + +impl RunLoop { + pub fn new() -> RunLoop { + use gio::ApplicationExt; + + assert_main_thread(); + + // TODO: we should give control over the application ID to the user + let application = + Application::new("com.github.xi-editor.druid", ApplicationFlags::FLAGS_NONE) + .expect("Unable to create GTK application"); + + GTK_APPLICATION.with(move |x| *x.borrow_mut() = Some(application)); + + RunLoop {} + } + + pub fn run(&mut self) { + use gio::ApplicationExtManual; + assert_main_thread(); + + // TODO: should we pass the command line arguments? + GTK_APPLICATION.with(|x| { + x.borrow() + .as_ref() + .unwrap() // Safe because we initialized this in RunLoop::new + .run(&[]) + }); + } +} + +/// Request to quit the application, exiting the runloop. +pub fn request_quit() { + assert_main_thread(); + gtk::main_quit(); +} + +pub(crate) fn with_application(f: F) -> R +where + F: std::ops::FnOnce(Application) -> R, +{ + assert_main_thread(); + GTK_APPLICATION.with(move |app| { + let app = app + .borrow() + .clone() + .expect("Tried to manipulate the application before RunLoop::new was called"); + f(app) + }) +} diff --git a/druid-shell/src/lib.rs b/druid-shell/src/lib.rs index 0116d0445e..d449cf1463 100644 --- a/druid-shell/src/lib.rs +++ b/druid-shell/src/lib.rs @@ -25,6 +25,15 @@ extern crate winapi; #[macro_use] extern crate objc; +#[cfg(target_os = "linux")] +extern crate cairo; +#[cfg(target_os = "linux")] +extern crate gdk; +#[cfg(target_os = "linux")] +extern crate gio; +#[cfg(target_os = "linux")] +extern crate gtk; + #[macro_use] extern crate lazy_static; @@ -45,6 +54,11 @@ pub mod mac; #[cfg(target_os = "macos")] pub use mac as platform; +#[cfg(target_os = "linux")] +pub mod druid_gtk; +#[cfg(target_os = "linux")] +pub use druid_gtk as platform; + pub use error::Error; pub use platform::application; From afbe0bb91ba00635f72be8f0ccfcafa0c7fbad86 Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Tue, 26 Feb 2019 23:41:24 -0500 Subject: [PATCH 02/78] First pixels --- druid-shell/src/druid_gtk/mod.rs | 59 ++++++++++++++++++++++++--- druid-shell/src/druid_gtk/win_main.rs | 9 ++++ 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 03e7e077c4..070ea7823d 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -26,6 +26,9 @@ use std::sync::{Arc, Mutex, Weak}; use gtk::ApplicationWindow; +use piet::RenderContext; +use piet_common::Piet; + use platform::dialog::{FileDialogOptions, FileDialogType}; use platform::menu::Menu; use window::{Cursor, WinHandler}; @@ -85,12 +88,17 @@ impl WindowBuilder { } pub fn build(self) -> Result { - use gdk::WindowExt; - use gtk::GtkWindowExt; - + use gtk::{ContainerExt, GtkWindowExt, WidgetExt}; assert_main_thread(); + let handler = self + .handler + .expect("Tried to build a window without setting the handler"); + + let handler = Arc::new(handler); + let mut window = with_application(|app| ApplicationWindow::new(&app)); + window.set_title(&self.title); // TODO(bobtwinkles): enable this when I figure out how to set the cursor on application windows // window.set_cursor(gdk::Cursor::new_from_nane( @@ -101,6 +109,34 @@ impl WindowBuilder { // }, // )); + let drawing_area = gtk::DrawingArea::new(); + + { + let handler = Arc::clone(&handler); + drawing_area.connect_draw(move |widget, context| { + use gtk::Inhibit; + + eprintln!("Clip extents: {:?}", context.clip_extents()); + + context.set_source_rgb(0.0, 0.0, 0.0); + context.paint(); + + context.set_source_rgb(1.0, 0.0, 0.0); + context.rectangle(0.0, 0.0, 100.0, 100.0); + + context.fill(); + + // For some reason piet needs a mutable context, so give it one I guess. + let mut context = context.clone(); + let mut piet_context = Piet::new(&mut context); + handler.paint(&mut piet_context); + + Inhibit(false) + }); + } + + window.add(&drawing_area); + Ok(WindowHandle { window: Some(window), }) @@ -109,12 +145,25 @@ impl WindowBuilder { impl WindowHandle { pub fn show(&self) { - unimplemented!("WindowHandle::show"); + use gtk::WidgetExt; + match self.window.as_ref() { + Some(window) => window.show_all(), + None => return, + } + // self.window.map(|window| window.show_all()); } /// Close the window. pub fn close(&self) { - unimplemented!("WindowHandle::close"); + use gtk::GtkApplicationExt; + match self.window.as_ref() { + Some(window) => { + with_application(|app| { + app.remove_window(window); + }); + } + None => return, + } } // Request invalidation of the entire window contents. diff --git a/druid-shell/src/druid_gtk/win_main.rs b/druid-shell/src/druid_gtk/win_main.rs index f5abb3802f..6b3ea4804b 100644 --- a/druid-shell/src/druid_gtk/win_main.rs +++ b/druid-shell/src/druid_gtk/win_main.rs @@ -32,6 +32,7 @@ pub struct RunLoop {} impl RunLoop { pub fn new() -> RunLoop { use gio::ApplicationExt; + use gtk::GtkApplicationExt; assert_main_thread(); @@ -40,6 +41,13 @@ impl RunLoop { Application::new("com.github.xi-editor.druid", ApplicationFlags::FLAGS_NONE) .expect("Unable to create GTK application"); + application.connect_activate(|app| { + eprintln!("Activated application"); + }); + + application.register(None); + application.activate(); + GTK_APPLICATION.with(move |x| *x.borrow_mut() = Some(application)); RunLoop {} @@ -65,6 +73,7 @@ pub fn request_quit() { gtk::main_quit(); } +#[inline] pub(crate) fn with_application(f: F) -> R where F: std::ops::FnOnce(Application) -> R, From 92df0ff3b3e4cb3ada38ea6d0ac7f466f74372b8 Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Tue, 26 Feb 2019 23:50:54 -0500 Subject: [PATCH 03/78] Implement resize handling --- druid-shell/src/druid_gtk/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 070ea7823d..9d0dd63cd9 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -22,6 +22,7 @@ pub mod win_main; use std::any::Any; use std::ffi::OsString; +use std::cell::Cell; use std::sync::{Arc, Mutex, Weak}; use gtk::ApplicationWindow; @@ -112,10 +113,19 @@ impl WindowBuilder { let drawing_area = gtk::DrawingArea::new(); { + let mut last_size = Cell::new((0, 0)); let handler = Arc::clone(&handler); drawing_area.connect_draw(move |widget, context| { use gtk::Inhibit; + let extents = context.clip_extents(); + let size = ((extents.2 - extents.0) as u32, (extents.3 - extents.1) as u32); + + if last_size.get() != size { + last_size.set(size); + handler.size(size.0, size.1); + } + eprintln!("Clip extents: {:?}", context.clip_extents()); context.set_source_rgb(0.0, 0.0, 0.0); From 2b0111c1ac8b07fc59f5b75b455495b52e0b80eb Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Wed, 27 Feb 2019 16:49:01 -0500 Subject: [PATCH 04/78] Implement handler connection --- druid-shell/src/druid_gtk/mod.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 9d0dd63cd9..7faf3abcb4 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -32,7 +32,7 @@ use piet_common::Piet; use platform::dialog::{FileDialogOptions, FileDialogType}; use platform::menu::Menu; -use window::{Cursor, WinHandler}; +use window::{self, Cursor, WinHandler}; use Error; use util::assert_main_thread; @@ -147,9 +147,15 @@ impl WindowBuilder { window.add(&drawing_area); - Ok(WindowHandle { + let tr = WindowHandle { window: Some(window), - }) + }; + + handler.connect(&window::WindowHandle{ + inner: tr.clone() + }); + + Ok(tr) } } From 4ebe24798f3f7525c07d2f3b1ec8fb6c996f4184 Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Wed, 27 Feb 2019 17:56:02 -0500 Subject: [PATCH 05/78] Implement invalidation and repainting --- druid-shell/Cargo.toml | 1 + druid-shell/src/druid_gtk/mod.rs | 31 +++++++++++++++++++++++-------- druid-shell/src/lib.rs | 2 ++ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/druid-shell/Cargo.toml b/druid-shell/Cargo.toml index 0e28087dc2..ddbf6ac0c9 100644 --- a/druid-shell/Cargo.toml +++ b/druid-shell/Cargo.toml @@ -37,6 +37,7 @@ cairo-rs = { version = "0.5.0", default_features = false } gio = "0.5.0" gdk = "0.9.0" gtk = "0.5.0" +glib = "0.6.1" [dev-dependencies] kurbo = "0.2.1" diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 7faf3abcb4..3a5e799745 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -21,11 +21,12 @@ pub mod util; pub mod win_main; use std::any::Any; -use std::ffi::OsString; use std::cell::Cell; +use std::ffi::OsString; use std::sync::{Arc, Mutex, Weak}; use gtk::ApplicationWindow; +use gtk::Inhibit; use piet::RenderContext; use piet_common::Piet; @@ -112,22 +113,23 @@ impl WindowBuilder { let drawing_area = gtk::DrawingArea::new(); + drawing_area.set_events(gdk::EventMask::all().bits() as i32); + { let mut last_size = Cell::new((0, 0)); let handler = Arc::clone(&handler); drawing_area.connect_draw(move |widget, context| { - use gtk::Inhibit; - let extents = context.clip_extents(); - let size = ((extents.2 - extents.0) as u32, (extents.3 - extents.1) as u32); + let size = ( + (extents.2 - extents.0) as u32, + (extents.3 - extents.1) as u32, + ); if last_size.get() != size { last_size.set(size); handler.size(size.0, size.1); } - eprintln!("Clip extents: {:?}", context.clip_extents()); - context.set_source_rgb(0.0, 0.0, 0.0); context.paint(); @@ -139,7 +141,16 @@ impl WindowBuilder { // For some reason piet needs a mutable context, so give it one I guess. let mut context = context.clone(); let mut piet_context = Piet::new(&mut context); - handler.paint(&mut piet_context); + let anim = handler.paint(&mut piet_context); + piet_context.finish(); + + if anim { + widget.queue_draw(); + } + + Inhibit(false) + }); + } Inhibit(false) }); @@ -184,7 +195,11 @@ impl WindowHandle { // Request invalidation of the entire window contents. pub fn invalidate(&self) { - unimplemented!("WindowHandle::invalidate"); + use gtk::WidgetExt; + match self.window.as_ref() { + Some(window) => window.queue_draw(), + None => {}, + } } /// Get a handle that can be used to schedule an idle task. diff --git a/druid-shell/src/lib.rs b/druid-shell/src/lib.rs index d449cf1463..37a797015d 100644 --- a/druid-shell/src/lib.rs +++ b/druid-shell/src/lib.rs @@ -33,6 +33,8 @@ extern crate gdk; extern crate gio; #[cfg(target_os = "linux")] extern crate gtk; +#[cfg(target_os = "linux")] +extern crate glib; #[macro_use] extern crate lazy_static; From 9a64af5e28842a67c96cfd6de2d265bfd699cc73 Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Wed, 27 Feb 2019 22:41:01 -0500 Subject: [PATCH 06/78] GTK: wire up mouse events --- druid-shell/src/druid_gtk/mod.rs | 105 ++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 2 deletions(-) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 3a5e799745..99043a7cb9 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -25,6 +25,7 @@ use std::cell::Cell; use std::ffi::OsString; use std::sync::{Arc, Mutex, Weak}; +use gdk::EventMask; use gtk::ApplicationWindow; use gtk::Inhibit; @@ -113,7 +114,16 @@ impl WindowBuilder { let drawing_area = gtk::DrawingArea::new(); - drawing_area.set_events(gdk::EventMask::all().bits() as i32); + drawing_area.set_events( + (EventMask::EXPOSURE_MASK + | EventMask::POINTER_MOTION_MASK + | EventMask::BUTTON_PRESS_MASK + | EventMask::BUTTON_RELEASE_MASK + | EventMask::KEY_PRESS_MASK + | EventMask::KEY_RELEASE_MASK + | EventMask::SCROLL_MASK) + .bits() as i32, + ); { let mut last_size = Cell::new((0, 0)); @@ -152,7 +162,85 @@ impl WindowBuilder { }); } - Inhibit(false) + { + let handler = Arc::clone(&handler); + drawing_area.connect_button_press_event(move |_widget, button| { + // XXX: what units is this in + let position = button.get_position(); + handler.mouse(&window::MouseEvent { + x: position.0 as i32, + y: position.1 as i32, + mods: 0, // TODO: thread this state through somehow + which: gtk_button_to_druid(button.get_button()), + ty: window::MouseType::Down, + }); + + Inhibit(true) + }); + } + + { + let handler = Arc::clone(&handler); + drawing_area.connect_button_release_event(move |_widget, button| { + // XXX: what units is this in + let position = button.get_position(); + handler.mouse(&window::MouseEvent { + x: position.0 as i32, + y: position.1 as i32, + mods: 0, // TODO: thread this state through somehow + which: gtk_button_to_druid(button.get_button()), + ty: window::MouseType::Up, + }); + + Inhibit(true) + }); + } + + { + let handler = Arc::clone(&handler); + drawing_area.connect_motion_notify_event(move |_widget, motion| { + let position = motion.get_position(); + + handler.mouse_move(position.0 as i32, position.1 as i32, 0); + + Inhibit(true) + }); + } + + { + let handler = Arc::clone(&handler); + drawing_area.connect_scroll_event(move |_widget, scroll| { + use gdk::ScrollDirection; + let deltas = scroll.get_scroll_deltas(); + + // The magic "120"s are from Microsoft's documentation for WM_MOUSEWHEEL. + // They claim that one "tick" on a scroll wheel should be 120 units. + // GTK simply reports the direction + match scroll.get_direction() { + ScrollDirection::Up => { + handler.mouse_wheel(120, 0); + } + ScrollDirection::Down => { + handler.mouse_wheel(-120, 0); + } + ScrollDirection::Left => { + // Note: this direction is just a guess, I (bobtwinkles) don't + // have a way to test horizontal scroll events under GTK. + // If it's wrong, the right direction also needs to be changed + handler.mouse_hwheel(120, 0); + } + ScrollDirection::Right => { + handler.mouse_hwheel(-120, 0); + } + ScrollDirection::Smooth => { + eprintln!("Warning: somehow the Druid widget got a smooth scroll event"); + } + e => { + eprintln!("Warning: the Druid widget got some whacky scroll direction {:?}", e); + } + } + + Inhibit(true) }); } @@ -273,3 +361,16 @@ impl IdleHandle { } } } + +/// Map a GTK mouse button to a Druid one +#[inline] +fn gtk_button_to_druid(button: u32) -> window::MouseButton { + use window::MouseButton; + match button { + 1 => MouseButton::Left, + 2 => MouseButton::Middle, + 3 => MouseButton::Right, + 4 => MouseButton::X1, + _ => MouseButton::X2, + } +} From 745644e7e86cd7a2f0a5286855b159bf44c73b75 Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Wed, 27 Feb 2019 22:48:48 -0500 Subject: [PATCH 07/78] GTK: pass along modifiers in events --- druid-shell/src/druid_gtk/mod.rs | 45 ++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 99043a7cb9..45d4a630a6 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -170,7 +170,7 @@ impl WindowBuilder { handler.mouse(&window::MouseEvent { x: position.0 as i32, y: position.1 as i32, - mods: 0, // TODO: thread this state through somehow + mods: gtk_modifiers_to_druid(button.get_state()), which: gtk_button_to_druid(button.get_button()), ty: window::MouseType::Down, }); @@ -187,7 +187,7 @@ impl WindowBuilder { handler.mouse(&window::MouseEvent { x: position.0 as i32, y: position.1 as i32, - mods: 0, // TODO: thread this state through somehow + mods: gtk_modifiers_to_druid(button.get_state()), which: gtk_button_to_druid(button.get_button()), ty: window::MouseType::Up, }); @@ -201,7 +201,11 @@ impl WindowBuilder { drawing_area.connect_motion_notify_event(move |_widget, motion| { let position = motion.get_position(); - handler.mouse_move(position.0 as i32, position.1 as i32, 0); + handler.mouse_move( + position.0 as i32, + position.1 as i32, + gtk_modifiers_to_druid(motion.get_state()), + ); Inhibit(true) }); @@ -212,31 +216,35 @@ impl WindowBuilder { drawing_area.connect_scroll_event(move |_widget, scroll| { use gdk::ScrollDirection; let deltas = scroll.get_scroll_deltas(); + let modifiers = gtk_modifiers_to_druid(scroll.get_state()); // The magic "120"s are from Microsoft's documentation for WM_MOUSEWHEEL. // They claim that one "tick" on a scroll wheel should be 120 units. // GTK simply reports the direction match scroll.get_direction() { ScrollDirection::Up => { - handler.mouse_wheel(120, 0); + handler.mouse_wheel(120, modifiers); } ScrollDirection::Down => { - handler.mouse_wheel(-120, 0); + handler.mouse_wheel(-120, modifiers); } ScrollDirection::Left => { // Note: this direction is just a guess, I (bobtwinkles) don't // have a way to test horizontal scroll events under GTK. // If it's wrong, the right direction also needs to be changed - handler.mouse_hwheel(120, 0); + handler.mouse_hwheel(120, modifiers); } ScrollDirection::Right => { - handler.mouse_hwheel(-120, 0); + handler.mouse_hwheel(-120, modifiers); } ScrollDirection::Smooth => { eprintln!("Warning: somehow the Druid widget got a smooth scroll event"); } e => { - eprintln!("Warning: the Druid widget got some whacky scroll direction {:?}", e); + eprintln!( + "Warning: the Druid widget got some whacky scroll direction {:?}", + e + ); } } @@ -374,3 +382,24 @@ fn gtk_button_to_druid(button: u32) -> window::MouseButton { _ => MouseButton::X2, } } + +/// Map the GTK modifiers into Druid bits +#[inline] +fn gtk_modifiers_to_druid(modifiers: gdk::ModifierType) -> u32 { + use gdk::ModifierType; + use keycodes; + + let mut output = 0; + + if modifiers.contains(ModifierType::MOD1_MASK) { + output |= keycodes::M_ALT; + } + if modifiers.contains(ModifierType::CONTROL_MASK) { + output |= keycodes::M_CTRL; + } + if modifiers.contains(ModifierType::SHIFT_MASK) { + output |= keycodes::M_SHIFT; + } + + output +} From 30e1c5ebdeada72e1593619471ac7c7f1b29bc1e Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Wed, 27 Feb 2019 23:23:05 -0500 Subject: [PATCH 08/78] GTK: key events --- druid-shell/src/druid_gtk/mod.rs | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 45d4a630a6..2250695257 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -120,11 +120,21 @@ impl WindowBuilder { | EventMask::BUTTON_PRESS_MASK | EventMask::BUTTON_RELEASE_MASK | EventMask::KEY_PRESS_MASK + | EventMask::ENTER_NOTIFY_MASK | EventMask::KEY_RELEASE_MASK | EventMask::SCROLL_MASK) .bits() as i32, ); + drawing_area.set_can_focus(true); + drawing_area.grab_focus(); + + drawing_area.connect_enter_notify_event(|widget, _| { + widget.grab_focus(); + + Inhibit(true) + }); + { let mut last_size = Cell::new((0, 0)); let handler = Arc::clone(&handler); @@ -252,6 +262,39 @@ impl WindowBuilder { }); } + { + let handler = Arc::clone(&handler); + drawing_area.connect_key_press_event(move |_widget, key| { + handler.keydown( + key.get_hardware_keycode() as i32, + gtk_modifiers_to_druid(key.get_state()), + ); + + Inhibit(true) + }); + } + + { + let handler = Arc::clone(&handler); + drawing_area.connect_key_release_event(move |_widget, key| { + let modifiers = gtk_modifiers_to_druid(key.get_state()); + + match gdk::keyval_to_unicode(key.get_keyval()) { + Some(chr) => handler.char(chr as u32, modifiers), + None => { + use gdk::enums::key; + + match key.get_keyval() { + key::KP_Enter => handler.char('\n' as u32, modifiers), + v => eprintln!("Warning: Druid got bogus key value {:?}", v), + } + } + } + + Inhibit(true) + }); + } + window.add(&drawing_area); let tr = WindowHandle { From 2ce17f88b75f039bb81df839485ab7cdb6c287a7 Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Wed, 27 Feb 2019 23:23:29 -0500 Subject: [PATCH 09/78] GTK: minor rustfmt --- druid-shell/src/druid_gtk/mod.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 2250695257..962ff5e3ad 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -301,9 +301,7 @@ impl WindowBuilder { window: Some(window), }; - handler.connect(&window::WindowHandle{ - inner: tr.clone() - }); + handler.connect(&window::WindowHandle { inner: tr.clone() }); Ok(tr) } @@ -337,7 +335,7 @@ impl WindowHandle { use gtk::WidgetExt; match self.window.as_ref() { Some(window) => window.queue_draw(), - None => {}, + None => {} } } From 58059249c25ee066ec7d74090a3381973d4297e6 Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Wed, 27 Feb 2019 23:58:26 -0500 Subject: [PATCH 10/78] GTK: destruction events --- druid-shell/src/druid_gtk/application.rs | 4 +++- druid-shell/src/druid_gtk/mod.rs | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/druid-shell/src/druid_gtk/application.rs b/druid-shell/src/druid_gtk/application.rs index cf8c43be6f..73be1d27a5 100644 --- a/druid-shell/src/druid_gtk/application.rs +++ b/druid-shell/src/druid_gtk/application.rs @@ -14,10 +14,12 @@ //! GTK implementation of features at the application scope. +use gtk; + pub struct Application; impl Application { pub fn quit() { - unimplemented!("Quitting the application"); + // Nothing to do: if this is called, we're already shutting down and GTK will pick it up (I hope?) } } diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 962ff5e3ad..d363e6697d 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -295,6 +295,13 @@ impl WindowBuilder { }); } + { + let handler = Arc::clone(&handler); + drawing_area.connect_destroy(move |widget| { + handler.destroy(); + }); + } + window.add(&drawing_area); let tr = WindowHandle { From 1763a2518efde0f677e195ea14cd49b936371127 Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Thu, 28 Feb 2019 12:08:59 -0500 Subject: [PATCH 11/78] GTK: implement menus --- druid-shell/src/druid_gtk/menu.rs | 43 +++++++++++++++++++++++++++---- druid-shell/src/druid_gtk/mod.rs | 16 +++++++++--- 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/druid-shell/src/druid_gtk/menu.rs b/druid-shell/src/druid_gtk/menu.rs index 3b946f03b0..c348ac3fed 100644 --- a/druid-shell/src/druid_gtk/menu.rs +++ b/druid-shell/src/druid_gtk/menu.rs @@ -13,23 +13,56 @@ // limitations under the License. //! GTK implementation of menus. +use gtk::Menu as GtkMenu; +use gtk::{MenuItem, MenuBar}; +use gtk::{MenuExt, MenuItemExt, MenuShellExt}; -pub struct Menu; +pub struct Menu { + items: Vec, +} impl Menu { pub fn new() -> Menu { - Menu + Menu { + items: Vec::new(), + } } pub fn add_dropdown(&mut self, menu: Menu, text: &str) { - unimplemented!("GTK dropdowns") + let item = MenuItem::new_with_label(text); + item.set_submenu(&menu.into_gtk_menu()); + self.items.push(item); } pub fn add_item(&mut self, id: u32, text: &str) { - unimplemented!("GTK menu items") + let item = MenuItem::new_with_label(text); + item.connect_activate(move |_widget| { + eprintln!("Menu event emission is not yet implemented: {:?}", id); + }); + self.items.push(item); } pub fn add_separator(&mut self) { - unimplemented!("GTK separators") + eprintln!("Warning: GTK separators are not yet implemented"); + } + + pub(crate) fn into_gtk_menubar(self) -> MenuBar { + let menu = MenuBar::new(); + + for item in self.items { + menu.append(&item); + } + + menu + } + + fn into_gtk_menu(self) -> GtkMenu { + let menu = GtkMenu::new(); + + for item in self.items { + menu.append(&item); + } + + menu } } diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index d363e6697d..1c39a40455 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -50,6 +50,7 @@ pub struct WindowBuilder { handler: Option>, title: String, cursor: Cursor, + menu: Option, } #[derive(Clone)] @@ -75,6 +76,7 @@ impl WindowBuilder { handler: None, title: String::new(), cursor: Cursor::Arrow, + menu: None, } } @@ -87,11 +89,11 @@ impl WindowBuilder { } pub fn set_menu(&mut self, menu: Menu) { - // TODO + self.menu = Some(menu); } pub fn build(self) -> Result { - use gtk::{ContainerExt, GtkWindowExt, WidgetExt}; + use gtk::{BoxExt, ContainerExt, GtkWindowExt, WidgetExt}; assert_main_thread(); let handler = self @@ -112,6 +114,14 @@ impl WindowBuilder { // }, // )); + let vbox = gtk::Box::new(gtk::Orientation::Vertical, 0); + window.add(&vbox); + + if let Some(menu) = self.menu { + let menu = menu.into_gtk_menubar(); + vbox.pack_start(&menu, false, false, 0); + } + let drawing_area = gtk::DrawingArea::new(); drawing_area.set_events( @@ -302,7 +312,7 @@ impl WindowBuilder { }); } - window.add(&drawing_area); + vbox.pack_end(&drawing_area, true, true, 0); let tr = WindowHandle { window: Some(window), From d16deb199026d93a053936db4e5f1752565b5acc Mon Sep 17 00:00:00 2001 From: bobtwinkles Date: Thu, 28 Feb 2019 13:34:20 -0500 Subject: [PATCH 12/78] GTK: rewrite menu support so we can call handler.command() --- druid-shell/src/druid_gtk/menu.rs | 66 +++++++++++++++++++++++-------- druid-shell/src/druid_gtk/mod.rs | 2 +- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/druid-shell/src/druid_gtk/menu.rs b/druid-shell/src/druid_gtk/menu.rs index c348ac3fed..aec5952781 100644 --- a/druid-shell/src/druid_gtk/menu.rs +++ b/druid-shell/src/druid_gtk/menu.rs @@ -13,54 +13,86 @@ // limitations under the License. //! GTK implementation of menus. + +use window; + +use std::sync::Arc; + use gtk::Menu as GtkMenu; -use gtk::{MenuItem, MenuBar}; +use gtk::MenuBar as GtkMenuBar; +use gtk::MenuItem as GtkMenuItem; use gtk::{MenuExt, MenuItemExt, MenuShellExt}; pub struct Menu { items: Vec, } +enum MenuItem { + Entry(String, u32), + SubMenu(String, Menu), +} + +impl MenuItem { + /// Get the name of this menu item + fn name(&self) -> &str { + match self { + MenuItem::Entry(name, _) | MenuItem::SubMenu(name, _) => name, + } + } + + fn into_gtk_menu_item(self, handler: Arc>) -> GtkMenuItem { + match self { + MenuItem::Entry(name, id) => { + let item = GtkMenuItem::new_with_label(&name); + item.connect_activate(move |_| { + handler.command(id); + }); + + item + } + MenuItem::SubMenu(name, submenu) => { + let item = GtkMenuItem::new_with_label(&name); + item.set_submenu(&submenu.into_gtk_menu(handler)); + + item + } + } + } +} + impl Menu { pub fn new() -> Menu { - Menu { - items: Vec::new(), - } + Menu { items: Vec::new() } } pub fn add_dropdown(&mut self, menu: Menu, text: &str) { - let item = MenuItem::new_with_label(text); - item.set_submenu(&menu.into_gtk_menu()); - self.items.push(item); + self.items.push(MenuItem::SubMenu(text.into(), menu)); } pub fn add_item(&mut self, id: u32, text: &str) { - let item = MenuItem::new_with_label(text); - item.connect_activate(move |_widget| { - eprintln!("Menu event emission is not yet implemented: {:?}", id); - }); - self.items.push(item); + // TODO: handle accelerator shortcuts by parsing `text` + self.items.push(MenuItem::Entry(text.into(), id)); } pub fn add_separator(&mut self) { eprintln!("Warning: GTK separators are not yet implemented"); } - pub(crate) fn into_gtk_menubar(self) -> MenuBar { - let menu = MenuBar::new(); + pub(crate) fn into_gtk_menubar(self, handler: Arc>) -> GtkMenuBar { + let menu = GtkMenuBar::new(); for item in self.items { - menu.append(&item); + menu.append(&item.into_gtk_menu_item(handler.clone())); } menu } - fn into_gtk_menu(self) -> GtkMenu { + fn into_gtk_menu(self, handler: Arc>) -> GtkMenu { let menu = GtkMenu::new(); for item in self.items { - menu.append(&item); + menu.append(&item.into_gtk_menu_item(handler.clone())); } menu diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 1c39a40455..113b4a28fa 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -118,7 +118,7 @@ impl WindowBuilder { window.add(&vbox); if let Some(menu) = self.menu { - let menu = menu.into_gtk_menubar(); + let menu = menu.into_gtk_menubar(handler.clone()); vbox.pack_start(&menu, false, false, 0); } From 14b082a714d9f44789edd443f613b6c72ff76b95 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Fri, 2 Aug 2019 17:29:21 +0200 Subject: [PATCH 13/78] GTK: fix use statements and mouse/keyboard events --- druid-shell/src/druid_gtk/menu.rs | 2 +- druid-shell/src/druid_gtk/mod.rs | 92 ++++++++++++++++++--------- druid-shell/src/druid_gtk/win_main.rs | 2 +- druid-shell/src/keyboard.rs | 12 ++++ 4 files changed, 75 insertions(+), 33 deletions(-) diff --git a/druid-shell/src/druid_gtk/menu.rs b/druid-shell/src/druid_gtk/menu.rs index aec5952781..45e4421557 100644 --- a/druid-shell/src/druid_gtk/menu.rs +++ b/druid-shell/src/druid_gtk/menu.rs @@ -14,7 +14,7 @@ //! GTK implementation of menus. -use window; +use crate::window; use std::sync::Arc; diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 113b4a28fa..fd7f601a77 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -25,20 +25,22 @@ use std::cell::Cell; use std::ffi::OsString; use std::sync::{Arc, Mutex, Weak}; +use gdk::EventKey; use gdk::EventMask; use gtk::ApplicationWindow; use gtk::Inhibit; -use piet::RenderContext; -use piet_common::Piet; +use piet_common::{Piet, RenderContext}; -use platform::dialog::{FileDialogOptions, FileDialogType}; -use platform::menu::Menu; -use window::{self, Cursor, WinHandler}; -use Error; +use crate::platform::dialog::{FileDialogOptions, FileDialogType}; +use crate::platform::menu::Menu; +use crate::window::{self, Cursor, WinHandler, MouseButton}; +use crate::keyboard; +use crate::Error; use util::assert_main_thread; use win_main::with_application; +use crate::keyboard::{KeyModifiers, KeyCode, KeyEvent}; #[derive(Clone, Default)] pub struct WindowHandle { @@ -190,9 +192,10 @@ impl WindowBuilder { handler.mouse(&window::MouseEvent { x: position.0 as i32, y: position.1 as i32, + count: 1, mods: gtk_modifiers_to_druid(button.get_state()), - which: gtk_button_to_druid(button.get_button()), - ty: window::MouseType::Down, + button: gtk_button_to_druid(button.get_button()), + //ty: window::MouseType::Down, }); Inhibit(true) @@ -208,8 +211,9 @@ impl WindowBuilder { x: position.0 as i32, y: position.1 as i32, mods: gtk_modifiers_to_druid(button.get_state()), - which: gtk_button_to_druid(button.get_button()), - ty: window::MouseType::Up, + count: 0, + button: gtk_button_to_druid(button.get_button()), + //ty: window::MouseType::Up, }); Inhibit(true) @@ -220,12 +224,15 @@ impl WindowBuilder { let handler = Arc::clone(&handler); drawing_area.connect_motion_notify_event(move |_widget, motion| { let position = motion.get_position(); + let mouse_event = window::MouseEvent { + x: position.0 as i32, + y: position.1 as i32, + mods: gtk_modifiers_to_druid(motion.get_state()), + count: 0, + button: gtk_modifiers_to_mouse_button(motion.get_state()) + }; - handler.mouse_move( - position.0 as i32, - position.1 as i32, - gtk_modifiers_to_druid(motion.get_state()), - ); + handler.mouse_move(&mouse_event); Inhibit(true) }); @@ -275,10 +282,8 @@ impl WindowBuilder { { let handler = Arc::clone(&handler); drawing_area.connect_key_press_event(move |_widget, key| { - handler.keydown( - key.get_hardware_keycode() as i32, - gtk_modifiers_to_druid(key.get_state()), - ); + let key_event = gtk_event_key_to_key_event(key); + handler.key_down(key_event); Inhibit(true) }); @@ -443,21 +448,46 @@ fn gtk_button_to_druid(button: u32) -> window::MouseButton { /// Map the GTK modifiers into Druid bits #[inline] -fn gtk_modifiers_to_druid(modifiers: gdk::ModifierType) -> u32 { +fn gtk_modifiers_to_druid(modifiers: gdk::ModifierType) -> keyboard::KeyModifiers { use gdk::ModifierType; - use keycodes; + use crate::keycodes; - let mut output = 0; - - if modifiers.contains(ModifierType::MOD1_MASK) { - output |= keycodes::M_ALT; - } - if modifiers.contains(ModifierType::CONTROL_MASK) { - output |= keycodes::M_CTRL; + keyboard::KeyModifiers { + shift: modifiers.contains(ModifierType::SHIFT_MASK), + alt: modifiers.contains(ModifierType::MOD1_MASK), + ctrl: modifiers.contains(ModifierType::CONTROL_MASK), + meta: modifiers.contains(ModifierType::META_MASK) } - if modifiers.contains(ModifierType::SHIFT_MASK) { - output |= keycodes::M_SHIFT; +} + +#[inline] +fn gtk_modifiers_to_mouse_button(modifiers: gdk::ModifierType) -> window::MouseButton { + use gdk::ModifierType; + match modifiers { + modifiers if modifiers.contains(ModifierType::BUTTON1) => MouseButton::Left, + modifiers if modifiers.contains(ModifierType::BUTTON2) => MouseButton::Middle, + modifiers if modifiers.contains(ModifierType::BUTTON3) => MouseButton::Right, + modifiers if modifiers.contains(ModifierType::BUTTON4) => MouseButton::X1, + modifiers if modifiers.contains(ModifierType::BUTTON5) => MouseButton::X2, + _ => { + //FIXME: what about when no modifiers match? + MouseButton::Left + } } +} + +/// Map a GTK hardware_keycode into Druid keyboard::KeyCode +fn gtk_hardware_keycode_to_druid(hardware_keycode: u16) -> keyboard::KeyCode { + // TODO Steven implement the mapping, see keyboard.rs, add a From impl! + keyboard::KeyCode::KeyA +} - output +fn gtk_event_key_to_key_event(key: &EventKey) -> keyboard::KeyEvent { + keyboard::KeyEvent::new( + key.get_hardware_keycode(), + false, // TODO Steven implement is_repeat + gtk_modifiers_to_druid(key.get_state()), + "s", // TODO Steven + "s" // TODO Steven + ) } diff --git a/druid-shell/src/druid_gtk/win_main.rs b/druid-shell/src/druid_gtk/win_main.rs index 6b3ea4804b..5d55713a75 100644 --- a/druid-shell/src/druid_gtk/win_main.rs +++ b/druid-shell/src/druid_gtk/win_main.rs @@ -17,7 +17,7 @@ use gio::ApplicationFlags; use gtk::{Application, ApplicationWindow}; use std::cell::RefCell; -use util::assert_main_thread; +use crate::util::assert_main_thread; /// XXX: The application needs to be global because WindowBuilder::build wants /// to construct an ApplicationWindow, which needs the application, but diff --git a/druid-shell/src/keyboard.rs b/druid-shell/src/keyboard.rs index ca58a2155b..6d36a80297 100644 --- a/druid-shell/src/keyboard.rs +++ b/druid-shell/src/keyboard.rs @@ -530,6 +530,18 @@ impl From for KeyCode { } } +#[cfg(any(test, target_os = "linux"))] +impl From for KeyCode { + fn from(raw: u16) -> KeyCode { + match raw { + // TODO Steven needs a proper implementation + 0x00 => KeyCode::KeyA, + 0x01 => KeyCode::KeyS, + other => KeyCode::KeyA + } + } +} + /// Should realistically be (8 * N) - 1; we need one byte for the length. const TINY_STR_CAPACITY: usize = 15; From bcf6ef3d0476b1455c90088e4bbfdd497148f5e4 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Fri, 2 Aug 2019 20:14:18 +0200 Subject: [PATCH 14/78] GTK: First mapping of GDK_KEY codes to KeyCode enum values --- druid-shell/src/druid_gtk/mod.rs | 153 +++++++++++++++++++++++++------ druid-shell/src/keyboard.rs | 13 +-- 2 files changed, 128 insertions(+), 38 deletions(-) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index fd7f601a77..368b162aab 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -40,7 +40,7 @@ use crate::Error; use util::assert_main_thread; use win_main::with_application; -use crate::keyboard::{KeyModifiers, KeyCode, KeyEvent}; +use crate::keyboard::{KeyModifiers, KeyCode, KeyEvent, RawKeyCode, StrOrChar}; #[derive(Clone, Default)] pub struct WindowHandle { @@ -292,19 +292,9 @@ impl WindowBuilder { { let handler = Arc::clone(&handler); drawing_area.connect_key_release_event(move |_widget, key| { - let modifiers = gtk_modifiers_to_druid(key.get_state()); - - match gdk::keyval_to_unicode(key.get_keyval()) { - Some(chr) => handler.char(chr as u32, modifiers), - None => { - use gdk::enums::key; + let key_event = gtk_event_key_to_key_event(key); + handler.key_up(key_event); - match key.get_keyval() { - key::KP_Enter => handler.char('\n' as u32, modifiers), - v => eprintln!("Warning: Druid got bogus key value {:?}", v), - } - } - } Inhibit(true) }); @@ -460,15 +450,14 @@ fn gtk_modifiers_to_druid(modifiers: gdk::ModifierType) -> keyboard::KeyModifier } } -#[inline] fn gtk_modifiers_to_mouse_button(modifiers: gdk::ModifierType) -> window::MouseButton { use gdk::ModifierType; match modifiers { - modifiers if modifiers.contains(ModifierType::BUTTON1) => MouseButton::Left, - modifiers if modifiers.contains(ModifierType::BUTTON2) => MouseButton::Middle, - modifiers if modifiers.contains(ModifierType::BUTTON3) => MouseButton::Right, - modifiers if modifiers.contains(ModifierType::BUTTON4) => MouseButton::X1, - modifiers if modifiers.contains(ModifierType::BUTTON5) => MouseButton::X2, + modifiers if modifiers.contains(ModifierType::BUTTON1_MASK) => MouseButton::Left, + modifiers if modifiers.contains(ModifierType::BUTTON2_MASK) => MouseButton::Middle, + modifiers if modifiers.contains(ModifierType::BUTTON3_MASK) => MouseButton::Right, + modifiers if modifiers.contains(ModifierType::BUTTON4_MASK) => MouseButton::X1, + modifiers if modifiers.contains(ModifierType::BUTTON5_MASK) => MouseButton::X2, _ => { //FIXME: what about when no modifiers match? MouseButton::Left @@ -476,18 +465,128 @@ fn gtk_modifiers_to_mouse_button(modifiers: gdk::ModifierType) -> window::MouseB } } -/// Map a GTK hardware_keycode into Druid keyboard::KeyCode -fn gtk_hardware_keycode_to_druid(hardware_keycode: u16) -> keyboard::KeyCode { - // TODO Steven implement the mapping, see keyboard.rs, add a From impl! - keyboard::KeyCode::KeyA -} + + fn gtk_event_key_to_key_event(key: &EventKey) -> keyboard::KeyEvent { + let keyval = key.get_keyval(); + let keycode = KeyCode::from(keyval); + + // TODO how can we get the different versions from GDK? + let text: StrOrChar = gdk::keyval_to_unicode(keyval).into(); + let unmodified_text: StrOrChar = gdk::keyval_to_unicode(keyval).into(); + keyboard::KeyEvent::new( - key.get_hardware_keycode(), + keyval, false, // TODO Steven implement is_repeat gtk_modifiers_to_druid(key.get_state()), - "s", // TODO Steven - "s" // TODO Steven + text, + unmodified_text ) } + +impl From for KeyCode { + fn from(raw: u32) -> KeyCode { + use gdk::enums::key; + use gdk::enums::key::*; + match raw { + a | A => KeyCode::KeyA, + s | S => KeyCode::KeyS, + d | D => KeyCode::KeyD, + f | F => KeyCode::KeyF, + h | H => KeyCode::KeyH, + g | G => KeyCode::KeyG, + z | Z => KeyCode::KeyZ, + x | X => KeyCode::KeyX, + c | C => KeyCode::KeyC, + v | V => KeyCode::KeyV, + b | B => KeyCode::KeyB, + q | Q => KeyCode::KeyQ, + w | W => KeyCode::KeyW, + e | E => KeyCode::KeyE, + r | R => KeyCode::KeyR, + y | Y => KeyCode::KeyY, + t | T => KeyCode::KeyT, + _1 => KeyCode::Key1, + _2 => KeyCode::Key2, + _3 => KeyCode::Key3, + _4 => KeyCode::Key4, + _6 => KeyCode::Key6, + _5 => KeyCode::Key5, + equal => KeyCode::Equals, + _9 => KeyCode::Key9, + _7 => KeyCode::Key7, + minus => KeyCode::Minus, + _8 => KeyCode::Key8, + _0 => KeyCode::Key0, + bracketright => KeyCode::RightBracket, + o | O => KeyCode::KeyO, + u | U => KeyCode::KeyU, + bracketleft => KeyCode::LeftBracket, + i | I => KeyCode::KeyI, + p | P => KeyCode::KeyP, + Return => KeyCode::Return, + l | L => KeyCode::KeyL, + j | J => KeyCode::KeyJ, + grave => KeyCode::Backtick, + k | K => KeyCode::KeyK, + semicolon => KeyCode::Semicolon, + backslash => KeyCode::Backslash, + comma => KeyCode::Comma, + slash => KeyCode::Slash, + n | N => KeyCode::KeyN, + m | M => KeyCode::KeyM, + period => KeyCode::Period, + Tab => KeyCode::Tab, + space => KeyCode::Space, + BackSpace => KeyCode::Backspace, + Escape => KeyCode::Escape, + Caps_Lock => KeyCode::CapsLock, + KP_Decimal => KeyCode::NumpadDecimal, + KP_Multiply => KeyCode::NumpadMultiply, + KP_Add => KeyCode::NumpadAdd, + Num_Lock => KeyCode::NumLock, + KP_Divide => KeyCode::NumpadDivide, + KP_Enter => KeyCode::NumpadEnter, + KP_Subtract => KeyCode::NumpadSubtract, + KP_Equal => KeyCode::NumpadEquals, + KP_0 => KeyCode::Numpad0, + KP_1 => KeyCode::Numpad1, + KP_2 => KeyCode::Numpad2, + KP_3 => KeyCode::Numpad3, + KP_4 => KeyCode::Numpad4, + KP_5 => KeyCode::Numpad5, + KP_6 => KeyCode::Numpad6, + KP_7 => KeyCode::Numpad7, + KP_8 => KeyCode::Numpad8, + KP_9 => KeyCode::Numpad9, + F5 => KeyCode::F5, + F6 => KeyCode::F6, + F7 => KeyCode::F7, + F3 => KeyCode::F3, + F8=> KeyCode::F8, + F9=> KeyCode::F9, + F10 => KeyCode::F10, + F11 => KeyCode::F11, + F12 => KeyCode::F12, + Insert => KeyCode::Insert, + Home => KeyCode::Home, + Page_Up => KeyCode::PageUp, + Delete => KeyCode::Delete, + F4 => KeyCode::F4, + End => KeyCode::End, + F2 => KeyCode::F2, + Page_Down => KeyCode::PageDown, + F1 => KeyCode::F1, + leftarrow => KeyCode::ArrowLeft, + rightarrow => KeyCode::ArrowRight, + downarrow => KeyCode::ArrowDown, + uparrow => KeyCode::ArrowUp, + + other => { + eprintln!("Warning: unknown keyval {}", raw); + KeyCode::Unknown(RawKeyCode::Linux(raw)) + } + } + } +} diff --git a/druid-shell/src/keyboard.rs b/druid-shell/src/keyboard.rs index 6d36a80297..e97a111d61 100644 --- a/druid-shell/src/keyboard.rs +++ b/druid-shell/src/keyboard.rs @@ -233,6 +233,7 @@ pub enum KeyCode { pub enum RawKeyCode { Windows(i32), Mac(u16), + Linux(u32) } impl KeyCode { @@ -530,17 +531,7 @@ impl From for KeyCode { } } -#[cfg(any(test, target_os = "linux"))] -impl From for KeyCode { - fn from(raw: u16) -> KeyCode { - match raw { - // TODO Steven needs a proper implementation - 0x00 => KeyCode::KeyA, - 0x01 => KeyCode::KeyS, - other => KeyCode::KeyA - } - } -} + /// Should realistically be (8 * N) - 1; we need one byte for the length. const TINY_STR_CAPACITY: usize = 15; From 385726bb398c2cb3e1d5ff04db792336ea02fa73 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Fri, 2 Aug 2019 21:06:17 +0200 Subject: [PATCH 15/78] GTK: Add MenuKey arg to Menu::add_item so sample.rs compiles and runs --- druid-shell/src/druid_gtk/dialog.rs | 1 - druid-shell/src/druid_gtk/menu.rs | 4 +++- druid-shell/src/druid_gtk/mod.rs | 22 +++++++++------------- druid-shell/src/druid_gtk/win_main.rs | 2 +- druid-shell/src/keyboard.rs | 4 +--- druid-shell/src/lib.rs | 4 ++-- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/druid-shell/src/druid_gtk/dialog.rs b/druid-shell/src/druid_gtk/dialog.rs index 36dd6fa058..0ba3db4d47 100644 --- a/druid-shell/src/druid_gtk/dialog.rs +++ b/druid-shell/src/druid_gtk/dialog.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. - //! File open/save dialogs, GTK implementation. /// Type of file dialog. diff --git a/druid-shell/src/druid_gtk/menu.rs b/druid-shell/src/druid_gtk/menu.rs index 45e4421557..a459f16e73 100644 --- a/druid-shell/src/druid_gtk/menu.rs +++ b/druid-shell/src/druid_gtk/menu.rs @@ -23,6 +23,8 @@ use gtk::MenuBar as GtkMenuBar; use gtk::MenuItem as GtkMenuItem; use gtk::{MenuExt, MenuItemExt, MenuShellExt}; +use crate::keycodes::MenuKey; + pub struct Menu { items: Vec, } @@ -69,7 +71,7 @@ impl Menu { self.items.push(MenuItem::SubMenu(text.into(), menu)); } - pub fn add_item(&mut self, id: u32, text: &str) { + pub fn add_item(&mut self, id: u32, text: &str, key: impl Into) { // TODO: handle accelerator shortcuts by parsing `text` self.items.push(MenuItem::Entry(text.into(), id)); } diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 368b162aab..246270bb14 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -32,15 +32,15 @@ use gtk::Inhibit; use piet_common::{Piet, RenderContext}; +use crate::keyboard; use crate::platform::dialog::{FileDialogOptions, FileDialogType}; use crate::platform::menu::Menu; -use crate::window::{self, Cursor, WinHandler, MouseButton}; -use crate::keyboard; +use crate::window::{self, Cursor, MouseButton, WinHandler}; use crate::Error; +use crate::keyboard::{KeyCode, KeyEvent, KeyModifiers, RawKeyCode, StrOrChar}; use util::assert_main_thread; use win_main::with_application; -use crate::keyboard::{KeyModifiers, KeyCode, KeyEvent, RawKeyCode, StrOrChar}; #[derive(Clone, Default)] pub struct WindowHandle { @@ -229,7 +229,7 @@ impl WindowBuilder { y: position.1 as i32, mods: gtk_modifiers_to_druid(motion.get_state()), count: 0, - button: gtk_modifiers_to_mouse_button(motion.get_state()) + button: gtk_modifiers_to_mouse_button(motion.get_state()), }; handler.mouse_move(&mouse_event); @@ -295,7 +295,6 @@ impl WindowBuilder { let key_event = gtk_event_key_to_key_event(key); handler.key_up(key_event); - Inhibit(true) }); } @@ -439,14 +438,14 @@ fn gtk_button_to_druid(button: u32) -> window::MouseButton { /// Map the GTK modifiers into Druid bits #[inline] fn gtk_modifiers_to_druid(modifiers: gdk::ModifierType) -> keyboard::KeyModifiers { - use gdk::ModifierType; use crate::keycodes; + use gdk::ModifierType; keyboard::KeyModifiers { shift: modifiers.contains(ModifierType::SHIFT_MASK), alt: modifiers.contains(ModifierType::MOD1_MASK), ctrl: modifiers.contains(ModifierType::CONTROL_MASK), - meta: modifiers.contains(ModifierType::META_MASK) + meta: modifiers.contains(ModifierType::META_MASK), } } @@ -465,9 +464,6 @@ fn gtk_modifiers_to_mouse_button(modifiers: gdk::ModifierType) -> window::MouseB } } - - - fn gtk_event_key_to_key_event(key: &EventKey) -> keyboard::KeyEvent { let keyval = key.get_keyval(); let keycode = KeyCode::from(keyval); @@ -481,7 +477,7 @@ fn gtk_event_key_to_key_event(key: &EventKey) -> keyboard::KeyEvent { false, // TODO Steven implement is_repeat gtk_modifiers_to_druid(key.get_state()), text, - unmodified_text + unmodified_text, ) } @@ -564,8 +560,8 @@ impl From for KeyCode { F6 => KeyCode::F6, F7 => KeyCode::F7, F3 => KeyCode::F3, - F8=> KeyCode::F8, - F9=> KeyCode::F9, + F8 => KeyCode::F8, + F9 => KeyCode::F9, F10 => KeyCode::F10, F11 => KeyCode::F11, F12 => KeyCode::F12, diff --git a/druid-shell/src/druid_gtk/win_main.rs b/druid-shell/src/druid_gtk/win_main.rs index 5d55713a75..d7fef4e0d9 100644 --- a/druid-shell/src/druid_gtk/win_main.rs +++ b/druid-shell/src/druid_gtk/win_main.rs @@ -14,10 +14,10 @@ //! GTK implementation of runloop. +use crate::util::assert_main_thread; use gio::ApplicationFlags; use gtk::{Application, ApplicationWindow}; use std::cell::RefCell; -use crate::util::assert_main_thread; /// XXX: The application needs to be global because WindowBuilder::build wants /// to construct an ApplicationWindow, which needs the application, but diff --git a/druid-shell/src/keyboard.rs b/druid-shell/src/keyboard.rs index e97a111d61..1912faf8a6 100644 --- a/druid-shell/src/keyboard.rs +++ b/druid-shell/src/keyboard.rs @@ -233,7 +233,7 @@ pub enum KeyCode { pub enum RawKeyCode { Windows(i32), Mac(u16), - Linux(u32) + Linux(u32), } impl KeyCode { @@ -531,8 +531,6 @@ impl From for KeyCode { } } - - /// Should realistically be (8 * N) - 1; we need one byte for the length. const TINY_STR_CAPACITY: usize = 15; diff --git a/druid-shell/src/lib.rs b/druid-shell/src/lib.rs index 37a797015d..5aa7985ef4 100644 --- a/druid-shell/src/lib.rs +++ b/druid-shell/src/lib.rs @@ -32,9 +32,9 @@ extern crate gdk; #[cfg(target_os = "linux")] extern crate gio; #[cfg(target_os = "linux")] -extern crate gtk; -#[cfg(target_os = "linux")] extern crate glib; +#[cfg(target_os = "linux")] +extern crate gtk; #[macro_use] extern crate lazy_static; From 54749e33d42716f4195a70e0992ae6b645c16710 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Sat, 3 Aug 2019 12:30:23 +0200 Subject: [PATCH 16/78] GTK: Update dependencies to gtk 0.70 and cairo-rs 0.7.1 --- Cargo.lock | 1132 +++++++++++++++++++++++++ druid-shell/Cargo.toml | 10 +- druid-shell/src/druid_gtk/menu.rs | 4 +- druid-shell/src/druid_gtk/mod.rs | 7 +- druid-shell/src/druid_gtk/win_main.rs | 5 +- 5 files changed, 1145 insertions(+), 13 deletions(-) create mode 100644 Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000000..f96feab9d8 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1132 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "aho-corasick" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arrayvec" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atk-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "backtrace" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bitflags" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "boolinator" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bumpalo" +version = "2.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cairo-rs" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cocoa" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "core-graphics" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "direct2d" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "direct3d11" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "directwrite" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "druid" +version = "0.3.0" +dependencies = [ + "druid-shell 0.3.0", +] + +[[package]] +name = "druid-shell" +version = "0.3.0" +dependencies = [ + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", + "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-common 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dxgi" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "either" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "env_logger" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fragile" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "gdk" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdk-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gio" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gio-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glib" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glib-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gobject-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gtk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gtk-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "heck" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "humantime" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "js-sys" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "kurbo" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lazy_static" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.58" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "log" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "nodrop" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "nom" +version = "4.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-bigint" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-complex" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-integer" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-iter" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-rational" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "numtoa" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "objc" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pango" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pango-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-cairo" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-common" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-cairo 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-direct2d 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-web 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-direct2d" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-web" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quote" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.54" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_termios" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc-serialize" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "sourcefile" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "syn" +version = "0.15.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synstructure" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termcolor" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termion" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ucd-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-segmentation" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "utf8-ranges" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasm-bindgen" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasm-bindgen-webidl" +version = "0.2.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "web-sys" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-webidl 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "weedle" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wincolor" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wio" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" +"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" +"checksum atk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "86b7499272acf036bb5820c6e346bbfb5acc5dceb104bc2c4fd7e6e33dfcde6a" +"checksum atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067531f752c01027f004032bb676e715aba74b75e904a7340a61ce3fb0b61b0" +"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" +"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" +"checksum backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)" = "ada4c783bb7e7443c14e0480f429ae2cc99da95065aeab7ee1b81ada0419404f" +"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" +"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +"checksum boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" +"checksum bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "84dca3afd8e01b9526818b7963e5b4916063b3cdf9f10cf6b73ef0bd0ec37aa5" +"checksum cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e05db47de3b0f09a222fa4bba2eab957d920d4243962a86b2d77ab401e4a359c" +"checksum cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90a1ec04603a78c111886a385edcec396dbfbc57ea26b9e74aeea6a1fe55dcca" +"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" +"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf79daa4e11e5def06e55306aa3601b87de6b5149671529318da048f67cdd77b" +"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" +"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" +"checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" +"checksum direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7fa6ff10857eb253d1ae16987ebfd27372f4129b0c7a3fa41466fbdf7e453e75" +"checksum direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "315aa929e68ba066cb6fb86f1b22af24f517e02fd9b5734c4d07e42cb9f4aefa" +"checksum directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8cdcd739e9351c411b8caf5cab32a27c818cfe06260595da121382ecdd22083d" +"checksum dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1639bbfd6765e92a40267d217a7acbac5b49320b68013f39a8e4376aa8c1e091" +"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" +"checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f8140122fa0d5dcb9fc8627cfce2b37cc1500f752636d46ea28bc26785c2f9" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6243e995f41f3a61a31847e54cc719edce93dd9140c89dca3b9919be1cfe22d5" +"checksum gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9726408ee1bbada83094326a99b9c68fea275f9dbb515de242a69e72051f4fcc" +"checksum gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1d6778abf5764b9080a9345a16c5d16289426a3b3edd808a29a9061d431c465" +"checksum gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ebe06357212127f50575b535bdb04638f5d375bb41062287abc6c94e5b8067b" +"checksum gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6261b5d34c30c2d59f879e643704cf54cb44731f3a2038000b68790c03e360e3" +"checksum gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "778b856a70a32e2cc5dd5cc7fa1b0c4b6df924fdf5c82984bc28f30565657cfe" +"checksum glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91a70db179515473b57aaff8b879167f1f8460bc5523e97beacf6d1026a8b99d" +"checksum glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b86a9169fbc9cf9a0ef315039c2304b09d5c575c5fde7defba3576a0311b863" +"checksum gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61d55bc9202447ca776f6ad0048c36e3312010f66f82ab478e97513e93f3604b" +"checksum gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "709f1074259d4685b96133f92b75c7f35b504715b0fcdc96ec95de2607296a60" +"checksum gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bbd9395497ae1d1915d1d6e522d51ae8745bf613906c34ac191c411250fc4025" +"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" +"checksum js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "9987e7c13a91d9cf0efe59cca48a3a7a70e2b11695d5a4640f85ae71e28f5e73" +"checksum kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0caeb26248a62abf92dea93aad4f8244f54668e2f1060ed9cd9fd1d5545723" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" +"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" +"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" +"checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1" +"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" +"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" +"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" +"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" +"checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d" +"checksum pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393fa071b144f8ffb83ede273758983cf414ca3c0b1d2a5a9ce325b3ba3dd786" +"checksum pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ee97abcad820f9875e032656257ad1c790e7b11a0e6ce2516a8f5b0d8f8213f" +"checksum piet 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5bf3e87499d52d7a805787b5728fda48f9a2bafd502c19ff1dbfafd5887b6e44" +"checksum piet-cairo 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "27fd868970edd7b4e5d629c6357aae2eba563dd6044be94f43b39db956acbc3e" +"checksum piet-common 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e35d47e80b4a36ba5869a8c2d14389a72951c0b65bc5729da2449b164ceca058" +"checksum piet-direct2d 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a59576e5687b541e1b716cdb513862b42febb489e7d17d1f71d367e45d8da860" +"checksum piet-web 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b05f4636aaea5836367c0a4fdcf26e4822a481a15dd40fb06e2f9f5f1df8d20e" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" +"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" +"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" +"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0b2f0808e7d7e4fb1cb07feb6ff2f4bc827938f24f8c2e6a3beb7370af544bdd" +"checksum regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d76410686f9e3a17f06128962e0ecc5755870bb890c34820c7af7f1db2e1d48" +"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" +"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +"checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" +"checksum syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)" = "641e117d55514d6d918490e47102f7e08d096fdde360247e4a10f7a91a8478d3" +"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" +"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" +"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" +"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +"checksum wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "b7ccc7b93cfd13e26700a9e2e41e6305f1951b87e166599069f77d10358100e6" +"checksum wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "1953f91b1608eb1522513623c7739f047bb0fed4128ce51a93f08e12cc314645" +"checksum wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "0f69da5696545d7ca6607a2e4b1a0edf5a6b36b2c49dbb0f1df6ad1d92884047" +"checksum wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d4246f3bc73223bbb846f4f2430a60725826a96c9389adf715ed1d5af46dec6" +"checksum wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "c08381e07e7a79e5e229ad7c60d15833d19033542cc5dd91d085df59d235f4a6" +"checksum wasm-bindgen-webidl 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "1f42ff7adb8102bf5ad8adbc45b1635c520c8175f9fdf6eb2c54479d485d435a" +"checksum web-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "540b8259eb242ff3a566fa0140bda03a4ece4e5c226e1284b5c95dddcd4341f6" +"checksum weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc44aa200daee8b1f3a004beaf16554369746f1b4486f0cf93b0caf8a3c2d1e" +"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" +"checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" diff --git a/druid-shell/Cargo.toml b/druid-shell/Cargo.toml index ddbf6ac0c9..27c347f048 100644 --- a/druid-shell/Cargo.toml +++ b/druid-shell/Cargo.toml @@ -33,11 +33,11 @@ core-graphics = "0.17.3" cairo-rs = { version = "0.7.1", default_features = false } [target.'cfg(target_os="linux")'.dependencies] -cairo-rs = { version = "0.5.0", default_features = false } -gio = "0.5.0" -gdk = "0.9.0" -gtk = "0.5.0" -glib = "0.6.1" +cairo-rs = { version = "0.7.1", default_features = false } +gio = "0.7.0" +gdk = "0.11.0" +gtk = "0.7.0" +glib = "0.8.1" [dev-dependencies] kurbo = "0.2.1" diff --git a/druid-shell/src/druid_gtk/menu.rs b/druid-shell/src/druid_gtk/menu.rs index a459f16e73..c98704c851 100644 --- a/druid-shell/src/druid_gtk/menu.rs +++ b/druid-shell/src/druid_gtk/menu.rs @@ -21,7 +21,7 @@ use std::sync::Arc; use gtk::Menu as GtkMenu; use gtk::MenuBar as GtkMenuBar; use gtk::MenuItem as GtkMenuItem; -use gtk::{MenuExt, MenuItemExt, MenuShellExt}; +use gtk::{GtkMenuExt, GtkMenuItemExt, MenuShellExt}; use crate::keycodes::MenuKey; @@ -54,7 +54,7 @@ impl MenuItem { } MenuItem::SubMenu(name, submenu) => { let item = GtkMenuItem::new_with_label(&name); - item.set_submenu(&submenu.into_gtk_menu(handler)); + item.set_submenu(Some(&submenu.into_gtk_menu(handler))); item } diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 246270bb14..f9eeadfc8f 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -95,7 +95,7 @@ impl WindowBuilder { } pub fn build(self) -> Result { - use gtk::{BoxExt, ContainerExt, GtkWindowExt, WidgetExt}; + use gtk::{BoxExt, ContainerExt, GtkWindowExt, WidgetExt, WidgetExtManual}; assert_main_thread(); let handler = self @@ -127,15 +127,14 @@ impl WindowBuilder { let drawing_area = gtk::DrawingArea::new(); drawing_area.set_events( - (EventMask::EXPOSURE_MASK + EventMask::EXPOSURE_MASK | EventMask::POINTER_MOTION_MASK | EventMask::BUTTON_PRESS_MASK | EventMask::BUTTON_RELEASE_MASK | EventMask::KEY_PRESS_MASK | EventMask::ENTER_NOTIFY_MASK | EventMask::KEY_RELEASE_MASK - | EventMask::SCROLL_MASK) - .bits() as i32, + | EventMask::SCROLL_MASK ); drawing_area.set_can_focus(true); diff --git a/druid-shell/src/druid_gtk/win_main.rs b/druid-shell/src/druid_gtk/win_main.rs index d7fef4e0d9..5f035ac13e 100644 --- a/druid-shell/src/druid_gtk/win_main.rs +++ b/druid-shell/src/druid_gtk/win_main.rs @@ -32,20 +32,21 @@ pub struct RunLoop {} impl RunLoop { pub fn new() -> RunLoop { use gio::ApplicationExt; + use gio::Cancellable; use gtk::GtkApplicationExt; assert_main_thread(); // TODO: we should give control over the application ID to the user let application = - Application::new("com.github.xi-editor.druid", ApplicationFlags::FLAGS_NONE) + Application::new(Some("com.github.xi-editor.druid"), ApplicationFlags::FLAGS_NONE) .expect("Unable to create GTK application"); application.connect_activate(|app| { eprintln!("Activated application"); }); - application.register(None); + application.register(None as Option<&Cancellable>); application.activate(); GTK_APPLICATION.with(move |x| *x.borrow_mut() = Some(application)); From 2e7215e71ee3802f3f258deadd83071037476dca Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Sat, 3 Aug 2019 13:07:28 +0200 Subject: [PATCH 17/78] GTK: Examples run after muggle merge with WinCtx changes --- druid-shell/Cargo.lock | 739 ----------------------- druid-shell/src/druid_gtk/application.rs | 2 - druid-shell/src/druid_gtk/menu.rs | 43 +- druid-shell/src/druid_gtk/mod.rs | 316 ++++++---- druid-shell/src/druid_gtk/win_main.rs | 21 +- 5 files changed, 255 insertions(+), 866 deletions(-) delete mode 100644 druid-shell/Cargo.lock diff --git a/druid-shell/Cargo.lock b/druid-shell/Cargo.lock deleted file mode 100644 index 3b7226be4b..0000000000 --- a/druid-shell/Cargo.lock +++ /dev/null @@ -1,739 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "arrayvec" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "autocfg" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "backtrace" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace-sys" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bitflags" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "boolinator" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bumpalo" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cairo-rs" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cairo-sys-rs" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cc" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cfg-if" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cocoa" -version = "0.18.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", - "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "core-foundation" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "core-foundation-sys" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "core-graphics" -version = "0.17.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "direct2d" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "direct3d11" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "directwrite" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "druid-shell" -version = "0.3.0" -dependencies = [ - "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", - "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "dxgi" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "either" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "failure" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure_derive" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "js-sys" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "kurbo" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lazy_static" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.60" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "log" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memchr" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "nodrop" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "nom" -version = "4.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-bigint" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-complex" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-integer" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-iter" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-rational" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "objc" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-cairo" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-common" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-cairo 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-direct2d 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-web 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-direct2d" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-web" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pkg-config" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "redox_syscall" -version = "0.1.56" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-demangle" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "sourcefile" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "syn" -version = "0.15.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "synstructure" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "time" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-segmentation" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wasm-bindgen" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wasm-bindgen-webidl" -version = "0.2.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "web-sys" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", - "sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-webidl 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "weedle" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wio" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" -"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" -"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" -"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" -"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" -"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" -"checksum boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" -"checksum bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd43d82f27d68911e6ee11ee791fb248f138f5d69424dc02e098d4f152b0b05" -"checksum cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e05db47de3b0f09a222fa4bba2eab957d920d4243962a86b2d77ab401e4a359c" -"checksum cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90a1ec04603a78c111886a385edcec396dbfbc57ea26b9e74aeea6a1fe55dcca" -"checksum cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "ce400c638d48ee0e9ab75aef7997609ec57367ccfe1463f21bf53c3eca67bf46" -"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" -"checksum cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf79daa4e11e5def06e55306aa3601b87de6b5149671529318da048f67cdd77b" -"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" -"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" -"checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" -"checksum direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7fa6ff10857eb253d1ae16987ebfd27372f4129b0c7a3fa41466fbdf7e453e75" -"checksum direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "315aa929e68ba066cb6fb86f1b22af24f517e02fd9b5734c4d07e42cb9f4aefa" -"checksum directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8cdcd739e9351c411b8caf5cab32a27c818cfe06260595da121382ecdd22083d" -"checksum dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1639bbfd6765e92a40267d217a7acbac5b49320b68013f39a8e4376aa8c1e091" -"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" -"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" -"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" -"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -"checksum js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "da3ea71161651a4cd97d999b2da139109c537b15ab33abc8ae4ead38deac8a03" -"checksum kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0caeb26248a62abf92dea93aad4f8244f54668e2f1060ed9cd9fd1d5545723" -"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" -"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" -"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" -"checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1" -"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" -"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" -"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" -"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" -"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" -"checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d" -"checksum piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "02e36470db0f6e8900c3f2d35ae137c96ebb726af2c070fc4369467ee57ab9bd" -"checksum piet-cairo 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1afd8ad4a74d1ef1591e0bad7f860841c5a0cab6edeb347fc67e2e37422c01df" -"checksum piet-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8e8cb78927118d65d350a677432e459d90ff72ea6fc875cf1ac1478d5570e196" -"checksum piet-direct2d 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ccea047f88a367ad86b2a972302070f0bf4183b51376ad840b9eb298f3bdafc1" -"checksum piet-web 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5f168f31a01eb3d0cc977258ae6b085f98d022f32b7e3edcdb4f565d912dcc60" -"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" -"checksum syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)" = "ee06ea4b620ab59a2267c6b48be16244a3389f8bfa0986bdd15c35b890b00af3" -"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" -"checksum wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "4de97fa1806bb1a99904216f6ac5e0c050dc4f8c676dc98775047c38e5c01b55" -"checksum wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "5d82c170ef9f5b2c63ad4460dfcee93f3ec04a9a36a4cc20bc973c39e59ab8e3" -"checksum wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f07d50f74bf7a738304f6b8157f4a581e1512cd9e9cdb5baad8c31bbe8ffd81d" -"checksum wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "95cf8fe77e45ba5f91bc8f3da0c3aa5d464b3d8ed85d84f4d4c7cc106436b1d7" -"checksum wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "d9c2d4d4756b2e46d3a5422e06277d02e4d3e1d62d138b76a4c681e925743623" -"checksum wasm-bindgen-webidl 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "24e47859b4eba3d3b9a5c2c299f9d6f8d0b613671315f6f0c5c7f835e524b36a" -"checksum web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "86d515d2f713d3a6ab198031d2181b7540f8e319e4637ec2d4a41a208335ef29" -"checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164" -"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" diff --git a/druid-shell/src/druid_gtk/application.rs b/druid-shell/src/druid_gtk/application.rs index 73be1d27a5..bec596484f 100644 --- a/druid-shell/src/druid_gtk/application.rs +++ b/druid-shell/src/druid_gtk/application.rs @@ -14,8 +14,6 @@ //! GTK implementation of features at the application scope. -use gtk; - pub struct Application; impl Application { diff --git a/druid-shell/src/druid_gtk/menu.rs b/druid-shell/src/druid_gtk/menu.rs index c98704c851..172ff83bb0 100644 --- a/druid-shell/src/druid_gtk/menu.rs +++ b/druid-shell/src/druid_gtk/menu.rs @@ -16,15 +16,21 @@ use crate::window; +use std::cell::RefCell; use std::sync::Arc; use gtk::Menu as GtkMenu; use gtk::MenuBar as GtkMenuBar; use gtk::MenuItem as GtkMenuItem; -use gtk::{GtkMenuExt, GtkMenuItemExt, MenuShellExt}; +use gtk::{GtkMenuItemExt, MenuShellExt}; + +use crate::platform::WindowHandle; use crate::keycodes::MenuKey; +use crate::druid_gtk::WinCtxImpl; +use crate::window::Text; + pub struct Menu { items: Vec, } @@ -42,19 +48,32 @@ impl MenuItem { } } - fn into_gtk_menu_item(self, handler: Arc>) -> GtkMenuItem { + fn into_gtk_menu_item( + self, + handler: Arc>>, + handle: &WindowHandle, + ) -> GtkMenuItem { match self { MenuItem::Entry(name, id) => { + let handle = handle.clone(); let item = GtkMenuItem::new_with_label(&name); item.connect_activate(move |_| { - handler.command(id); + let mut ctx = WinCtxImpl { + handle: &handle, + window: None, + text: Text::new(), + }; + + if let Ok(mut handler) = handler.try_borrow_mut() { + handler.command(id, &mut ctx); + } }); item } MenuItem::SubMenu(name, submenu) => { let item = GtkMenuItem::new_with_label(&name); - item.set_submenu(Some(&submenu.into_gtk_menu(handler))); + item.set_submenu(Some(&submenu.into_gtk_menu(handler, handle))); item } @@ -80,21 +99,29 @@ impl Menu { eprintln!("Warning: GTK separators are not yet implemented"); } - pub(crate) fn into_gtk_menubar(self, handler: Arc>) -> GtkMenuBar { + pub(crate) fn into_gtk_menubar( + self, + handler: Arc>>, + handle: &WindowHandle, + ) -> GtkMenuBar { let menu = GtkMenuBar::new(); for item in self.items { - menu.append(&item.into_gtk_menu_item(handler.clone())); + menu.append(&item.into_gtk_menu_item(handler.clone(), handle)); } menu } - fn into_gtk_menu(self, handler: Arc>) -> GtkMenu { + fn into_gtk_menu( + self, + handler: Arc>>, + handle: &WindowHandle, + ) -> GtkMenu { let menu = GtkMenu::new(); for item in self.items { - menu.append(&item.into_gtk_menu_item(handler.clone())); + menu.append(&item.into_gtk_menu_item(handler.clone(), handle)); } menu diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index f9eeadfc8f..a924555170 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -21,9 +21,10 @@ pub mod util; pub mod win_main; use std::any::Any; -use std::cell::Cell; +use std::cell::{Cell, RefCell}; use std::ffi::OsString; -use std::sync::{Arc, Mutex, Weak}; +use std::rc::Weak; +use std::sync::{Arc, Mutex}; use gdk::EventKey; use gdk::EventMask; @@ -33,12 +34,13 @@ use gtk::Inhibit; use piet_common::{Piet, RenderContext}; use crate::keyboard; +use crate::kurbo::{Point, Vec2}; use crate::platform::dialog::{FileDialogOptions, FileDialogType}; use crate::platform::menu::Menu; -use crate::window::{self, Cursor, MouseButton, WinHandler}; +use crate::window::{self, Cursor, MouseButton, Text, WinCtx, WinHandler}; use crate::Error; -use crate::keyboard::{KeyCode, KeyEvent, KeyModifiers, RawKeyCode, StrOrChar}; +use crate::keyboard::{KeyCode, RawKeyCode, StrOrChar}; use util::assert_main_thread; use win_main::with_application; @@ -72,6 +74,12 @@ impl IdleCallback for F { } } +struct WinCtxImpl<'a> { + window: Option<&'a ApplicationWindow>, + handle: &'a WindowHandle, + text: Text<'static>, +} + impl WindowBuilder { pub fn new() -> WindowBuilder { WindowBuilder { @@ -102,9 +110,9 @@ impl WindowBuilder { .handler .expect("Tried to build a window without setting the handler"); - let handler = Arc::new(handler); + let handler = Arc::new(RefCell::new(handler)); - let mut window = with_application(|app| ApplicationWindow::new(&app)); + let window = with_application(|app| ApplicationWindow::new(&app)); window.set_title(&self.title); // TODO(bobtwinkles): enable this when I figure out how to set the cursor on application windows @@ -119,8 +127,14 @@ impl WindowBuilder { let vbox = gtk::Box::new(gtk::Orientation::Vertical, 0); window.add(&vbox); + let window = window; + + let handle = WindowHandle { + window: Some(window), + }; + if let Some(menu) = self.menu { - let menu = menu.into_gtk_menubar(handler.clone()); + let menu = menu.into_gtk_menubar(handler.clone(), &handle); vbox.pack_start(&menu, false, false, 0); } @@ -134,7 +148,7 @@ impl WindowBuilder { | EventMask::KEY_PRESS_MASK | EventMask::ENTER_NOTIFY_MASK | EventMask::KEY_RELEASE_MASK - | EventMask::SCROLL_MASK + | EventMask::SCROLL_MASK, ); drawing_area.set_can_focus(true); @@ -147,36 +161,46 @@ impl WindowBuilder { }); { - let mut last_size = Cell::new((0, 0)); + let last_size = Cell::new((0, 0)); let handler = Arc::clone(&handler); + let handle = handle.clone(); + drawing_area.connect_draw(move |widget, context| { - let extents = context.clip_extents(); - let size = ( - (extents.2 - extents.0) as u32, - (extents.3 - extents.1) as u32, - ); - - if last_size.get() != size { - last_size.set(size); - handler.size(size.0, size.1); - } + if let Ok(mut handler) = handler.try_borrow_mut() { + let mut ctx = WinCtxImpl { + handle: &handle, + window: None, + text: Text::new(), + }; + + let extents = context.clip_extents(); + let size = ( + (extents.2 - extents.0) as u32, + (extents.3 - extents.1) as u32, + ); + + if last_size.get() != size { + last_size.set(size); + handler.size(size.0, size.1, &mut ctx); + } - context.set_source_rgb(0.0, 0.0, 0.0); - context.paint(); + context.set_source_rgb(0.0, 0.0, 0.0); + context.paint(); - context.set_source_rgb(1.0, 0.0, 0.0); - context.rectangle(0.0, 0.0, 100.0, 100.0); + context.set_source_rgb(1.0, 0.0, 0.0); + context.rectangle(0.0, 0.0, 100.0, 100.0); - context.fill(); + context.fill(); - // For some reason piet needs a mutable context, so give it one I guess. - let mut context = context.clone(); - let mut piet_context = Piet::new(&mut context); - let anim = handler.paint(&mut piet_context); - piet_context.finish(); + // For some reason piet needs a mutable context, so give it one I guess. + let mut context = context.clone(); + let mut piet_context = Piet::new(&mut context); + let anim = handler.paint(&mut piet_context, &mut ctx); + piet_context.finish(); - if anim { - widget.queue_draw(); + if anim { + widget.queue_draw(); + } } Inhibit(false) @@ -185,17 +209,27 @@ impl WindowBuilder { { let handler = Arc::clone(&handler); + let handle = handle.clone(); drawing_area.connect_button_press_event(move |_widget, button| { - // XXX: what units is this in - let position = button.get_position(); - handler.mouse(&window::MouseEvent { - x: position.0 as i32, - y: position.1 as i32, - count: 1, - mods: gtk_modifiers_to_druid(button.get_state()), - button: gtk_button_to_druid(button.get_button()), - //ty: window::MouseType::Down, - }); + if let Ok(mut handler) = handler.try_borrow_mut() { + let mut ctx = WinCtxImpl { + window: None, // TODO Steven + handle: &handle, + text: Text::new(), + }; + + let pos = Point::from(button.get_position()); + handler.mouse_down( + &window::MouseEvent { + pos, + count: 1, + mods: gtk_modifiers_to_druid(button.get_state()), + button: gtk_button_to_druid(button.get_button()), + //ty: window::MouseType::Down, + }, + &mut ctx, + ); + } Inhibit(true) }); @@ -203,17 +237,27 @@ impl WindowBuilder { { let handler = Arc::clone(&handler); + let handle = handle.clone(); drawing_area.connect_button_release_event(move |_widget, button| { - // XXX: what units is this in - let position = button.get_position(); - handler.mouse(&window::MouseEvent { - x: position.0 as i32, - y: position.1 as i32, - mods: gtk_modifiers_to_druid(button.get_state()), - count: 0, - button: gtk_button_to_druid(button.get_button()), - //ty: window::MouseType::Up, - }); + if let Ok(mut handler) = handler.try_borrow_mut() { + let mut ctx = WinCtxImpl { + window: None, + handle: &handle, + text: Text::new(), + }; + + let pos = Point::from(button.get_position()); + handler.mouse_up( + &window::MouseEvent { + pos, + mods: gtk_modifiers_to_druid(button.get_state()), + count: 0, + button: gtk_button_to_druid(button.get_button()), + //ty: window::MouseType::Up, + }, + &mut ctx, + ); + } Inhibit(true) }); @@ -221,17 +265,25 @@ impl WindowBuilder { { let handler = Arc::clone(&handler); + let handle = handle.clone(); drawing_area.connect_motion_notify_event(move |_widget, motion| { - let position = motion.get_position(); - let mouse_event = window::MouseEvent { - x: position.0 as i32, - y: position.1 as i32, - mods: gtk_modifiers_to_druid(motion.get_state()), - count: 0, - button: gtk_modifiers_to_mouse_button(motion.get_state()), - }; - - handler.mouse_move(&mouse_event); + if let Ok(mut handler) = handler.try_borrow_mut() { + let mut ctx = WinCtxImpl { + window: None, + handle: &handle, + text: Text::new(), + }; + + let pos = Point::from(motion.get_position()); + let mouse_event = window::MouseEvent { + pos, + mods: gtk_modifiers_to_druid(motion.get_state()), + count: 0, + button: gtk_modifiers_to_mouse_button(motion.get_state()), + }; + + handler.mouse_move(&mouse_event, &mut ctx); + } Inhibit(true) }); @@ -239,38 +291,50 @@ impl WindowBuilder { { let handler = Arc::clone(&handler); + let handle = handle.clone(); drawing_area.connect_scroll_event(move |_widget, scroll| { - use gdk::ScrollDirection; - let deltas = scroll.get_scroll_deltas(); - let modifiers = gtk_modifiers_to_druid(scroll.get_state()); - - // The magic "120"s are from Microsoft's documentation for WM_MOUSEWHEEL. - // They claim that one "tick" on a scroll wheel should be 120 units. - // GTK simply reports the direction - match scroll.get_direction() { - ScrollDirection::Up => { - handler.mouse_wheel(120, modifiers); - } - ScrollDirection::Down => { - handler.mouse_wheel(-120, modifiers); - } - ScrollDirection::Left => { - // Note: this direction is just a guess, I (bobtwinkles) don't - // have a way to test horizontal scroll events under GTK. - // If it's wrong, the right direction also needs to be changed - handler.mouse_hwheel(120, modifiers); - } - ScrollDirection::Right => { - handler.mouse_hwheel(-120, modifiers); - } - ScrollDirection::Smooth => { - eprintln!("Warning: somehow the Druid widget got a smooth scroll event"); - } - e => { - eprintln!( - "Warning: the Druid widget got some whacky scroll direction {:?}", - e - ); + if let Ok(mut handler) = handler.try_borrow_mut() { + let mut ctx = WinCtxImpl { + window: None, + handle: &handle, + text: Text::new(), + }; + + use gdk::ScrollDirection; + let deltas = scroll.get_scroll_deltas(); + // TODO use these deltas + let modifiers = gtk_modifiers_to_druid(scroll.get_state()); + + // The magic "120"s are from Microsoft's documentation for WM_MOUSEWHEEL. + // They claim that one "tick" on a scroll wheel should be 120 units. + // GTK simply reports the direction + match scroll.get_direction() { + ScrollDirection::Up => { + handler.wheel(Vec2::from((0.0, -120.0)), modifiers, &mut ctx); + } + ScrollDirection::Down => { + handler.wheel(Vec2::from((0.0, 120.0)), modifiers, &mut ctx); + } + ScrollDirection::Left => { + // Note: this direction is just a guess, I (bobtwinkles) don't + // have a way to test horizontal scroll events under GTK. + // If it's wrong, the right direction also needs to be changed + handler.wheel(Vec2::from((120.0, 0.0)), modifiers, &mut ctx); + } + ScrollDirection::Right => { + handler.wheel(-Vec2::from((-120.0, 0.0)), modifiers, &mut ctx); + } + ScrollDirection::Smooth => { + eprintln!( + "Warning: somehow the Druid widget got a smooth scroll event" + ); + } + e => { + eprintln!( + "Warning: the Druid widget got some whacky scroll direction {:?}", + e + ); + } } } @@ -280,9 +344,18 @@ impl WindowBuilder { { let handler = Arc::clone(&handler); + let handle = handle.clone(); drawing_area.connect_key_press_event(move |_widget, key| { - let key_event = gtk_event_key_to_key_event(key); - handler.key_down(key_event); + if let Ok(mut handler) = handler.try_borrow_mut() { + let mut ctx = WinCtxImpl { + window: None, + handle: &handle, + text: Text::new(), + }; + + let key_event = gtk_event_key_to_key_event(key); + handler.key_down(key_event, &mut ctx); + } Inhibit(true) }); @@ -290,9 +363,18 @@ impl WindowBuilder { { let handler = Arc::clone(&handler); + let handle = handle.clone(); drawing_area.connect_key_release_event(move |_widget, key| { - let key_event = gtk_event_key_to_key_event(key); - handler.key_up(key_event); + if let Ok(mut handler) = handler.try_borrow_mut() { + let mut ctx = WinCtxImpl { + window: None, + handle: &handle, + text: Text::new(), + }; + + let key_event = gtk_event_key_to_key_event(key); + handler.key_up(key_event, &mut ctx); + } Inhibit(true) }); @@ -300,20 +382,26 @@ impl WindowBuilder { { let handler = Arc::clone(&handler); + let handle = handle.clone(); drawing_area.connect_destroy(move |widget| { - handler.destroy(); + if let Ok(mut handler) = handler.try_borrow_mut() { + let mut ctx = WinCtxImpl { + window: None, + handle: &handle, + text: Text::new(), + }; + handler.destroy(&mut ctx); + } }); } vbox.pack_end(&drawing_area, true, true, 0); - let tr = WindowHandle { - window: Some(window), - }; - - handler.connect(&window::WindowHandle { inner: tr.clone() }); + handler.borrow_mut().connect(&window::WindowHandle { + inner: handle.clone(), + }); - Ok(tr) + Ok(handle) } } @@ -322,7 +410,7 @@ impl WindowHandle { use gtk::WidgetExt; match self.window.as_ref() { Some(window) => window.show_all(), - None => return, + None => {} } // self.window.map(|window| window.show_all()); } @@ -421,10 +509,24 @@ impl IdleHandle { } } +impl<'a> WinCtx<'a> for WinCtxImpl<'a> { + fn invalidate(&mut self) { + self.handle.invalidate(); + } + + fn text_factory(&mut self) -> &mut Text<'a> { + &mut self.text + } + + fn set_cursor(&mut self, cursor: &Cursor) { + // TODO Steven implement cursor + eprintln!("WinCtx::set_cursor called but not implemented"); + } +} + /// Map a GTK mouse button to a Druid one #[inline] fn gtk_button_to_druid(button: u32) -> window::MouseButton { - use window::MouseButton; match button { 1 => MouseButton::Left, 2 => MouseButton::Middle, @@ -437,7 +539,6 @@ fn gtk_button_to_druid(button: u32) -> window::MouseButton { /// Map the GTK modifiers into Druid bits #[inline] fn gtk_modifiers_to_druid(modifiers: gdk::ModifierType) -> keyboard::KeyModifiers { - use crate::keycodes; use gdk::ModifierType; keyboard::KeyModifiers { @@ -465,7 +566,6 @@ fn gtk_modifiers_to_mouse_button(modifiers: gdk::ModifierType) -> window::MouseB fn gtk_event_key_to_key_event(key: &EventKey) -> keyboard::KeyEvent { let keyval = key.get_keyval(); - let keycode = KeyCode::from(keyval); // TODO how can we get the different versions from GDK? let text: StrOrChar = gdk::keyval_to_unicode(keyval).into(); @@ -481,8 +581,8 @@ fn gtk_event_key_to_key_event(key: &EventKey) -> keyboard::KeyEvent { } impl From for KeyCode { + #[allow(non_upper_case_globals)] fn from(raw: u32) -> KeyCode { - use gdk::enums::key; use gdk::enums::key::*; match raw { a | A => KeyCode::KeyA, diff --git a/druid-shell/src/druid_gtk/win_main.rs b/druid-shell/src/druid_gtk/win_main.rs index 5f035ac13e..7853d7854b 100644 --- a/druid-shell/src/druid_gtk/win_main.rs +++ b/druid-shell/src/druid_gtk/win_main.rs @@ -16,12 +16,12 @@ use crate::util::assert_main_thread; use gio::ApplicationFlags; -use gtk::{Application, ApplicationWindow}; +use gtk::Application; use std::cell::RefCell; -/// XXX: The application needs to be global because WindowBuilder::build wants -/// to construct an ApplicationWindow, which needs the application, but -/// WindowBuilder::build does not get the RunLoop +// XXX: The application needs to be global because WindowBuilder::build wants +// to construct an ApplicationWindow, which needs the application, but +// WindowBuilder::build does not get the RunLoop thread_local!( static GTK_APPLICATION: RefCell> = RefCell::new(None); ); @@ -33,20 +33,23 @@ impl RunLoop { pub fn new() -> RunLoop { use gio::ApplicationExt; use gio::Cancellable; - use gtk::GtkApplicationExt; assert_main_thread(); // TODO: we should give control over the application ID to the user - let application = - Application::new(Some("com.github.xi-editor.druid"), ApplicationFlags::FLAGS_NONE) - .expect("Unable to create GTK application"); + let application = Application::new( + Some("com.github.xi-editor.druid"), + ApplicationFlags::FLAGS_NONE, + ) + .expect("Unable to create GTK application"); application.connect_activate(|app| { eprintln!("Activated application"); }); - application.register(None as Option<&Cancellable>); + application + .register(None as Option<&Cancellable>) + .expect("Could not register GTK application"); application.activate(); GTK_APPLICATION.with(move |x| *x.borrow_mut() = Some(application)); From 671d138922f252aa962cb52262b4fb583b3adadc Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Sun, 4 Aug 2019 15:37:14 +0200 Subject: [PATCH 18/78] GTK: use gdk keymap for resolving keyval to KeyCode --- Cargo.lock | 2 + druid-shell/Cargo.toml | 2 + druid-shell/src/druid_gtk/mod.rs | 63 ++++++++++++++++++++++++++++---- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f96feab9d8..0392b21f0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -217,8 +217,10 @@ dependencies = [ "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/druid-shell/Cargo.toml b/druid-shell/Cargo.toml index 27c347f048..5e90b937a5 100644 --- a/druid-shell/Cargo.toml +++ b/druid-shell/Cargo.toml @@ -36,8 +36,10 @@ cairo-rs = { version = "0.7.1", default_features = false } cairo-rs = { version = "0.7.1", default_features = false } gio = "0.7.0" gdk = "0.11.0" +gdk-sys = "0.9.0" gtk = "0.7.0" glib = "0.8.1" +glib-sys = "0.9.0" [dev-dependencies] kurbo = "0.2.1" diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index a924555170..1b03680ddd 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -520,7 +520,6 @@ impl<'a> WinCtx<'a> for WinCtxImpl<'a> { fn set_cursor(&mut self, cursor: &Cursor) { // TODO Steven implement cursor - eprintln!("WinCtx::set_cursor called but not implemented"); } } @@ -564,15 +563,64 @@ fn gtk_modifiers_to_mouse_button(modifiers: gdk::ModifierType) -> window::MouseB } } +/// Map a hardware keycode to a keyval by looking up the keycode in the keymap +fn hardware_keycode_to_keyval(keycode: u16) -> Option { + unsafe { + let keymap = gdk_sys::gdk_keymap_get_default(); + + // TODO Steven use std::os::c_int etc instead of u32 + + let keys_ptr: *mut *mut gdk_sys::GdkKeymapKey = std::ptr::null_mut(); + + // create a pointer for the number of keys returned + let nkeys: Box = Box::new(0); + let nkeys_ptr: *mut i32 = Box::into_raw(nkeys); + + // create a pointer to hold the actual returned keyvals + let keyvals = Box::new([0u32; 1]); + let keyvals_ptr: *mut *mut u32 = Box::into_raw(keyvals) as *mut *mut u32; + + // call into gdk to retrieve the keyvals + let result = gdk_sys::gdk_keymap_get_entries_for_keycode( + keymap, + keycode as u32, + keys_ptr, + keyvals_ptr, + nkeys_ptr, + ); + + // get the values back out from the pointer + let nkeys: Box = Box::from_raw(nkeys_ptr); + let keyvals = std::slice::from_raw_parts(*keyvals_ptr, *nkeys as usize); + + let return_value = if *nkeys > 0 { + // assume the first returned keyval is the correct key + Some(keyvals[0].clone()) + } else { + None + }; + + // notify glib to free the allocated arrays + glib_sys::g_free(*keyvals_ptr as *mut std::ffi::c_void); + + return_value + } +} + fn gtk_event_key_to_key_event(key: &EventKey) -> keyboard::KeyEvent { + // the logical key being pressed let keyval = key.get_keyval(); + let hardware_keycode = key.get_hardware_keycode(); + let keycode = hardware_keycode_to_keyval(hardware_keycode).unwrap_or(keyval); + // TODO how can we get the different versions from GDK? let text: StrOrChar = gdk::keyval_to_unicode(keyval).into(); + // TODO properly handle modifiers let unmodified_text: StrOrChar = gdk::keyval_to_unicode(keyval).into(); keyboard::KeyEvent::new( - keyval, + keycode, false, // TODO Steven implement is_repeat gtk_modifiers_to_druid(key.get_state()), text, @@ -673,12 +721,11 @@ impl From for KeyCode { F2 => KeyCode::F2, Page_Down => KeyCode::PageDown, F1 => KeyCode::F1, - leftarrow => KeyCode::ArrowLeft, - rightarrow => KeyCode::ArrowRight, - downarrow => KeyCode::ArrowDown, - uparrow => KeyCode::ArrowUp, - - other => { + Left => KeyCode::ArrowLeft, + Right => KeyCode::ArrowRight, + Down=> KeyCode::ArrowDown, + Up => KeyCode::ArrowUp, + _ => { eprintln!("Warning: unknown keyval {}", raw); KeyCode::Unknown(RawKeyCode::Linux(raw)) } From 483f255bfec7ff1b9e4ed39c986b26309449e4e0 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 6 Aug 2019 10:23:52 +0200 Subject: [PATCH 19/78] GTK: cleanup some clippy warnings --- druid-shell/src/druid_gtk/mod.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 1b03680ddd..fa5f9693f7 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -196,7 +196,9 @@ impl WindowBuilder { let mut context = context.clone(); let mut piet_context = Piet::new(&mut context); let anim = handler.paint(&mut piet_context, &mut ctx); - piet_context.finish(); + if let Err(e) = piet_context.finish() { + eprintln!("piet error on render: {:?}", e); + } if anim { widget.queue_draw(); @@ -408,11 +410,9 @@ impl WindowBuilder { impl WindowHandle { pub fn show(&self) { use gtk::WidgetExt; - match self.window.as_ref() { - Some(window) => window.show_all(), - None => {} + if let Some(window) = self.window.as_ref() { + window.show_all(); } - // self.window.map(|window| window.show_all()); } /// Close the window. @@ -431,9 +431,8 @@ impl WindowHandle { // Request invalidation of the entire window contents. pub fn invalidate(&self) { use gtk::WidgetExt; - match self.window.as_ref() { - Some(window) => window.queue_draw(), - None => {} + if let Some(window) = self.window.as_ref() { + window.queue_draw(); } } From e970406ed3c05f94237d81ddf13030012fa00ce2 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 6 Aug 2019 10:24:15 +0200 Subject: [PATCH 20/78] GTK: support KeyCode::Quote --- druid-shell/src/druid_gtk/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index fa5f9693f7..69b609d060 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -722,8 +722,9 @@ impl From for KeyCode { F1 => KeyCode::F1, Left => KeyCode::ArrowLeft, Right => KeyCode::ArrowRight, - Down=> KeyCode::ArrowDown, + Down => KeyCode::ArrowDown, Up => KeyCode::ArrowUp, + quoteright => KeyCode::Quote, _ => { eprintln!("Warning: unknown keyval {}", raw); KeyCode::Unknown(RawKeyCode::Linux(raw)) From 555b87c4386a86bbb3c09738483c0a6c3112cd55 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 6 Aug 2019 10:29:17 +0200 Subject: [PATCH 21/78] GTK: Cleanup hardware_keycode_to_keyval pointer handling --- druid-shell/src/druid_gtk/mod.rs | 59 ++++++++++++++++---------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 69b609d060..56d979019a 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -564,45 +564,46 @@ fn gtk_modifiers_to_mouse_button(modifiers: gdk::ModifierType) -> window::MouseB /// Map a hardware keycode to a keyval by looking up the keycode in the keymap fn hardware_keycode_to_keyval(keycode: u16) -> Option { + use std::ffi::c_void; + use std::os::raw::{c_int, c_uint}; + use std::ptr; + use std::slice; unsafe { let keymap = gdk_sys::gdk_keymap_get_default(); - // TODO Steven use std::os::c_int etc instead of u32 + let mut nkeys = 0; + let mut keys: *mut gdk_sys::GdkKeymapKey = ptr::null_mut(); + let mut keyvals: *mut c_uint = ptr::null_mut(); - let keys_ptr: *mut *mut gdk_sys::GdkKeymapKey = std::ptr::null_mut(); - - // create a pointer for the number of keys returned - let nkeys: Box = Box::new(0); - let nkeys_ptr: *mut i32 = Box::into_raw(nkeys); - - // create a pointer to hold the actual returned keyvals - let keyvals = Box::new([0u32; 1]); - let keyvals_ptr: *mut *mut u32 = Box::into_raw(keyvals) as *mut *mut u32; - - // call into gdk to retrieve the keyvals - let result = gdk_sys::gdk_keymap_get_entries_for_keycode( + // call into gdk to retrieve the keyvals and keymap keys + gdk_sys::gdk_keymap_get_entries_for_keycode( keymap, - keycode as u32, - keys_ptr, - keyvals_ptr, - nkeys_ptr, + c_uint::from(keycode), + &mut keys as *mut *mut gdk_sys::GdkKeymapKey, + &mut keyvals as *mut *mut c_uint, + &mut nkeys as *mut c_int, ); - // get the values back out from the pointer - let nkeys: Box = Box::from_raw(nkeys_ptr); - let keyvals = std::slice::from_raw_parts(*keyvals_ptr, *nkeys as usize); + if nkeys > 0 { + let keyvals_slice = slice::from_raw_parts(keyvals, nkeys as usize); + let keys_slice = slice::from_raw_parts(keys, nkeys as usize); - let return_value = if *nkeys > 0 { - // assume the first returned keyval is the correct key - Some(keyvals[0].clone()) - } else { - None - }; + let resolved_keyval = keys_slice.iter().enumerate().find_map(|(i, key)| { + if key.group == 0 && key.level == 0 { + Some(keyvals_slice[i]) + } else { + None + } + }); - // notify glib to free the allocated arrays - glib_sys::g_free(*keyvals_ptr as *mut std::ffi::c_void); + // notify glib to free the allocated arrays + glib_sys::g_free(keyvals as *mut c_void); + glib_sys::g_free(keys as *mut c_void); - return_value + resolved_keyval + } else { + None + } } } From 8fef992c79d0d3e0748a979e66477600ab583e49 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 6 Aug 2019 12:05:43 +0200 Subject: [PATCH 22/78] GTK: more match improvements in WindowHandle --- druid-shell/src/druid_gtk/mod.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 56d979019a..1d94e641f5 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -418,13 +418,10 @@ impl WindowHandle { /// Close the window. pub fn close(&self) { use gtk::GtkApplicationExt; - match self.window.as_ref() { - Some(window) => { - with_application(|app| { - app.remove_window(window); - }); - } - None => return, + if let Some(window) = self.window.as_ref() { + with_application(|app| { + app.remove_window(window); + }); } } From 49429ebb98071bab2f13bdecd3b8200f8cd4245e Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 6 Aug 2019 13:38:58 +0200 Subject: [PATCH 23/78] GTK: Implement file_dialog for Open and Save --- druid-shell/examples/hello.rs | 7 +++ druid-shell/src/druid_gtk/dialog.rs | 83 +++++++++++++++++++++++++++-- druid-shell/src/druid_gtk/mod.rs | 7 ++- 3 files changed, 93 insertions(+), 4 deletions(-) diff --git a/druid-shell/examples/hello.rs b/druid-shell/examples/hello.rs index 854d6350ad..f2eb0f4a6d 100644 --- a/druid-shell/examples/hello.rs +++ b/druid-shell/examples/hello.rs @@ -56,6 +56,12 @@ impl WinHandler for HelloState { let filename = self.handle.file_dialog(FileDialogType::Open, options); println!("result: {:?}", filename); } + 0x102 => { + let mut options = FileDialogOptions::default(); + options.set_show_hidden(); + let filename = self.handle.file_dialog(FileDialogType::Save, options); + println!("result: {:?}", filename); + } _ => println!("unexpected id {}", id), } } @@ -111,6 +117,7 @@ fn main() { let mut file_menu = Menu::new(); file_menu.add_item(0x100, "E&xit", MenuKey::std_quit()); file_menu.add_item(0x101, "O&pen", MenuKey::command('o')); + file_menu.add_item(0x102, "S&ave", MenuKey::command('s')); let mut menubar = Menu::new(); menubar.add_dropdown(file_menu, "&File"); diff --git a/druid-shell/src/druid_gtk/dialog.rs b/druid-shell/src/druid_gtk/dialog.rs index 0ba3db4d47..884b52a789 100644 --- a/druid-shell/src/druid_gtk/dialog.rs +++ b/druid-shell/src/druid_gtk/dialog.rs @@ -14,6 +14,15 @@ //! File open/save dialogs, GTK implementation. +use std::ffi::OsString; + +use gtk::{ + ApplicationWindow, DialogExt, FileChooserAction, FileChooserDialog, FileChooserExt, + ResponseType, WidgetExt, Window, +}; + +use crate::Error; + /// Type of file dialog. pub enum FileDialogType { /// File open dialog. @@ -24,11 +33,79 @@ pub enum FileDialogType { /// Options for file dialog. #[derive(Default)] -pub struct FileDialogOptions; +pub struct FileDialogOptions { + show_hidden: bool, +} impl FileDialogOptions { pub fn set_show_hidden(&mut self) { - // TODO - unimplemented!("Showing file dialogs on GTK platforms") + self.show_hidden = true } } + +pub(crate) fn get_file_dialog_path( + window: &Window, + ty: FileDialogType, + options: FileDialogOptions, +) -> Result { + let dialog = match ty { + FileDialogType::Open => build_open_dialog(window, options), + FileDialogType::Save => build_save_dialog(window, options), + }; + + let result = dialog.run(); + + let result = match result { + ResponseType::Accept => match dialog.get_filename() { + Some(path) => Ok(path.into_os_string()), + None => Err(Error::Null), + }, + ResponseType::DeleteEvent => { + // dialog was closed + Err(Error::Null) + } + _ => { + eprintln!("Unhandled dialog result: {:?}", result); + Err(Error::Null) + } + }; + + // TODO properly handle errors into the Error type + + dialog.destroy(); + + result +} + +// TODO DRY this up +fn build_open_dialog(window: &Window, options: FileDialogOptions) -> FileChooserDialog { + let dialog = gtk::FileChooserDialogBuilder::new() + .transient_for(window) + .title("Open File") + .build(); + + dialog.set_action(FileChooserAction::Open); + + dialog.add_button("Open", ResponseType::Accept); + dialog.add_button("Cancel", ResponseType::Cancel); + + dialog.set_show_hidden(options.show_hidden); + + dialog +} + +fn build_save_dialog(window: &Window, options: FileDialogOptions) -> FileChooserDialog { + let dialog = gtk::FileChooserDialogBuilder::new() + .transient_for(window) + .title("Save File") + .build(); + + dialog.set_action(FileChooserAction::Save); + + dialog.add_button("Save", ResponseType::Accept); + dialog.add_button("Cancel", ResponseType::Cancel); + + dialog.set_show_hidden(options.show_hidden); + + dialog +} diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index 1d94e641f5..d41a12216e 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -478,7 +478,12 @@ impl WindowHandle { ty: FileDialogType, options: FileDialogOptions, ) -> Result { - unimplemented!() + use gtk::Cast; + if let Some(window) = &self.window { + dialog::get_file_dialog_path(window.upcast_ref(), ty, options) + } else { + Err(Error::Null) // TODO proper error + } } } From 9050951569582573156ba24ca8c1e470edf94eba Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 6 Aug 2019 14:55:18 +0200 Subject: [PATCH 24/78] WIP remove window for WinCtxImpl --- druid-shell/src/druid_gtk/dialog.rs | 2 +- druid-shell/src/druid_gtk/menu.rs | 1 - druid-shell/src/druid_gtk/mod.rs | 9 --------- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/druid-shell/src/druid_gtk/dialog.rs b/druid-shell/src/druid_gtk/dialog.rs index 884b52a789..014c463e99 100644 --- a/druid-shell/src/druid_gtk/dialog.rs +++ b/druid-shell/src/druid_gtk/dialog.rs @@ -17,7 +17,7 @@ use std::ffi::OsString; use gtk::{ - ApplicationWindow, DialogExt, FileChooserAction, FileChooserDialog, FileChooserExt, + DialogExt, FileChooserAction, FileChooserDialog, FileChooserExt, ResponseType, WidgetExt, Window, }; diff --git a/druid-shell/src/druid_gtk/menu.rs b/druid-shell/src/druid_gtk/menu.rs index 172ff83bb0..b5b9e3af43 100644 --- a/druid-shell/src/druid_gtk/menu.rs +++ b/druid-shell/src/druid_gtk/menu.rs @@ -60,7 +60,6 @@ impl MenuItem { item.connect_activate(move |_| { let mut ctx = WinCtxImpl { handle: &handle, - window: None, text: Text::new(), }; diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index d41a12216e..a70faa4610 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -75,7 +75,6 @@ impl IdleCallback for F { } struct WinCtxImpl<'a> { - window: Option<&'a ApplicationWindow>, handle: &'a WindowHandle, text: Text<'static>, } @@ -169,7 +168,6 @@ impl WindowBuilder { if let Ok(mut handler) = handler.try_borrow_mut() { let mut ctx = WinCtxImpl { handle: &handle, - window: None, text: Text::new(), }; @@ -215,7 +213,6 @@ impl WindowBuilder { drawing_area.connect_button_press_event(move |_widget, button| { if let Ok(mut handler) = handler.try_borrow_mut() { let mut ctx = WinCtxImpl { - window: None, // TODO Steven handle: &handle, text: Text::new(), }; @@ -243,7 +240,6 @@ impl WindowBuilder { drawing_area.connect_button_release_event(move |_widget, button| { if let Ok(mut handler) = handler.try_borrow_mut() { let mut ctx = WinCtxImpl { - window: None, handle: &handle, text: Text::new(), }; @@ -271,7 +267,6 @@ impl WindowBuilder { drawing_area.connect_motion_notify_event(move |_widget, motion| { if let Ok(mut handler) = handler.try_borrow_mut() { let mut ctx = WinCtxImpl { - window: None, handle: &handle, text: Text::new(), }; @@ -297,7 +292,6 @@ impl WindowBuilder { drawing_area.connect_scroll_event(move |_widget, scroll| { if let Ok(mut handler) = handler.try_borrow_mut() { let mut ctx = WinCtxImpl { - window: None, handle: &handle, text: Text::new(), }; @@ -350,7 +344,6 @@ impl WindowBuilder { drawing_area.connect_key_press_event(move |_widget, key| { if let Ok(mut handler) = handler.try_borrow_mut() { let mut ctx = WinCtxImpl { - window: None, handle: &handle, text: Text::new(), }; @@ -369,7 +362,6 @@ impl WindowBuilder { drawing_area.connect_key_release_event(move |_widget, key| { if let Ok(mut handler) = handler.try_borrow_mut() { let mut ctx = WinCtxImpl { - window: None, handle: &handle, text: Text::new(), }; @@ -388,7 +380,6 @@ impl WindowBuilder { drawing_area.connect_destroy(move |widget| { if let Ok(mut handler) = handler.try_borrow_mut() { let mut ctx = WinCtxImpl { - window: None, handle: &handle, text: Text::new(), }; From 64a984a3629e771e03493dd52a9aaecc97ca7397 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 6 Aug 2019 16:53:56 +0200 Subject: [PATCH 25/78] GTK: Handle crash when sending request_quit() to runLoop when no window is active --- druid-shell/src/druid_gtk/dialog.rs | 4 ++-- druid-shell/src/druid_gtk/win_main.rs | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/druid-shell/src/druid_gtk/dialog.rs b/druid-shell/src/druid_gtk/dialog.rs index 014c463e99..2cd54a6031 100644 --- a/druid-shell/src/druid_gtk/dialog.rs +++ b/druid-shell/src/druid_gtk/dialog.rs @@ -17,8 +17,8 @@ use std::ffi::OsString; use gtk::{ - DialogExt, FileChooserAction, FileChooserDialog, FileChooserExt, - ResponseType, WidgetExt, Window, + DialogExt, FileChooserAction, FileChooserDialog, FileChooserExt, ResponseType, WidgetExt, + Window, }; use crate::Error; diff --git a/druid-shell/src/druid_gtk/win_main.rs b/druid-shell/src/druid_gtk/win_main.rs index 7853d7854b..7e7c2e07af 100644 --- a/druid-shell/src/druid_gtk/win_main.rs +++ b/druid-shell/src/druid_gtk/win_main.rs @@ -17,6 +17,7 @@ use crate::util::assert_main_thread; use gio::ApplicationFlags; use gtk::Application; +use gtk::GtkApplicationExt; use std::cell::RefCell; // XXX: The application needs to be global because WindowBuilder::build wants @@ -74,7 +75,17 @@ impl RunLoop { /// Request to quit the application, exiting the runloop. pub fn request_quit() { assert_main_thread(); - gtk::main_quit(); + with_application(|app| { + match app.get_active_window() { + None => { + // no application is running, main is not running + } + Some(_) => { + // we still have an active window, close the runLo + gtk::main_quit(); + } + } + }); } #[inline] From 6f9817fcd6f119427555f6902ea3c232bffb0825 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 6 Aug 2019 17:10:32 +0200 Subject: [PATCH 26/78] GTK: Remove manual application.activate() --- druid-shell/src/druid_gtk/win_main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/druid-shell/src/druid_gtk/win_main.rs b/druid-shell/src/druid_gtk/win_main.rs index 7e7c2e07af..8669c81203 100644 --- a/druid-shell/src/druid_gtk/win_main.rs +++ b/druid-shell/src/druid_gtk/win_main.rs @@ -51,7 +51,6 @@ impl RunLoop { application .register(None as Option<&Cancellable>) .expect("Could not register GTK application"); - application.activate(); GTK_APPLICATION.with(move |x| *x.borrow_mut() = Some(application)); From 65f992af51c7a919a3e8a7cd8c1f93030d830063 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 6 Aug 2019 19:51:44 +0200 Subject: [PATCH 27/78] GTK: Add accelerator keys to menu --- druid-shell/src/druid_gtk/menu.rs | 90 +++++++++++++++++++++++++++---- druid-shell/src/druid_gtk/mod.rs | 7 ++- 2 files changed, 85 insertions(+), 12 deletions(-) diff --git a/druid-shell/src/druid_gtk/menu.rs b/druid-shell/src/druid_gtk/menu.rs index b5b9e3af43..1e620b14db 100644 --- a/druid-shell/src/druid_gtk/menu.rs +++ b/druid-shell/src/druid_gtk/menu.rs @@ -19,24 +19,29 @@ use crate::window; use std::cell::RefCell; use std::sync::Arc; +use gtk::GtkMenuExt; use gtk::Menu as GtkMenu; use gtk::MenuBar as GtkMenuBar; use gtk::MenuItem as GtkMenuItem; -use gtk::{GtkMenuItemExt, MenuShellExt}; +use gtk::{AccelGroup, AccelGroupExt}; +use gtk::{GtkMenuItemExt, MenuShellExt, WidgetExt}; use crate::platform::WindowHandle; -use crate::keycodes::MenuKey; +use crate::keycodes::{KeySpec, MenuKey}; +use crate::keycodes::{Modifiers, M_ALT, M_CTRL, M_META, M_SHIFT}; use crate::druid_gtk::WinCtxImpl; use crate::window::Text; +use std::borrow::Borrow; + pub struct Menu { items: Vec, } enum MenuItem { - Entry(String, u32), + Entry(String, u32, MenuKey), SubMenu(String, Menu), } @@ -44,7 +49,7 @@ impl MenuItem { /// Get the name of this menu item fn name(&self) -> &str { match self { - MenuItem::Entry(name, _) | MenuItem::SubMenu(name, _) => name, + MenuItem::Entry(name, _, _) | MenuItem::SubMenu(name, _) => name, } } @@ -52,11 +57,15 @@ impl MenuItem { self, handler: Arc>>, handle: &WindowHandle, + accel_group: &AccelGroup, ) -> GtkMenuItem { match self { - MenuItem::Entry(name, id) => { - let handle = handle.clone(); + MenuItem::Entry(name, id, key) => { let item = GtkMenuItem::new_with_label(&name); + + register_accelerator(&item, accel_group, key); + + let handle = handle.clone(); item.connect_activate(move |_| { let mut ctx = WinCtxImpl { handle: &handle, @@ -72,7 +81,7 @@ impl MenuItem { } MenuItem::SubMenu(name, submenu) => { let item = GtkMenuItem::new_with_label(&name); - item.set_submenu(Some(&submenu.into_gtk_menu(handler, handle))); + item.set_submenu(Some(&submenu.into_gtk_menu(handler, handle, accel_group))); item } @@ -86,12 +95,13 @@ impl Menu { } pub fn add_dropdown(&mut self, menu: Menu, text: &str) { - self.items.push(MenuItem::SubMenu(text.into(), menu)); + self.items.push(MenuItem::SubMenu(strip_access_key(text), menu)); } pub fn add_item(&mut self, id: u32, text: &str, key: impl Into) { // TODO: handle accelerator shortcuts by parsing `text` - self.items.push(MenuItem::Entry(text.into(), id)); + self.items + .push(MenuItem::Entry(strip_access_key(text), id, key.into())); } pub fn add_separator(&mut self) { @@ -102,11 +112,12 @@ impl Menu { self, handler: Arc>>, handle: &WindowHandle, + accel_group: &AccelGroup, ) -> GtkMenuBar { let menu = GtkMenuBar::new(); for item in self.items { - menu.append(&item.into_gtk_menu_item(handler.clone(), handle)); + menu.append(&item.into_gtk_menu_item(handler.clone(), handle, accel_group)); } menu @@ -116,13 +127,70 @@ impl Menu { self, handler: Arc>>, handle: &WindowHandle, + accel_group: &AccelGroup, ) -> GtkMenu { let menu = GtkMenu::new(); + menu.set_accel_group(Some(accel_group)); for item in self.items { - menu.append(&item.into_gtk_menu_item(handler.clone(), handle)); + menu.append(&item.into_gtk_menu_item(handler.clone(), handle, accel_group)); } menu } } + +fn register_accelerator(item: &GtkMenuItem, accel_group: &AccelGroup, menu_key: MenuKey) { + if let KeySpec::Char(c) = menu_key.key { + item.add_accelerator( + "activate", + accel_group, + gdk::unicode_to_keyval(c as u32), + modifiers_to_gdk_modifier_type(menu_key.modifiers), + gtk::AccelFlags::VISIBLE, + ); + } +} + +fn modifiers_to_gdk_modifier_type(modifiers: Modifiers) -> gdk::ModifierType { + let mut result = gdk::ModifierType::empty(); + + if modifiers & M_ALT == M_ALT { + result.insert(gdk::ModifierType::MOD1_MASK); + } + + if modifiers & M_CTRL == M_CTRL { + result.insert(gdk::ModifierType::CONTROL_MASK); + } + + if modifiers & M_SHIFT == M_SHIFT { + result.insert(gdk::ModifierType::SHIFT_MASK); + } + + if modifiers & M_META == M_META { + result.insert(gdk::ModifierType::META_MASK); + } + + result +} + +/// Strip the access keys from the menu strong. +/// +/// Changes "E&xit" to "Exit". Actual ampersands are escaped as "&&". +fn strip_access_key(raw_menu_text: &str) -> String { + // TODO this is copied from mac/menu.rs maybe this should be moved somewhere common? + let mut saw_ampersand = false; + let mut result = String::new(); + for c in raw_menu_text.chars() { + if c == '&' { + if saw_ampersand { + result.push(c); + } + saw_ampersand = !saw_ampersand; + } else { + result.push(c); + saw_ampersand = false; + } + } + result +} diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/druid_gtk/mod.rs index a70faa4610..1fe3063431 100644 --- a/druid-shell/src/druid_gtk/mod.rs +++ b/druid-shell/src/druid_gtk/mod.rs @@ -28,7 +28,9 @@ use std::sync::{Arc, Mutex}; use gdk::EventKey; use gdk::EventMask; +use gtk::AccelGroup; use gtk::ApplicationWindow; +use gtk::ApplicationWindowExt; use gtk::Inhibit; use piet_common::{Piet, RenderContext}; @@ -113,6 +115,9 @@ impl WindowBuilder { let window = with_application(|app| ApplicationWindow::new(&app)); + let accel_group = AccelGroup::new(); + window.add_accel_group(&accel_group); + window.set_title(&self.title); // TODO(bobtwinkles): enable this when I figure out how to set the cursor on application windows // window.set_cursor(gdk::Cursor::new_from_nane( @@ -133,7 +138,7 @@ impl WindowBuilder { }; if let Some(menu) = self.menu { - let menu = menu.into_gtk_menubar(handler.clone(), &handle); + let menu = menu.into_gtk_menubar(handler.clone(), &handle, &accel_group); vbox.pack_start(&menu, false, false, 0); } From bb278e8936eaabbe79cedd809fc1ff26a9cf4610 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 6 Aug 2019 22:45:08 +0200 Subject: [PATCH 28/78] GTK: Rename 'druid_gtk' platform to 'gtk' --- Cargo.lock | 1134 ----------------- .../src/{druid_gtk => gtk}/application.rs | 0 druid-shell/src/{druid_gtk => gtk}/dialog.rs | 2 +- druid-shell/src/{druid_gtk => gtk}/menu.rs | 14 +- druid-shell/src/{druid_gtk => gtk}/mod.rs | 0 druid-shell/src/{druid_gtk => gtk}/util.rs | 0 .../src/{druid_gtk => gtk}/win_main.rs | 4 +- druid-shell/src/lib.rs | 6 +- 8 files changed, 13 insertions(+), 1147 deletions(-) delete mode 100644 Cargo.lock rename druid-shell/src/{druid_gtk => gtk}/application.rs (100%) rename druid-shell/src/{druid_gtk => gtk}/dialog.rs (99%) rename druid-shell/src/{druid_gtk => gtk}/menu.rs (95%) rename druid-shell/src/{druid_gtk => gtk}/mod.rs (100%) rename druid-shell/src/{druid_gtk => gtk}/util.rs (100%) rename druid-shell/src/{druid_gtk => gtk}/win_main.rs (98%) diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 0392b21f0b..0000000000 --- a/Cargo.lock +++ /dev/null @@ -1,1134 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "aho-corasick" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "arrayvec" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "atk" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "atk-sys" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "atty" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "autocfg" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "backtrace" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace-sys" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bitflags" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "boolinator" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bumpalo" -version = "2.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cairo-rs" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cairo-sys-rs" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cc" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cfg-if" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cocoa" -version = "0.18.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", - "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "core-foundation" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "core-foundation-sys" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "core-graphics" -version = "0.17.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "direct2d" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "direct3d11" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "directwrite" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "druid" -version = "0.3.0" -dependencies = [ - "druid-shell 0.3.0", -] - -[[package]] -name = "druid-shell" -version = "0.3.0" -dependencies = [ - "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", - "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-common 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "dxgi" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "either" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "env_logger" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure_derive" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fragile" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "gdk" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gdk-pixbuf" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gdk-pixbuf-sys" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gdk-sys" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gio" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gio-sys" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "glib" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "glib-sys" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gobject-sys" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gtk" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "gtk-sys" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "humantime" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "js-sys" -version = "0.3.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "kurbo" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lazy_static" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.58" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "log" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memchr" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "nodrop" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "nom" -version = "4.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-bigint" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-complex" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-integer" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-iter" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-rational" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "numtoa" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "objc" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pango" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pango-sys" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-cairo" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-common" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-cairo 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-direct2d 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "piet-web 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-direct2d" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "piet-web" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "piet 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pkg-config" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quick-error" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "quote" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "redox_syscall" -version = "0.1.54" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "redox_termios" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-syntax" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "sourcefile" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "syn" -version = "0.15.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "synstructure" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "termcolor" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "termion" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "time" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ucd-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-segmentation" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "utf8-ranges" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wasm-bindgen" -version = "0.2.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.45" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wasm-bindgen-webidl" -version = "0.2.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "web-sys" -version = "0.3.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-webidl 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "weedle" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-util" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wincolor" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wio" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" -"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" -"checksum atk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "86b7499272acf036bb5820c6e346bbfb5acc5dceb104bc2c4fd7e6e33dfcde6a" -"checksum atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067531f752c01027f004032bb676e715aba74b75e904a7340a61ce3fb0b61b0" -"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" -"checksum backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)" = "ada4c783bb7e7443c14e0480f429ae2cc99da95065aeab7ee1b81ada0419404f" -"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" -"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" -"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" -"checksum boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" -"checksum bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "84dca3afd8e01b9526818b7963e5b4916063b3cdf9f10cf6b73ef0bd0ec37aa5" -"checksum cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e05db47de3b0f09a222fa4bba2eab957d920d4243962a86b2d77ab401e4a359c" -"checksum cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90a1ec04603a78c111886a385edcec396dbfbc57ea26b9e74aeea6a1fe55dcca" -"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" -"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" -"checksum cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf79daa4e11e5def06e55306aa3601b87de6b5149671529318da048f67cdd77b" -"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" -"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" -"checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" -"checksum direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7fa6ff10857eb253d1ae16987ebfd27372f4129b0c7a3fa41466fbdf7e453e75" -"checksum direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "315aa929e68ba066cb6fb86f1b22af24f517e02fd9b5734c4d07e42cb9f4aefa" -"checksum directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8cdcd739e9351c411b8caf5cab32a27c818cfe06260595da121382ecdd22083d" -"checksum dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1639bbfd6765e92a40267d217a7acbac5b49320b68013f39a8e4376aa8c1e091" -"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" -"checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a" -"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" -"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" -"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -"checksum fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f8140122fa0d5dcb9fc8627cfce2b37cc1500f752636d46ea28bc26785c2f9" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6243e995f41f3a61a31847e54cc719edce93dd9140c89dca3b9919be1cfe22d5" -"checksum gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9726408ee1bbada83094326a99b9c68fea275f9dbb515de242a69e72051f4fcc" -"checksum gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1d6778abf5764b9080a9345a16c5d16289426a3b3edd808a29a9061d431c465" -"checksum gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ebe06357212127f50575b535bdb04638f5d375bb41062287abc6c94e5b8067b" -"checksum gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6261b5d34c30c2d59f879e643704cf54cb44731f3a2038000b68790c03e360e3" -"checksum gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "778b856a70a32e2cc5dd5cc7fa1b0c4b6df924fdf5c82984bc28f30565657cfe" -"checksum glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91a70db179515473b57aaff8b879167f1f8460bc5523e97beacf6d1026a8b99d" -"checksum glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b86a9169fbc9cf9a0ef315039c2304b09d5c575c5fde7defba3576a0311b863" -"checksum gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61d55bc9202447ca776f6ad0048c36e3312010f66f82ab478e97513e93f3604b" -"checksum gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "709f1074259d4685b96133f92b75c7f35b504715b0fcdc96ec95de2607296a60" -"checksum gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bbd9395497ae1d1915d1d6e522d51ae8745bf613906c34ac191c411250fc4025" -"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" -"checksum js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "9987e7c13a91d9cf0efe59cca48a3a7a70e2b11695d5a4640f85ae71e28f5e73" -"checksum kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0caeb26248a62abf92dea93aad4f8244f54668e2f1060ed9cd9fd1d5545723" -"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319" -"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" -"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" -"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" -"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" -"checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1" -"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" -"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" -"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" -"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" -"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d" -"checksum pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393fa071b144f8ffb83ede273758983cf414ca3c0b1d2a5a9ce325b3ba3dd786" -"checksum pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ee97abcad820f9875e032656257ad1c790e7b11a0e6ce2516a8f5b0d8f8213f" -"checksum piet 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5bf3e87499d52d7a805787b5728fda48f9a2bafd502c19ff1dbfafd5887b6e44" -"checksum piet-cairo 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "27fd868970edd7b4e5d629c6357aae2eba563dd6044be94f43b39db956acbc3e" -"checksum piet-common 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e35d47e80b4a36ba5869a8c2d14389a72951c0b65bc5729da2449b164ceca058" -"checksum piet-direct2d 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a59576e5687b541e1b716cdb513862b42febb489e7d17d1f71d367e45d8da860" -"checksum piet-web 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b05f4636aaea5836367c0a4fdcf26e4822a481a15dd40fb06e2f9f5f1df8d20e" -"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" -"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" -"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0b2f0808e7d7e4fb1cb07feb6ff2f4bc827938f24f8c2e6a3beb7370af544bdd" -"checksum regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d76410686f9e3a17f06128962e0ecc5755870bb890c34820c7af7f1db2e1d48" -"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" -"checksum syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)" = "641e117d55514d6d918490e47102f7e08d096fdde360247e4a10f7a91a8478d3" -"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" -"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" -"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" -"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" -"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde" -"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" -"checksum wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "b7ccc7b93cfd13e26700a9e2e41e6305f1951b87e166599069f77d10358100e6" -"checksum wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "1953f91b1608eb1522513623c7739f047bb0fed4128ce51a93f08e12cc314645" -"checksum wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "0f69da5696545d7ca6607a2e4b1a0edf5a6b36b2c49dbb0f1df6ad1d92884047" -"checksum wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d4246f3bc73223bbb846f4f2430a60725826a96c9389adf715ed1d5af46dec6" -"checksum wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "c08381e07e7a79e5e229ad7c60d15833d19033542cc5dd91d085df59d235f4a6" -"checksum wasm-bindgen-webidl 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "1f42ff7adb8102bf5ad8adbc45b1635c520c8175f9fdf6eb2c54479d485d435a" -"checksum web-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "540b8259eb242ff3a566fa0140bda03a4ece4e5c226e1284b5c95dddcd4341f6" -"checksum weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc44aa200daee8b1f3a004beaf16554369746f1b4486f0cf93b0caf8a3c2d1e" -"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" -"checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" diff --git a/druid-shell/src/druid_gtk/application.rs b/druid-shell/src/gtk/application.rs similarity index 100% rename from druid-shell/src/druid_gtk/application.rs rename to druid-shell/src/gtk/application.rs diff --git a/druid-shell/src/druid_gtk/dialog.rs b/druid-shell/src/gtk/dialog.rs similarity index 99% rename from druid-shell/src/druid_gtk/dialog.rs rename to druid-shell/src/gtk/dialog.rs index 2cd54a6031..d5cf60a1a8 100644 --- a/druid-shell/src/druid_gtk/dialog.rs +++ b/druid-shell/src/gtk/dialog.rs @@ -16,7 +16,7 @@ use std::ffi::OsString; -use gtk::{ +use gtkrs::{ DialogExt, FileChooserAction, FileChooserDialog, FileChooserExt, ResponseType, WidgetExt, Window, }; diff --git a/druid-shell/src/druid_gtk/menu.rs b/druid-shell/src/gtk/menu.rs similarity index 95% rename from druid-shell/src/druid_gtk/menu.rs rename to druid-shell/src/gtk/menu.rs index 1e620b14db..31a9a6ed45 100644 --- a/druid-shell/src/druid_gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -19,19 +19,19 @@ use crate::window; use std::cell::RefCell; use std::sync::Arc; -use gtk::GtkMenuExt; -use gtk::Menu as GtkMenu; -use gtk::MenuBar as GtkMenuBar; -use gtk::MenuItem as GtkMenuItem; -use gtk::{AccelGroup, AccelGroupExt}; -use gtk::{GtkMenuItemExt, MenuShellExt, WidgetExt}; +use gtkrs::GtkMenuExt; +use gtkrs::Menu as GtkMenu; +use gtkrs::MenuBar as GtkMenuBar; +use gtkrs::MenuItem as GtkMenuItem; +use gtkrs::{AccelGroup, AccelGroupExt}; +use gtkrs::{GtkMenuItemExt, MenuShellExt, WidgetExt}; use crate::platform::WindowHandle; use crate::keycodes::{KeySpec, MenuKey}; use crate::keycodes::{Modifiers, M_ALT, M_CTRL, M_META, M_SHIFT}; -use crate::druid_gtk::WinCtxImpl; +use crate::gtk::WinCtxImpl; use crate::window::Text; use std::borrow::Borrow; diff --git a/druid-shell/src/druid_gtk/mod.rs b/druid-shell/src/gtk/mod.rs similarity index 100% rename from druid-shell/src/druid_gtk/mod.rs rename to druid-shell/src/gtk/mod.rs diff --git a/druid-shell/src/druid_gtk/util.rs b/druid-shell/src/gtk/util.rs similarity index 100% rename from druid-shell/src/druid_gtk/util.rs rename to druid-shell/src/gtk/util.rs diff --git a/druid-shell/src/druid_gtk/win_main.rs b/druid-shell/src/gtk/win_main.rs similarity index 98% rename from druid-shell/src/druid_gtk/win_main.rs rename to druid-shell/src/gtk/win_main.rs index 8669c81203..a3f3ffb1f1 100644 --- a/druid-shell/src/druid_gtk/win_main.rs +++ b/druid-shell/src/gtk/win_main.rs @@ -16,8 +16,8 @@ use crate::util::assert_main_thread; use gio::ApplicationFlags; -use gtk::Application; -use gtk::GtkApplicationExt; +use gtkrs::Application; +use gtkrs::GtkApplicationExt; use std::cell::RefCell; // XXX: The application needs to be global because WindowBuilder::build wants diff --git a/druid-shell/src/lib.rs b/druid-shell/src/lib.rs index 5aa7985ef4..561da5bfe9 100644 --- a/druid-shell/src/lib.rs +++ b/druid-shell/src/lib.rs @@ -34,7 +34,7 @@ extern crate gio; #[cfg(target_os = "linux")] extern crate glib; #[cfg(target_os = "linux")] -extern crate gtk; +extern crate gtk as gtkrs; #[macro_use] extern crate lazy_static; @@ -57,9 +57,9 @@ pub mod mac; pub use mac as platform; #[cfg(target_os = "linux")] -pub mod druid_gtk; +pub mod gtk; #[cfg(target_os = "linux")] -pub use druid_gtk as platform; +pub use crate::gtk as platform; pub use error::Error; From 0472887ab5c52096e683d215cd014d6db1362fb4 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Wed, 7 Aug 2019 22:26:15 +0200 Subject: [PATCH 29/78] GTK: Various warnings --- druid-shell/src/gtk/menu.rs | 7 +++---- druid-shell/src/gtk/mod.rs | 7 +++---- druid-shell/src/gtk/win_main.rs | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index 31a9a6ed45..cbb368598a 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -19,11 +19,11 @@ use crate::window; use std::cell::RefCell; use std::sync::Arc; +use gtkrs::AccelGroup; use gtkrs::GtkMenuExt; use gtkrs::Menu as GtkMenu; use gtkrs::MenuBar as GtkMenuBar; use gtkrs::MenuItem as GtkMenuItem; -use gtkrs::{AccelGroup, AccelGroupExt}; use gtkrs::{GtkMenuItemExt, MenuShellExt, WidgetExt}; use crate::platform::WindowHandle; @@ -34,8 +34,6 @@ use crate::keycodes::{Modifiers, M_ALT, M_CTRL, M_META, M_SHIFT}; use crate::gtk::WinCtxImpl; use crate::window::Text; -use std::borrow::Borrow; - pub struct Menu { items: Vec, } @@ -95,7 +93,8 @@ impl Menu { } pub fn add_dropdown(&mut self, menu: Menu, text: &str) { - self.items.push(MenuItem::SubMenu(strip_access_key(text), menu)); + self.items + .push(MenuItem::SubMenu(strip_access_key(text), menu)); } pub fn add_item(&mut self, id: u32, text: &str, key: impl Into) { diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 1fe3063431..573507a1f2 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -30,7 +30,6 @@ use gdk::EventKey; use gdk::EventMask; use gtk::AccelGroup; use gtk::ApplicationWindow; -use gtk::ApplicationWindowExt; use gtk::Inhibit; use piet_common::{Piet, RenderContext}; @@ -302,7 +301,7 @@ impl WindowBuilder { }; use gdk::ScrollDirection; - let deltas = scroll.get_scroll_deltas(); + let _deltas = scroll.get_scroll_deltas(); // TODO use these deltas let modifiers = gtk_modifiers_to_druid(scroll.get_state()); @@ -382,7 +381,7 @@ impl WindowBuilder { { let handler = Arc::clone(&handler); let handle = handle.clone(); - drawing_area.connect_destroy(move |widget| { + drawing_area.connect_destroy(move |_widget| { if let Ok(mut handler) = handler.try_borrow_mut() { let mut ctx = WinCtxImpl { handle: &handle, @@ -515,7 +514,7 @@ impl<'a> WinCtx<'a> for WinCtxImpl<'a> { &mut self.text } - fn set_cursor(&mut self, cursor: &Cursor) { + fn set_cursor(&mut self, _cursor: &Cursor) { // TODO Steven implement cursor } } diff --git a/druid-shell/src/gtk/win_main.rs b/druid-shell/src/gtk/win_main.rs index a3f3ffb1f1..7d89234805 100644 --- a/druid-shell/src/gtk/win_main.rs +++ b/druid-shell/src/gtk/win_main.rs @@ -44,7 +44,7 @@ impl RunLoop { ) .expect("Unable to create GTK application"); - application.connect_activate(|app| { + application.connect_activate(|_app| { eprintln!("Activated application"); }); From d13e83e5520e74549d56f6f3122f23e43e9be4a5 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Fri, 9 Aug 2019 15:05:57 +0200 Subject: [PATCH 30/78] GTK: implement IdleHandle and refactor to use Weak in WindowHandle --- druid-shell/examples/hello.rs | 1 + druid-shell/src/gtk/menu.rs | 38 ++------- druid-shell/src/gtk/mod.rs | 140 +++++++++++++++++++++------------- 3 files changed, 97 insertions(+), 82 deletions(-) diff --git a/druid-shell/examples/hello.rs b/druid-shell/examples/hello.rs index f2eb0f4a6d..a93388d057 100644 --- a/druid-shell/examples/hello.rs +++ b/druid-shell/examples/hello.rs @@ -127,6 +127,7 @@ fn main() { builder.set_title("Hello example"); builder.set_menu(menubar); let window = builder.build().unwrap(); + window.show(); run_loop.run(); } diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index cbb368598a..66ff205477 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -14,11 +14,6 @@ //! GTK implementation of menus. -use crate::window; - -use std::cell::RefCell; -use std::sync::Arc; - use gtkrs::AccelGroup; use gtkrs::GtkMenuExt; use gtkrs::Menu as GtkMenu; @@ -34,6 +29,7 @@ use crate::keycodes::{Modifiers, M_ALT, M_CTRL, M_META, M_SHIFT}; use crate::gtk::WinCtxImpl; use crate::window::Text; +#[derive(Default)] pub struct Menu { items: Vec, } @@ -44,19 +40,7 @@ enum MenuItem { } impl MenuItem { - /// Get the name of this menu item - fn name(&self) -> &str { - match self { - MenuItem::Entry(name, _, _) | MenuItem::SubMenu(name, _) => name, - } - } - - fn into_gtk_menu_item( - self, - handler: Arc>>, - handle: &WindowHandle, - accel_group: &AccelGroup, - ) -> GtkMenuItem { + fn into_gtk_menu_item(self, handle: &WindowHandle, accel_group: &AccelGroup) -> GtkMenuItem { match self { MenuItem::Entry(name, id, key) => { let item = GtkMenuItem::new_with_label(&name); @@ -70,8 +54,8 @@ impl MenuItem { text: Text::new(), }; - if let Ok(mut handler) = handler.try_borrow_mut() { - handler.command(id, &mut ctx); + if let Some(state) = handle.state.upgrade() { + state.handler.borrow_mut().command(id, &mut ctx); } }); @@ -79,7 +63,7 @@ impl MenuItem { } MenuItem::SubMenu(name, submenu) => { let item = GtkMenuItem::new_with_label(&name); - item.set_submenu(Some(&submenu.into_gtk_menu(handler, handle, accel_group))); + item.set_submenu(Some(&submenu.into_gtk_menu(handle, accel_group))); item } @@ -109,30 +93,24 @@ impl Menu { pub(crate) fn into_gtk_menubar( self, - handler: Arc>>, handle: &WindowHandle, accel_group: &AccelGroup, ) -> GtkMenuBar { let menu = GtkMenuBar::new(); for item in self.items { - menu.append(&item.into_gtk_menu_item(handler.clone(), handle, accel_group)); + menu.append(&item.into_gtk_menu_item(handle, accel_group)); } menu } - fn into_gtk_menu( - self, - handler: Arc>>, - handle: &WindowHandle, - accel_group: &AccelGroup, - ) -> GtkMenu { + fn into_gtk_menu(self, handle: &WindowHandle, accel_group: &AccelGroup) -> GtkMenu { let menu = GtkMenu::new(); menu.set_accel_group(Some(accel_group)); for item in self.items { - menu.append(&item.into_gtk_menu_item(handler.clone(), handle, accel_group)); + menu.append(&item.into_gtk_menu_item(handle, accel_group)); } menu diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 573507a1f2..bc6f51d081 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -23,8 +23,7 @@ pub mod win_main; use std::any::Any; use std::cell::{Cell, RefCell}; use std::ffi::OsString; -use std::rc::Weak; -use std::sync::{Arc, Mutex}; +use std::sync::{Arc, Mutex, Weak}; use gdk::EventKey; use gdk::EventMask; @@ -47,7 +46,7 @@ use win_main::with_application; #[derive(Clone, Default)] pub struct WindowHandle { - window: Option, + state: Weak, } /// Builder abstraction for creating new windows @@ -60,8 +59,8 @@ pub struct WindowBuilder { #[derive(Clone)] pub struct IdleHandle { - queue: Option, // TODO: implement this properly - idle_queue: Weak>>>, + idle_queue: Arc>>>, + state: Weak, } // TODO: move this out of platform-dependent section. @@ -75,6 +74,12 @@ impl IdleCallback for F { } } +struct WindowState { + window: ApplicationWindow, + handler: RefCell>, + idle_queue: Arc>>>, +} + struct WinCtxImpl<'a> { handle: &'a WindowHandle, text: Text<'static>, @@ -110,8 +115,6 @@ impl WindowBuilder { .handler .expect("Tried to build a window without setting the handler"); - let handler = Arc::new(RefCell::new(handler)); - let window = with_application(|app| ApplicationWindow::new(&app)); let accel_group = AccelGroup::new(); @@ -130,14 +133,26 @@ impl WindowBuilder { let vbox = gtk::Box::new(gtk::Orientation::Vertical, 0); window.add(&vbox); - let window = window; + let win_state = Arc::new(WindowState { + window, + handler: RefCell::new(handler), + idle_queue: Arc::new(Mutex::new(vec![])), + }); + + let state = win_state.clone(); + win_state.window.connect_destroy(move |_| { + // this ties a clone of Arc to the ApplicationWindow to keep it alive + // when the ApplicationWindow is destroyed, the last Arc is dropped + // and any Weak will be None on upgrade() + let _ = &state; + }); let handle = WindowHandle { - window: Some(window), + state: Arc::downgrade(&win_state), }; if let Some(menu) = self.menu { - let menu = menu.into_gtk_menubar(handler.clone(), &handle, &accel_group); + let menu = menu.into_gtk_menubar(&handle, &accel_group); vbox.pack_start(&menu, false, false, 0); } @@ -165,11 +180,10 @@ impl WindowBuilder { { let last_size = Cell::new((0, 0)); - let handler = Arc::clone(&handler); let handle = handle.clone(); drawing_area.connect_draw(move |widget, context| { - if let Ok(mut handler) = handler.try_borrow_mut() { + if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl { handle: &handle, text: Text::new(), @@ -183,7 +197,7 @@ impl WindowBuilder { if last_size.get() != size { last_size.set(size); - handler.size(size.0, size.1, &mut ctx); + state.handler.borrow_mut().size(size.0, size.1, &mut ctx); } context.set_source_rgb(0.0, 0.0, 0.0); @@ -197,7 +211,10 @@ impl WindowBuilder { // For some reason piet needs a mutable context, so give it one I guess. let mut context = context.clone(); let mut piet_context = Piet::new(&mut context); - let anim = handler.paint(&mut piet_context, &mut ctx); + let anim = state + .handler + .borrow_mut() + .paint(&mut piet_context, &mut ctx); if let Err(e) = piet_context.finish() { eprintln!("piet error on render: {:?}", e); } @@ -212,17 +229,16 @@ impl WindowBuilder { } { - let handler = Arc::clone(&handler); let handle = handle.clone(); drawing_area.connect_button_press_event(move |_widget, button| { - if let Ok(mut handler) = handler.try_borrow_mut() { + if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl { handle: &handle, text: Text::new(), }; let pos = Point::from(button.get_position()); - handler.mouse_down( + state.handler.borrow_mut().mouse_down( &window::MouseEvent { pos, count: 1, @@ -239,17 +255,16 @@ impl WindowBuilder { } { - let handler = Arc::clone(&handler); let handle = handle.clone(); drawing_area.connect_button_release_event(move |_widget, button| { - if let Ok(mut handler) = handler.try_borrow_mut() { + if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl { handle: &handle, text: Text::new(), }; let pos = Point::from(button.get_position()); - handler.mouse_up( + state.handler.borrow_mut().mouse_up( &window::MouseEvent { pos, mods: gtk_modifiers_to_druid(button.get_state()), @@ -266,10 +281,9 @@ impl WindowBuilder { } { - let handler = Arc::clone(&handler); let handle = handle.clone(); drawing_area.connect_motion_notify_event(move |_widget, motion| { - if let Ok(mut handler) = handler.try_borrow_mut() { + if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl { handle: &handle, text: Text::new(), @@ -283,7 +297,10 @@ impl WindowBuilder { button: gtk_modifiers_to_mouse_button(motion.get_state()), }; - handler.mouse_move(&mouse_event, &mut ctx); + state + .handler + .borrow_mut() + .mouse_move(&mouse_event, &mut ctx); } Inhibit(true) @@ -291,10 +308,9 @@ impl WindowBuilder { } { - let handler = Arc::clone(&handler); let handle = handle.clone(); drawing_area.connect_scroll_event(move |_widget, scroll| { - if let Ok(mut handler) = handler.try_borrow_mut() { + if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl { handle: &handle, text: Text::new(), @@ -308,6 +324,7 @@ impl WindowBuilder { // The magic "120"s are from Microsoft's documentation for WM_MOUSEWHEEL. // They claim that one "tick" on a scroll wheel should be 120 units. // GTK simply reports the direction + let mut handler = state.handler.borrow_mut(); match scroll.get_direction() { ScrollDirection::Up => { handler.wheel(Vec2::from((0.0, -120.0)), modifiers, &mut ctx); @@ -343,17 +360,16 @@ impl WindowBuilder { } { - let handler = Arc::clone(&handler); let handle = handle.clone(); drawing_area.connect_key_press_event(move |_widget, key| { - if let Ok(mut handler) = handler.try_borrow_mut() { + if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl { handle: &handle, text: Text::new(), }; let key_event = gtk_event_key_to_key_event(key); - handler.key_down(key_event, &mut ctx); + state.handler.borrow_mut().key_down(key_event, &mut ctx); } Inhibit(true) @@ -361,17 +377,16 @@ impl WindowBuilder { } { - let handler = Arc::clone(&handler); let handle = handle.clone(); drawing_area.connect_key_release_event(move |_widget, key| { - if let Ok(mut handler) = handler.try_borrow_mut() { + if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl { handle: &handle, text: Text::new(), }; let key_event = gtk_event_key_to_key_event(key); - handler.key_up(key_event, &mut ctx); + state.handler.borrow_mut().key_up(key_event, &mut ctx); } Inhibit(true) @@ -379,24 +394,26 @@ impl WindowBuilder { } { - let handler = Arc::clone(&handler); let handle = handle.clone(); drawing_area.connect_destroy(move |_widget| { - if let Ok(mut handler) = handler.try_borrow_mut() { + if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl { handle: &handle, text: Text::new(), }; - handler.destroy(&mut ctx); + state.handler.borrow_mut().destroy(&mut ctx); } }); } vbox.pack_end(&drawing_area, true, true, 0); - handler.borrow_mut().connect(&window::WindowHandle { - inner: handle.clone(), - }); + win_state + .handler + .borrow_mut() + .connect(&window::WindowHandle { + inner: handle.clone(), + }); Ok(handle) } @@ -405,17 +422,17 @@ impl WindowBuilder { impl WindowHandle { pub fn show(&self) { use gtk::WidgetExt; - if let Some(window) = self.window.as_ref() { - window.show_all(); + if let Some(state) = self.state.upgrade() { + state.window.show_all(); } } /// Close the window. pub fn close(&self) { use gtk::GtkApplicationExt; - if let Some(window) = self.window.as_ref() { + if let Some(state) = self.state.upgrade() { with_application(|app| { - app.remove_window(window); + app.remove_window(&state.window); }); } } @@ -423,14 +440,16 @@ impl WindowHandle { // Request invalidation of the entire window contents. pub fn invalidate(&self) { use gtk::WidgetExt; - if let Some(window) = self.window.as_ref() { - window.queue_draw(); + if let Some(state) = self.state.upgrade() { + state.window.queue_draw(); } } - /// Get a handle that can be used to schedule an idle task. pub fn get_idle_handle(&self) -> Option { - unimplemented!("WindowHandle::get_idle_handle"); + self.state.upgrade().map(|s| IdleHandle { + idle_queue: s.idle_queue.clone(), + state: Arc::downgrade(&s), + }) } /// Get the dpi of the window. @@ -474,15 +493,17 @@ impl WindowHandle { options: FileDialogOptions, ) -> Result { use gtk::Cast; - if let Some(window) = &self.window { - dialog::get_file_dialog_path(window.upcast_ref(), ty, options) + if let Some(state) = self.state.upgrade() { + dialog::get_file_dialog_path(state.window.upcast_ref(), ty, options) } else { - Err(Error::Null) // TODO proper error + Err(Error::Null) } } } unsafe impl Send for IdleHandle {} +unsafe impl Send for WindowState {} +unsafe impl Sync for WindowState {} impl IdleHandle { /// Add an idle handler, which is called (once) when the message loop @@ -495,16 +516,31 @@ impl IdleHandle { where F: FnOnce(&Any) + Send + 'static, { - if let Some(queue) = self.idle_queue.upgrade() { - let mut queue = queue.lock().unwrap(); + let mut queue = self.idle_queue.lock().unwrap(); + if let Some(state) = self.state.upgrade() { if queue.is_empty() { - unimplemented!("Idle queue wait"); + queue.push(Box::new(callback)); + gdk::threads_add_idle(move || run_idle(&state)); + } else { + queue.push(Box::new(callback)); } - queue.push(Box::new(callback)); } } } +fn run_idle(state: &Arc) -> bool { + assert_main_thread(); + let mut handler = state.handler.borrow_mut(); + let handler_as_any = handler.as_any(); + + let queue: Vec<_> = std::mem::replace(&mut state.idle_queue.lock().unwrap(), Vec::new()); + + for callback in queue { + callback.call(handler_as_any); + } + false +} + impl<'a> WinCtx<'a> for WinCtxImpl<'a> { fn invalidate(&mut self) { self.handle.invalidate(); From 21deb2b7a0d445f8f5f719d0a376e8b62171fb82 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Sat, 10 Aug 2019 00:08:12 +0200 Subject: [PATCH 31/78] GTK: Add timers --- druid-shell/src/gtk/mod.rs | 41 +++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index bc6f51d081..7e2ad79416 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -37,7 +37,7 @@ use crate::keyboard; use crate::kurbo::{Point, Vec2}; use crate::platform::dialog::{FileDialogOptions, FileDialogType}; use crate::platform::menu::Menu; -use crate::window::{self, Cursor, MouseButton, Text, WinCtx, WinHandler}; +use crate::window::{self, Cursor, MouseButton, Text, TimerToken, WinCtx, WinHandler}; use crate::Error; use crate::keyboard::{KeyCode, RawKeyCode, StrOrChar}; @@ -553,6 +553,39 @@ impl<'a> WinCtx<'a> for WinCtxImpl<'a> { fn set_cursor(&mut self, _cursor: &Cursor) { // TODO Steven implement cursor } + + fn request_timer(&mut self, deadline: std::time::Instant) -> TimerToken { + let interval = time_interval_from_deadline(deadline); + let token = next_timer_id(); + + let handle = self.handle.clone(); + + gdk::threads_add_timeout(interval, move || { + println!("timeout triggered"); + if let Some(state) = handle.state.upgrade() { + let mut ctx = WinCtxImpl { + handle: &handle, + text: Text::new(), + }; + state + .handler + .borrow_mut() + .timer(TimerToken::new(token), &mut ctx); + } + false + }); + + TimerToken::new(token) + } +} + +fn time_interval_from_deadline(deadline: std::time::Instant) -> u32 { + let now = std::time::Instant::now(); + if now >= deadline { + 0 + } else { + (deadline - now).as_millis() as u32 + } } /// Map a GTK mouse button to a Druid one @@ -766,3 +799,9 @@ impl From for KeyCode { } } } + +fn next_timer_id() -> usize { + use std::sync::atomic::{AtomicUsize, Ordering}; + static TIMER_ID: AtomicUsize = AtomicUsize::new(1); + TIMER_ID.fetch_add(1, Ordering::Relaxed) +} From 28d3cf68fbf2e4f28446443fa0a42982e874c3e0 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Sat, 10 Aug 2019 00:22:17 +0200 Subject: [PATCH 32/78] GTK: DRY WinCtxImpl creation --- druid-shell/src/gtk/menu.rs | 5 +--- druid-shell/src/gtk/mod.rs | 56 +++++++++++++------------------------ 2 files changed, 20 insertions(+), 41 deletions(-) diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index 66ff205477..d955abf472 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -49,10 +49,7 @@ impl MenuItem { let handle = handle.clone(); item.connect_activate(move |_| { - let mut ctx = WinCtxImpl { - handle: &handle, - text: Text::new(), - }; + let mut ctx = WinCtxImpl::from(&handle); if let Some(state) = handle.state.upgrade() { state.handler.borrow_mut().command(id, &mut ctx); diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 7e2ad79416..d9ada81db1 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -184,10 +184,7 @@ impl WindowBuilder { drawing_area.connect_draw(move |widget, context| { if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl { - handle: &handle, - text: Text::new(), - }; + let mut ctx = WinCtxImpl::from(&handle); let extents = context.clip_extents(); let size = ( @@ -232,10 +229,7 @@ impl WindowBuilder { let handle = handle.clone(); drawing_area.connect_button_press_event(move |_widget, button| { if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl { - handle: &handle, - text: Text::new(), - }; + let mut ctx = WinCtxImpl::from(&handle); let pos = Point::from(button.get_position()); state.handler.borrow_mut().mouse_down( @@ -258,10 +252,7 @@ impl WindowBuilder { let handle = handle.clone(); drawing_area.connect_button_release_event(move |_widget, button| { if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl { - handle: &handle, - text: Text::new(), - }; + let mut ctx = WinCtxImpl::from(&handle); let pos = Point::from(button.get_position()); state.handler.borrow_mut().mouse_up( @@ -284,10 +275,7 @@ impl WindowBuilder { let handle = handle.clone(); drawing_area.connect_motion_notify_event(move |_widget, motion| { if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl { - handle: &handle, - text: Text::new(), - }; + let mut ctx = WinCtxImpl::from(&handle); let pos = Point::from(motion.get_position()); let mouse_event = window::MouseEvent { @@ -311,10 +299,7 @@ impl WindowBuilder { let handle = handle.clone(); drawing_area.connect_scroll_event(move |_widget, scroll| { if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl { - handle: &handle, - text: Text::new(), - }; + let mut ctx = WinCtxImpl::from(&handle); use gdk::ScrollDirection; let _deltas = scroll.get_scroll_deltas(); @@ -363,10 +348,7 @@ impl WindowBuilder { let handle = handle.clone(); drawing_area.connect_key_press_event(move |_widget, key| { if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl { - handle: &handle, - text: Text::new(), - }; + let mut ctx = WinCtxImpl::from(&handle); let key_event = gtk_event_key_to_key_event(key); state.handler.borrow_mut().key_down(key_event, &mut ctx); @@ -380,10 +362,7 @@ impl WindowBuilder { let handle = handle.clone(); drawing_area.connect_key_release_event(move |_widget, key| { if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl { - handle: &handle, - text: Text::new(), - }; + let mut ctx = WinCtxImpl::from(&handle); let key_event = gtk_event_key_to_key_event(key); state.handler.borrow_mut().key_up(key_event, &mut ctx); @@ -397,10 +376,7 @@ impl WindowBuilder { let handle = handle.clone(); drawing_area.connect_destroy(move |_widget| { if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl { - handle: &handle, - text: Text::new(), - }; + let mut ctx = WinCtxImpl::from(&handle); state.handler.borrow_mut().destroy(&mut ctx); } }); @@ -561,12 +537,9 @@ impl<'a> WinCtx<'a> for WinCtxImpl<'a> { let handle = self.handle.clone(); gdk::threads_add_timeout(interval, move || { - println!("timeout triggered"); if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl { - handle: &handle, - text: Text::new(), - }; + let mut ctx = WinCtxImpl::from(&handle); + state .handler .borrow_mut() @@ -579,6 +552,15 @@ impl<'a> WinCtx<'a> for WinCtxImpl<'a> { } } +impl<'a> From<&'a WindowHandle> for WinCtxImpl<'a> { + fn from(handle: &'a WindowHandle) -> Self { + WinCtxImpl { + handle, + text: Text::new(), + } + } +} + fn time_interval_from_deadline(deadline: std::time::Instant) -> u32 { let now = std::time::Instant::now(); if now >= deadline { From 223447d84bd2c13520a11422e587598937cb42f4 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Mon, 12 Aug 2019 18:12:57 +0200 Subject: [PATCH 33/78] GTK: Implement set_cursor on WinCtx --- druid-shell/src/gtk/mod.rs | 44 ++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index d9ada81db1..0ba7438350 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -53,7 +53,6 @@ pub struct WindowHandle { pub struct WindowBuilder { handler: Option>, title: String, - cursor: Cursor, menu: Option, } @@ -90,7 +89,6 @@ impl WindowBuilder { WindowBuilder { handler: None, title: String::new(), - cursor: Cursor::Arrow, menu: None, } } @@ -120,16 +118,6 @@ impl WindowBuilder { let accel_group = AccelGroup::new(); window.add_accel_group(&accel_group); - window.set_title(&self.title); - // TODO(bobtwinkles): enable this when I figure out how to set the cursor on application windows - // window.set_cursor(gdk::Cursor::new_from_nane( - // &window.get_display(), - // match self.cursor { - // Arrow => "default", - // IBeam => "text", - // }, - // )); - let vbox = gtk::Box::new(gtk::Orientation::Vertical, 0); window.add(&vbox); @@ -526,8 +514,19 @@ impl<'a> WinCtx<'a> for WinCtxImpl<'a> { &mut self.text } - fn set_cursor(&mut self, _cursor: &Cursor) { - // TODO Steven implement cursor + fn set_cursor(&mut self, cursor: &Cursor) { + use gdk::WindowExt; + use gtk::WidgetExt; + + if let Some(gdk_window) = self + .handle + .state + .upgrade() + .and_then(|s| s.window.get_window()) + { + let cursor = make_gdk_cursor(cursor, &gdk_window); + gdk_window.set_cursor(cursor.as_ref()); + } } fn request_timer(&mut self, deadline: std::time::Instant) -> TimerToken { @@ -570,6 +569,23 @@ fn time_interval_from_deadline(deadline: std::time::Instant) -> u32 { } } +fn make_gdk_cursor(cursor: &Cursor, gdk_window: &gdk::Window) -> Option { + use gdk::WindowExt; + gdk::Cursor::new_from_name( + &gdk_window.get_display(), + match cursor { + // cursor name values from https://www.w3.org/TR/css-ui-3/#cursor + Cursor::Arrow => "default", + Cursor::IBeam => "text", + Cursor::Crosshair => "crosshair", + Cursor::OpenHand => "grab", + Cursor::NotAllowed => "not-allowed", + Cursor::ResizeLeftRight => "ew-resize", + Cursor::ResizeUpDown => "ns-resize", + }, + ) +} + /// Map a GTK mouse button to a Druid one #[inline] fn gtk_button_to_druid(button: u32) -> window::MouseButton { From 2c2d545e45ad0f40636cdbdad8c511645f22f98b Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Mon, 12 Aug 2019 18:39:49 +0200 Subject: [PATCH 34/78] Remove unused imports --- druid-shell/src/gtk/menu.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index d955abf472..09781cccc9 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -27,7 +27,6 @@ use crate::keycodes::{KeySpec, MenuKey}; use crate::keycodes::{Modifiers, M_ALT, M_CTRL, M_META, M_SHIFT}; use crate::gtk::WinCtxImpl; -use crate::window::Text; #[derive(Default)] pub struct Menu { From 0b7e73ddacc46dce521d4ed02774f6f6f719575b Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Mon, 12 Aug 2019 18:45:58 +0200 Subject: [PATCH 35/78] GTK: Cleanup Modifier handling --- druid-shell/src/gtk/menu.rs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index 09781cccc9..a662afbd1f 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -126,23 +126,13 @@ fn register_accelerator(item: &GtkMenuItem, accel_group: &AccelGroup, menu_key: } fn modifiers_to_gdk_modifier_type(modifiers: Modifiers) -> gdk::ModifierType { - let mut result = gdk::ModifierType::empty(); + use gdk::ModifierType; + let mut result = ModifierType::empty(); - if modifiers & M_ALT == M_ALT { - result.insert(gdk::ModifierType::MOD1_MASK); - } - - if modifiers & M_CTRL == M_CTRL { - result.insert(gdk::ModifierType::CONTROL_MASK); - } - - if modifiers & M_SHIFT == M_SHIFT { - result.insert(gdk::ModifierType::SHIFT_MASK); - } - - if modifiers & M_META == M_META { - result.insert(gdk::ModifierType::META_MASK); - } + result.set(ModifierType::MOD1_MASK, modifiers & M_ALT == M_ALT); + result.set(ModifierType::CONTROL_MASK, modifiers & M_CTRL == M_CTRL); + result.set(ModifierType::SHIFT_MASK, modifiers & M_SHIFT == M_SHIFT); + result.set(ModifierType::META_MASK, modifiers & M_META == M_META); result } From ba6a97c426b96ba647904900385315b0e42cf91b Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Mon, 12 Aug 2019 19:11:02 +0200 Subject: [PATCH 36/78] GTK: implement get_dpi --- druid-shell/src/gtk/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 0ba7438350..468d3f73e0 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -291,7 +291,7 @@ impl WindowBuilder { use gdk::ScrollDirection; let _deltas = scroll.get_scroll_deltas(); - // TODO use these deltas + // TODO use these deltas (for smooth scrolling) let modifiers = gtk_modifiers_to_druid(scroll.get_state()); // The magic "120"s are from Microsoft's documentation for WM_MOUSEWHEEL. @@ -421,8 +421,13 @@ impl WindowHandle { /// TODO: we want to migrate this from dpi (with 96 as nominal) to a scale /// factor (with 1 as nominal). pub fn get_dpi(&self) -> f32 { - // TODO: get actual dpi - 96.0 + use gdk::WindowExt; + use gtk::WidgetExt; + self.state + .upgrade() + .and_then(|s| s.window.get_window()) + .map(|w| w.get_display().get_default_screen().get_resolution() as f32) + .unwrap_or(96.0) } // TODO: the following methods are cut'n'paste code. A good way to DRY From 99901447cdff6a029982ffda5d192ab7416c7941 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Mon, 12 Aug 2019 20:05:40 +0200 Subject: [PATCH 37/78] GTK: Implement key repeats --- druid-shell/src/gtk/mod.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 468d3f73e0..f24f93b256 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -77,6 +77,7 @@ struct WindowState { window: ApplicationWindow, handler: RefCell>, idle_queue: Arc>>>, + current_keyval: RefCell>, } struct WinCtxImpl<'a> { @@ -125,6 +126,7 @@ impl WindowBuilder { window, handler: RefCell::new(handler), idle_queue: Arc::new(Mutex::new(vec![])), + current_keyval: RefCell::new(None), }); let state = win_state.clone(); @@ -338,7 +340,12 @@ impl WindowBuilder { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); - let key_event = gtk_event_key_to_key_event(key); + let mut current_keyval = state.current_keyval.borrow_mut(); + let repeat = *current_keyval == Some(key.get_keyval()); + + *current_keyval = Some(key.get_keyval()); + + let key_event = gtk_event_key_to_key_event(key, repeat); state.handler.borrow_mut().key_down(key_event, &mut ctx); } @@ -352,7 +359,9 @@ impl WindowBuilder { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); - let key_event = gtk_event_key_to_key_event(key); + *(state.current_keyval.borrow_mut()) = None; + + let key_event = gtk_event_key_to_key_event(key, false); state.handler.borrow_mut().key_up(key_event, &mut ctx); } @@ -676,7 +685,7 @@ fn hardware_keycode_to_keyval(keycode: u16) -> Option { } } -fn gtk_event_key_to_key_event(key: &EventKey) -> keyboard::KeyEvent { +fn gtk_event_key_to_key_event(key: &EventKey, repeat: bool) -> keyboard::KeyEvent { // the logical key being pressed let keyval = key.get_keyval(); @@ -690,7 +699,7 @@ fn gtk_event_key_to_key_event(key: &EventKey) -> keyboard::KeyEvent { keyboard::KeyEvent::new( keycode, - false, // TODO Steven implement is_repeat + repeat, gtk_modifiers_to_druid(key.get_state()), text, unmodified_text, From d235f0f76dd90ef20d8c790cd299fbcdf7d8c90e Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Mon, 12 Aug 2019 20:20:43 +0200 Subject: [PATCH 38/78] GTK: Add double and triple click support to mouse events --- druid-shell/src/gtk/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index f24f93b256..225460e3dd 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -221,14 +221,20 @@ impl WindowBuilder { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); + let count = match button.get_event_type() { + gdk::EventType::ButtonPress => 1, + gdk::EventType::DoubleButtonPress => 2, + gdk::EventType::TripleButtonPress => 3, + _ => 0, + }; + let pos = Point::from(button.get_position()); state.handler.borrow_mut().mouse_down( &window::MouseEvent { pos, - count: 1, + count, mods: gtk_modifiers_to_druid(button.get_state()), button: gtk_button_to_druid(button.get_button()), - //ty: window::MouseType::Down, }, &mut ctx, ); @@ -251,7 +257,6 @@ impl WindowBuilder { mods: gtk_modifiers_to_druid(button.get_state()), count: 0, button: gtk_button_to_druid(button.get_button()), - //ty: window::MouseType::Up, }, &mut ctx, ); From 35a0332dd4693522fbb80bde197048becf12c19c Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 13 Aug 2019 17:02:48 +0200 Subject: [PATCH 39/78] GTK: Add Linux build instructions --- CONTRIBUTING.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c0d048386d..05dbe4e162 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,6 +22,12 @@ You may also need to set your `PKG_CONFIG_PATH`; assuming you have installed `ca $> PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" cargo build ``` +#### Linux + +On Linux, druid requires gtk+3; see[gtk-rs dependencies] for installation instructions. + +run `cargo build` + ## Code reviews All submissions, including submissions by project members, require review. We From 93b5ce96c4b2abb728154c0affa2d48693808865 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 13 Aug 2019 17:17:14 +0200 Subject: [PATCH 40/78] GTK: Cleanup imports --- druid-shell/src/gtk/menu.rs | 8 ++--- druid-shell/src/gtk/mod.rs | 52 +++++++++++---------------------- druid-shell/src/gtk/win_main.rs | 13 ++++----- 3 files changed, 25 insertions(+), 48 deletions(-) diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index a662afbd1f..64d453f90c 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -14,6 +14,7 @@ //! GTK implementation of menus. +use gdk::ModifierType; use gtkrs::AccelGroup; use gtkrs::GtkMenuExt; use gtkrs::Menu as GtkMenu; @@ -21,12 +22,10 @@ use gtkrs::MenuBar as GtkMenuBar; use gtkrs::MenuItem as GtkMenuItem; use gtkrs::{GtkMenuItemExt, MenuShellExt, WidgetExt}; -use crate::platform::WindowHandle; - +use crate::gtk::WinCtxImpl; use crate::keycodes::{KeySpec, MenuKey}; use crate::keycodes::{Modifiers, M_ALT, M_CTRL, M_META, M_SHIFT}; - -use crate::gtk::WinCtxImpl; +use crate::platform::WindowHandle; #[derive(Default)] pub struct Menu { @@ -126,7 +125,6 @@ fn register_accelerator(item: &GtkMenuItem, accel_group: &AccelGroup, menu_key: } fn modifiers_to_gdk_modifier_type(modifiers: Modifiers) -> gdk::ModifierType { - use gdk::ModifierType; let mut result = ModifierType::empty(); result.set(ModifierType::MOD1_MASK, modifiers & M_ALT == M_ALT); diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 225460e3dd..ddcd725890 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -14,35 +14,36 @@ //! GTK-based platform support -pub mod application; -pub mod dialog; -pub mod menu; -pub mod util; -pub mod win_main; - use std::any::Any; use std::cell::{Cell, RefCell}; +use std::ffi::c_void; use std::ffi::OsString; +use std::os::raw::{c_int, c_uint}; +use std::ptr; +use std::slice; use std::sync::{Arc, Mutex, Weak}; -use gdk::EventKey; -use gdk::EventMask; -use gtk::AccelGroup; -use gtk::ApplicationWindow; -use gtk::Inhibit; - +use gdk::{EventKey, EventMask, ModifierType, ScrollDirection, WindowExt}; +use gtk::{ + AccelGroup, ApplicationWindow, BoxExt, Cast, ContainerExt, GtkApplicationExt, GtkWindowExt, + Inhibit, WidgetExt, WidgetExtManual, +}; use piet_common::{Piet, RenderContext}; +use util::assert_main_thread; +use win_main::with_application; -use crate::keyboard; +use crate::keyboard::{self, KeyCode, RawKeyCode, StrOrChar}; use crate::kurbo::{Point, Vec2}; use crate::platform::dialog::{FileDialogOptions, FileDialogType}; use crate::platform::menu::Menu; use crate::window::{self, Cursor, MouseButton, Text, TimerToken, WinCtx, WinHandler}; use crate::Error; -use crate::keyboard::{KeyCode, RawKeyCode, StrOrChar}; -use util::assert_main_thread; -use win_main::with_application; +pub mod application; +pub mod dialog; +pub mod menu; +pub mod util; +pub mod win_main; #[derive(Clone, Default)] pub struct WindowHandle { @@ -107,7 +108,6 @@ impl WindowBuilder { } pub fn build(self) -> Result { - use gtk::{BoxExt, ContainerExt, GtkWindowExt, WidgetExt, WidgetExtManual}; assert_main_thread(); let handler = self @@ -296,7 +296,6 @@ impl WindowBuilder { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); - use gdk::ScrollDirection; let _deltas = scroll.get_scroll_deltas(); // TODO use these deltas (for smooth scrolling) let modifiers = gtk_modifiers_to_druid(scroll.get_state()); @@ -399,7 +398,6 @@ impl WindowBuilder { impl WindowHandle { pub fn show(&self) { - use gtk::WidgetExt; if let Some(state) = self.state.upgrade() { state.window.show_all(); } @@ -407,7 +405,6 @@ impl WindowHandle { /// Close the window. pub fn close(&self) { - use gtk::GtkApplicationExt; if let Some(state) = self.state.upgrade() { with_application(|app| { app.remove_window(&state.window); @@ -417,7 +414,6 @@ impl WindowHandle { // Request invalidation of the entire window contents. pub fn invalidate(&self) { - use gtk::WidgetExt; if let Some(state) = self.state.upgrade() { state.window.queue_draw(); } @@ -435,8 +431,6 @@ impl WindowHandle { /// TODO: we want to migrate this from dpi (with 96 as nominal) to a scale /// factor (with 1 as nominal). pub fn get_dpi(&self) -> f32 { - use gdk::WindowExt; - use gtk::WidgetExt; self.state .upgrade() .and_then(|s| s.window.get_window()) @@ -475,7 +469,6 @@ impl WindowHandle { ty: FileDialogType, options: FileDialogOptions, ) -> Result { - use gtk::Cast; if let Some(state) = self.state.upgrade() { dialog::get_file_dialog_path(state.window.upcast_ref(), ty, options) } else { @@ -534,9 +527,6 @@ impl<'a> WinCtx<'a> for WinCtxImpl<'a> { } fn set_cursor(&mut self, cursor: &Cursor) { - use gdk::WindowExt; - use gtk::WidgetExt; - if let Some(gdk_window) = self .handle .state @@ -589,7 +579,6 @@ fn time_interval_from_deadline(deadline: std::time::Instant) -> u32 { } fn make_gdk_cursor(cursor: &Cursor, gdk_window: &gdk::Window) -> Option { - use gdk::WindowExt; gdk::Cursor::new_from_name( &gdk_window.get_display(), match cursor { @@ -620,8 +609,6 @@ fn gtk_button_to_druid(button: u32) -> window::MouseButton { /// Map the GTK modifiers into Druid bits #[inline] fn gtk_modifiers_to_druid(modifiers: gdk::ModifierType) -> keyboard::KeyModifiers { - use gdk::ModifierType; - keyboard::KeyModifiers { shift: modifiers.contains(ModifierType::SHIFT_MASK), alt: modifiers.contains(ModifierType::MOD1_MASK), @@ -631,7 +618,6 @@ fn gtk_modifiers_to_druid(modifiers: gdk::ModifierType) -> keyboard::KeyModifier } fn gtk_modifiers_to_mouse_button(modifiers: gdk::ModifierType) -> window::MouseButton { - use gdk::ModifierType; match modifiers { modifiers if modifiers.contains(ModifierType::BUTTON1_MASK) => MouseButton::Left, modifiers if modifiers.contains(ModifierType::BUTTON2_MASK) => MouseButton::Middle, @@ -647,10 +633,6 @@ fn gtk_modifiers_to_mouse_button(modifiers: gdk::ModifierType) -> window::MouseB /// Map a hardware keycode to a keyval by looking up the keycode in the keymap fn hardware_keycode_to_keyval(keycode: u16) -> Option { - use std::ffi::c_void; - use std::os::raw::{c_int, c_uint}; - use std::ptr; - use std::slice; unsafe { let keymap = gdk_sys::gdk_keymap_get_default(); diff --git a/druid-shell/src/gtk/win_main.rs b/druid-shell/src/gtk/win_main.rs index 7d89234805..6f08e3be61 100644 --- a/druid-shell/src/gtk/win_main.rs +++ b/druid-shell/src/gtk/win_main.rs @@ -14,12 +14,13 @@ //! GTK implementation of runloop. -use crate::util::assert_main_thread; -use gio::ApplicationFlags; -use gtkrs::Application; -use gtkrs::GtkApplicationExt; use std::cell::RefCell; +use gio::{ApplicationExt, ApplicationExtManual, ApplicationFlags, Cancellable}; +use gtkrs::{Application, GtkApplicationExt}; + +use crate::util::assert_main_thread; + // XXX: The application needs to be global because WindowBuilder::build wants // to construct an ApplicationWindow, which needs the application, but // WindowBuilder::build does not get the RunLoop @@ -32,9 +33,6 @@ pub struct RunLoop {} impl RunLoop { pub fn new() -> RunLoop { - use gio::ApplicationExt; - use gio::Cancellable; - assert_main_thread(); // TODO: we should give control over the application ID to the user @@ -58,7 +56,6 @@ impl RunLoop { } pub fn run(&mut self) { - use gio::ApplicationExtManual; assert_main_thread(); // TODO: should we pass the command line arguments? From b97b41128e3a49a63a32aa905c10feca6be428ed Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Tue, 13 Aug 2019 17:51:05 +0200 Subject: [PATCH 41/78] GTK: cleanup method names and ordering --- Cargo.lock | 986 +++++++++++++++++++++++++++++++++++ druid-shell/Cargo.lock | 989 ++++++++++++++++++++++++++++++++++++ druid-shell/src/gtk/mod.rs | 227 ++------- druid-shell/src/keyboard.rs | 107 ++++ 4 files changed, 2137 insertions(+), 172 deletions(-) create mode 100644 Cargo.lock create mode 100644 druid-shell/Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000000..d625b09953 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,986 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "arrayvec" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atk-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "backtrace" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bitflags" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "boolinator" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bumpalo" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cairo-rs" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cocoa" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "core-graphics" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "direct2d" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "direct3d11" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "directwrite" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "druid" +version = "0.3.0" +dependencies = [ + "druid-shell 0.3.0", +] + +[[package]] +name = "druid-shell" +version = "0.3.0" +dependencies = [ + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", + "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dxgi" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "either" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "failure" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fragile" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "gdk" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdk-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gio" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gio-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glib" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glib-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gobject-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gtk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gtk-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "heck" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "js-sys" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "kurbo" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lazy_static" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.61" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "nodrop" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "nom" +version = "4.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-bigint" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-complex" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-integer" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-iter" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-rational" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "objc" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pango" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pango-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-cairo" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-common" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-cairo 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-direct2d 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-web 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-direct2d" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-web" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pkg-config" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc-demangle" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc-serialize" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "sourcefile" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synstructure" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-segmentation" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasm-bindgen" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasm-bindgen-webidl" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "web-sys" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", + "sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-webidl 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "weedle" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wio" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" +"checksum atk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "86b7499272acf036bb5820c6e346bbfb5acc5dceb104bc2c4fd7e6e33dfcde6a" +"checksum atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067531f752c01027f004032bb676e715aba74b75e904a7340a61ce3fb0b61b0" +"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" +"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" +"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" +"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" +"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +"checksum boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" +"checksum bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd43d82f27d68911e6ee11ee791fb248f138f5d69424dc02e098d4f152b0b05" +"checksum cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e05db47de3b0f09a222fa4bba2eab957d920d4243962a86b2d77ab401e4a359c" +"checksum cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90a1ec04603a78c111886a385edcec396dbfbc57ea26b9e74aeea6a1fe55dcca" +"checksum cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "b548a4ee81fccb95919d4e22cfea83c7693ebfd78f0495493178db20b3139da7" +"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf79daa4e11e5def06e55306aa3601b87de6b5149671529318da048f67cdd77b" +"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" +"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" +"checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" +"checksum direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7fa6ff10857eb253d1ae16987ebfd27372f4129b0c7a3fa41466fbdf7e453e75" +"checksum direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "315aa929e68ba066cb6fb86f1b22af24f517e02fd9b5734c4d07e42cb9f4aefa" +"checksum directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8cdcd739e9351c411b8caf5cab32a27c818cfe06260595da121382ecdd22083d" +"checksum dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1639bbfd6765e92a40267d217a7acbac5b49320b68013f39a8e4376aa8c1e091" +"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f8140122fa0d5dcb9fc8627cfce2b37cc1500f752636d46ea28bc26785c2f9" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6243e995f41f3a61a31847e54cc719edce93dd9140c89dca3b9919be1cfe22d5" +"checksum gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9726408ee1bbada83094326a99b9c68fea275f9dbb515de242a69e72051f4fcc" +"checksum gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1d6778abf5764b9080a9345a16c5d16289426a3b3edd808a29a9061d431c465" +"checksum gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ebe06357212127f50575b535bdb04638f5d375bb41062287abc6c94e5b8067b" +"checksum gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6261b5d34c30c2d59f879e643704cf54cb44731f3a2038000b68790c03e360e3" +"checksum gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "778b856a70a32e2cc5dd5cc7fa1b0c4b6df924fdf5c82984bc28f30565657cfe" +"checksum glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91a70db179515473b57aaff8b879167f1f8460bc5523e97beacf6d1026a8b99d" +"checksum glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b86a9169fbc9cf9a0ef315039c2304b09d5c575c5fde7defba3576a0311b863" +"checksum gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61d55bc9202447ca776f6ad0048c36e3312010f66f82ab478e97513e93f3604b" +"checksum gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "709f1074259d4685b96133f92b75c7f35b504715b0fcdc96ec95de2607296a60" +"checksum gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bbd9395497ae1d1915d1d6e522d51ae8745bf613906c34ac191c411250fc4025" +"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +"checksum js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "da3ea71161651a4cd97d999b2da139109c537b15ab33abc8ae4ead38deac8a03" +"checksum kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0caeb26248a62abf92dea93aad4f8244f54668e2f1060ed9cd9fd1d5545723" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)" = "c665266eb592905e8503ba3403020f4b8794d26263f412ca33171600eca9a6fa" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" +"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" +"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" +"checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1" +"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" +"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" +"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" +"checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d" +"checksum pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393fa071b144f8ffb83ede273758983cf414ca3c0b1d2a5a9ce325b3ba3dd786" +"checksum pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ee97abcad820f9875e032656257ad1c790e7b11a0e6ce2516a8f5b0d8f8213f" +"checksum piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "02e36470db0f6e8900c3f2d35ae137c96ebb726af2c070fc4369467ee57ab9bd" +"checksum piet-cairo 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1afd8ad4a74d1ef1591e0bad7f860841c5a0cab6edeb347fc67e2e37422c01df" +"checksum piet-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8e8cb78927118d65d350a677432e459d90ff72ea6fc875cf1ac1478d5570e196" +"checksum piet-direct2d 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ccea047f88a367ad86b2a972302070f0bf4183b51376ad840b9eb298f3bdafc1" +"checksum piet-web 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5f168f31a01eb3d0cc977258ae6b085f98d022f32b7e3edcdb4f565d912dcc60" +"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" +"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +"checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" +"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +"checksum wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "4de97fa1806bb1a99904216f6ac5e0c050dc4f8c676dc98775047c38e5c01b55" +"checksum wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "5d82c170ef9f5b2c63ad4460dfcee93f3ec04a9a36a4cc20bc973c39e59ab8e3" +"checksum wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f07d50f74bf7a738304f6b8157f4a581e1512cd9e9cdb5baad8c31bbe8ffd81d" +"checksum wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "95cf8fe77e45ba5f91bc8f3da0c3aa5d464b3d8ed85d84f4d4c7cc106436b1d7" +"checksum wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "d9c2d4d4756b2e46d3a5422e06277d02e4d3e1d62d138b76a4c681e925743623" +"checksum wasm-bindgen-webidl 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "24e47859b4eba3d3b9a5c2c299f9d6f8d0b613671315f6f0c5c7f835e524b36a" +"checksum web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "86d515d2f713d3a6ab198031d2181b7540f8e319e4637ec2d4a41a208335ef29" +"checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164" +"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" diff --git a/druid-shell/Cargo.lock b/druid-shell/Cargo.lock new file mode 100644 index 0000000000..a3d6bcc988 --- /dev/null +++ b/druid-shell/Cargo.lock @@ -0,0 +1,989 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "arrayvec" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atk-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "backtrace" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bitflags" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "boolinator" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bumpalo" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cairo-rs" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cocoa" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "core-graphics" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "direct2d" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "direct3d11" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "directwrite" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "druid-shell" +version = "0.3.0" +dependencies = [ + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", + "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "kurbo 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dxgi" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "either" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "failure" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fragile" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "gdk" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdk-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gio" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gio-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glib" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glib-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gobject-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gtk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gtk-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "heck" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "js-sys" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "kurbo" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "kurbo" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lazy_static" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.61" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "nodrop" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "nom" +version = "4.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-bigint" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-complex" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-integer" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-iter" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-rational" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "objc" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pango" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pango-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-cairo" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-common" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-cairo 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-direct2d 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "piet-web 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-direct2d" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piet-web" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", + "piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pkg-config" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc-demangle" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc-serialize" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "sourcefile" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synstructure" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-segmentation" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasm-bindgen" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasm-bindgen-webidl" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "web-sys" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", + "sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-webidl 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "weedle" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wio" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" +"checksum atk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "86b7499272acf036bb5820c6e346bbfb5acc5dceb104bc2c4fd7e6e33dfcde6a" +"checksum atk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067531f752c01027f004032bb676e715aba74b75e904a7340a61ce3fb0b61b0" +"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" +"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" +"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" +"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" +"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +"checksum boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" +"checksum bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd43d82f27d68911e6ee11ee791fb248f138f5d69424dc02e098d4f152b0b05" +"checksum cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e05db47de3b0f09a222fa4bba2eab957d920d4243962a86b2d77ab401e4a359c" +"checksum cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90a1ec04603a78c111886a385edcec396dbfbc57ea26b9e74aeea6a1fe55dcca" +"checksum cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "b548a4ee81fccb95919d4e22cfea83c7693ebfd78f0495493178db20b3139da7" +"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf79daa4e11e5def06e55306aa3601b87de6b5149671529318da048f67cdd77b" +"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" +"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" +"checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" +"checksum direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7fa6ff10857eb253d1ae16987ebfd27372f4129b0c7a3fa41466fbdf7e453e75" +"checksum direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "315aa929e68ba066cb6fb86f1b22af24f517e02fd9b5734c4d07e42cb9f4aefa" +"checksum directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8cdcd739e9351c411b8caf5cab32a27c818cfe06260595da121382ecdd22083d" +"checksum dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1639bbfd6765e92a40267d217a7acbac5b49320b68013f39a8e4376aa8c1e091" +"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f8140122fa0d5dcb9fc8627cfce2b37cc1500f752636d46ea28bc26785c2f9" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum gdk 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6243e995f41f3a61a31847e54cc719edce93dd9140c89dca3b9919be1cfe22d5" +"checksum gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9726408ee1bbada83094326a99b9c68fea275f9dbb515de242a69e72051f4fcc" +"checksum gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1d6778abf5764b9080a9345a16c5d16289426a3b3edd808a29a9061d431c465" +"checksum gdk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ebe06357212127f50575b535bdb04638f5d375bb41062287abc6c94e5b8067b" +"checksum gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6261b5d34c30c2d59f879e643704cf54cb44731f3a2038000b68790c03e360e3" +"checksum gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "778b856a70a32e2cc5dd5cc7fa1b0c4b6df924fdf5c82984bc28f30565657cfe" +"checksum glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91a70db179515473b57aaff8b879167f1f8460bc5523e97beacf6d1026a8b99d" +"checksum glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b86a9169fbc9cf9a0ef315039c2304b09d5c575c5fde7defba3576a0311b863" +"checksum gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61d55bc9202447ca776f6ad0048c36e3312010f66f82ab478e97513e93f3604b" +"checksum gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "709f1074259d4685b96133f92b75c7f35b504715b0fcdc96ec95de2607296a60" +"checksum gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bbd9395497ae1d1915d1d6e522d51ae8745bf613906c34ac191c411250fc4025" +"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +"checksum js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "da3ea71161651a4cd97d999b2da139109c537b15ab33abc8ae4ead38deac8a03" +"checksum kurbo 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e6076333105a72e8d2c227ba6a6da0dc3c8e5f53f02053f598a6087a1ea8991" +"checksum kurbo 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0caeb26248a62abf92dea93aad4f8244f54668e2f1060ed9cd9fd1d5545723" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)" = "c665266eb592905e8503ba3403020f4b8794d26263f412ca33171600eca9a6fa" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" +"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" +"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" +"checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1" +"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" +"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" +"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" +"checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d" +"checksum pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393fa071b144f8ffb83ede273758983cf414ca3c0b1d2a5a9ce325b3ba3dd786" +"checksum pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ee97abcad820f9875e032656257ad1c790e7b11a0e6ce2516a8f5b0d8f8213f" +"checksum piet 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "02e36470db0f6e8900c3f2d35ae137c96ebb726af2c070fc4369467ee57ab9bd" +"checksum piet-cairo 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1afd8ad4a74d1ef1591e0bad7f860841c5a0cab6edeb347fc67e2e37422c01df" +"checksum piet-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8e8cb78927118d65d350a677432e459d90ff72ea6fc875cf1ac1478d5570e196" +"checksum piet-direct2d 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ccea047f88a367ad86b2a972302070f0bf4183b51376ad840b9eb298f3bdafc1" +"checksum piet-web 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5f168f31a01eb3d0cc977258ae6b085f98d022f32b7e3edcdb4f565d912dcc60" +"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" +"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +"checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" +"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +"checksum wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "4de97fa1806bb1a99904216f6ac5e0c050dc4f8c676dc98775047c38e5c01b55" +"checksum wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "5d82c170ef9f5b2c63ad4460dfcee93f3ec04a9a36a4cc20bc973c39e59ab8e3" +"checksum wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f07d50f74bf7a738304f6b8157f4a581e1512cd9e9cdb5baad8c31bbe8ffd81d" +"checksum wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "95cf8fe77e45ba5f91bc8f3da0c3aa5d464b3d8ed85d84f4d4c7cc106436b1d7" +"checksum wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "d9c2d4d4756b2e46d3a5422e06277d02e4d3e1d62d138b76a4c681e925743623" +"checksum wasm-bindgen-webidl 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "24e47859b4eba3d3b9a5c2c299f9d6f8d0b613671315f6f0c5c7f835e524b36a" +"checksum web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "86d515d2f713d3a6ab198031d2181b7540f8e319e4637ec2d4a41a208335ef29" +"checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164" +"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index ddcd725890..1d9da270ca 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -32,7 +32,7 @@ use piet_common::{Piet, RenderContext}; use util::assert_main_thread; use win_main::with_application; -use crate::keyboard::{self, KeyCode, RawKeyCode, StrOrChar}; +use crate::keyboard; use crate::kurbo::{Point, Vec2}; use crate::platform::dialog::{FileDialogOptions, FileDialogType}; use crate::platform::menu::Menu; @@ -221,20 +221,12 @@ impl WindowBuilder { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); - let count = match button.get_event_type() { - gdk::EventType::ButtonPress => 1, - gdk::EventType::DoubleButtonPress => 2, - gdk::EventType::TripleButtonPress => 3, - _ => 0, - }; - - let pos = Point::from(button.get_position()); state.handler.borrow_mut().mouse_down( &window::MouseEvent { - pos, - count, - mods: gtk_modifiers_to_druid(button.get_state()), - button: gtk_button_to_druid(button.get_button()), + pos: Point::from(button.get_position()), + count: get_mouse_click_count(button.get_event_type()), + mods: get_modifiers(button.get_state()), + button: get_mouse_button(button.get_button()), }, &mut ctx, ); @@ -250,13 +242,12 @@ impl WindowBuilder { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); - let pos = Point::from(button.get_position()); state.handler.borrow_mut().mouse_up( &window::MouseEvent { - pos, - mods: gtk_modifiers_to_druid(button.get_state()), + pos: Point::from(button.get_position()), + mods: get_modifiers(button.get_state()), count: 0, - button: gtk_button_to_druid(button.get_button()), + button: get_mouse_button(button.get_button()), }, &mut ctx, ); @@ -275,9 +266,9 @@ impl WindowBuilder { let pos = Point::from(motion.get_position()); let mouse_event = window::MouseEvent { pos, - mods: gtk_modifiers_to_druid(motion.get_state()), + mods: get_modifiers(motion.get_state()), count: 0, - button: gtk_modifiers_to_mouse_button(motion.get_state()), + button: get_mouse_button_from_modifiers(motion.get_state()), }; state @@ -298,7 +289,7 @@ impl WindowBuilder { let _deltas = scroll.get_scroll_deltas(); // TODO use these deltas (for smooth scrolling) - let modifiers = gtk_modifiers_to_druid(scroll.get_state()); + let modifiers = get_modifiers(scroll.get_state()); // The magic "120"s are from Microsoft's documentation for WM_MOUSEWHEEL. // They claim that one "tick" on a scroll wheel should be 120 units. @@ -349,7 +340,7 @@ impl WindowBuilder { *current_keyval = Some(key.get_keyval()); - let key_event = gtk_event_key_to_key_event(key, repeat); + let key_event = make_key_event(key, repeat); state.handler.borrow_mut().key_down(key_event, &mut ctx); } @@ -365,7 +356,7 @@ impl WindowBuilder { *(state.current_keyval.borrow_mut()) = None; - let key_event = gtk_event_key_to_key_event(key, false); + let key_event = make_key_event(key, false); state.handler.borrow_mut().key_up(key_event, &mut ctx); } @@ -478,6 +469,7 @@ impl WindowHandle { } unsafe impl Send for IdleHandle {} +// WindowState needs to be Send + Sync so it can be passed into glib closures unsafe impl Send for WindowState {} unsafe impl Sync for WindowState {} @@ -578,6 +570,12 @@ fn time_interval_from_deadline(deadline: std::time::Instant) -> u32 { } } +fn next_timer_id() -> usize { + use std::sync::atomic::{AtomicUsize, Ordering}; + static TIMER_ID: AtomicUsize = AtomicUsize::new(1); + TIMER_ID.fetch_add(1, Ordering::Relaxed) +} + fn make_gdk_cursor(cursor: &Cursor, gdk_window: &gdk::Window) -> Option { gdk::Cursor::new_from_name( &gdk_window.get_display(), @@ -594,30 +592,18 @@ fn make_gdk_cursor(cursor: &Cursor, gdk_window: &gdk::Window) -> Option window::MouseButton { +fn get_mouse_button(button: u32) -> window::MouseButton { match button { 1 => MouseButton::Left, 2 => MouseButton::Middle, 3 => MouseButton::Right, 4 => MouseButton::X1, - _ => MouseButton::X2, + 5 => MouseButton::X2, + _ => MouseButton::Left, } } -/// Map the GTK modifiers into Druid bits -#[inline] -fn gtk_modifiers_to_druid(modifiers: gdk::ModifierType) -> keyboard::KeyModifiers { - keyboard::KeyModifiers { - shift: modifiers.contains(ModifierType::SHIFT_MASK), - alt: modifiers.contains(ModifierType::MOD1_MASK), - ctrl: modifiers.contains(ModifierType::CONTROL_MASK), - meta: modifiers.contains(ModifierType::META_MASK), - } -} - -fn gtk_modifiers_to_mouse_button(modifiers: gdk::ModifierType) -> window::MouseButton { +fn get_mouse_button_from_modifiers(modifiers: gdk::ModifierType) -> window::MouseButton { match modifiers { modifiers if modifiers.contains(ModifierType::BUTTON1_MASK) => MouseButton::Left, modifiers if modifiers.contains(ModifierType::BUTTON2_MASK) => MouseButton::Middle, @@ -631,7 +617,37 @@ fn gtk_modifiers_to_mouse_button(modifiers: gdk::ModifierType) -> window::MouseB } } -/// Map a hardware keycode to a keyval by looking up the keycode in the keymap +fn get_mouse_click_count(event_type: gdk::EventType) -> u32 { + match event_type { + gdk::EventType::ButtonPress => 1, + gdk::EventType::DoubleButtonPress => 2, + gdk::EventType::TripleButtonPress => 3, + _ => 0, + } +} + +fn get_modifiers(modifiers: gdk::ModifierType) -> keyboard::KeyModifiers { + keyboard::KeyModifiers { + shift: modifiers.contains(ModifierType::SHIFT_MASK), + alt: modifiers.contains(ModifierType::MOD1_MASK), + ctrl: modifiers.contains(ModifierType::CONTROL_MASK), + meta: modifiers.contains(ModifierType::META_MASK), + } +} + +fn make_key_event(key: &EventKey, repeat: bool) -> keyboard::KeyEvent { + let keyval = key.get_keyval(); + let hardware_keycode = key.get_hardware_keycode(); + + let keycode = hardware_keycode_to_keyval(hardware_keycode).unwrap_or(keyval); + + let text = gdk::keyval_to_unicode(keyval); + + keyboard::KeyEvent::new(keycode, repeat, get_modifiers(key.get_state()), text, text) +} + +/// Map a hardware keycode to a keyval by performing a lookup in the keymap and finding the +/// keyval with the lowest group and level fn hardware_keycode_to_keyval(keycode: u16) -> Option { unsafe { let keymap = gdk_sys::gdk_keymap_get_default(); @@ -671,136 +687,3 @@ fn hardware_keycode_to_keyval(keycode: u16) -> Option { } } } - -fn gtk_event_key_to_key_event(key: &EventKey, repeat: bool) -> keyboard::KeyEvent { - // the logical key being pressed - let keyval = key.get_keyval(); - - let hardware_keycode = key.get_hardware_keycode(); - let keycode = hardware_keycode_to_keyval(hardware_keycode).unwrap_or(keyval); - - // TODO how can we get the different versions from GDK? - let text: StrOrChar = gdk::keyval_to_unicode(keyval).into(); - // TODO properly handle modifiers - let unmodified_text: StrOrChar = gdk::keyval_to_unicode(keyval).into(); - - keyboard::KeyEvent::new( - keycode, - repeat, - gtk_modifiers_to_druid(key.get_state()), - text, - unmodified_text, - ) -} - -impl From for KeyCode { - #[allow(non_upper_case_globals)] - fn from(raw: u32) -> KeyCode { - use gdk::enums::key::*; - match raw { - a | A => KeyCode::KeyA, - s | S => KeyCode::KeyS, - d | D => KeyCode::KeyD, - f | F => KeyCode::KeyF, - h | H => KeyCode::KeyH, - g | G => KeyCode::KeyG, - z | Z => KeyCode::KeyZ, - x | X => KeyCode::KeyX, - c | C => KeyCode::KeyC, - v | V => KeyCode::KeyV, - b | B => KeyCode::KeyB, - q | Q => KeyCode::KeyQ, - w | W => KeyCode::KeyW, - e | E => KeyCode::KeyE, - r | R => KeyCode::KeyR, - y | Y => KeyCode::KeyY, - t | T => KeyCode::KeyT, - _1 => KeyCode::Key1, - _2 => KeyCode::Key2, - _3 => KeyCode::Key3, - _4 => KeyCode::Key4, - _6 => KeyCode::Key6, - _5 => KeyCode::Key5, - equal => KeyCode::Equals, - _9 => KeyCode::Key9, - _7 => KeyCode::Key7, - minus => KeyCode::Minus, - _8 => KeyCode::Key8, - _0 => KeyCode::Key0, - bracketright => KeyCode::RightBracket, - o | O => KeyCode::KeyO, - u | U => KeyCode::KeyU, - bracketleft => KeyCode::LeftBracket, - i | I => KeyCode::KeyI, - p | P => KeyCode::KeyP, - Return => KeyCode::Return, - l | L => KeyCode::KeyL, - j | J => KeyCode::KeyJ, - grave => KeyCode::Backtick, - k | K => KeyCode::KeyK, - semicolon => KeyCode::Semicolon, - backslash => KeyCode::Backslash, - comma => KeyCode::Comma, - slash => KeyCode::Slash, - n | N => KeyCode::KeyN, - m | M => KeyCode::KeyM, - period => KeyCode::Period, - Tab => KeyCode::Tab, - space => KeyCode::Space, - BackSpace => KeyCode::Backspace, - Escape => KeyCode::Escape, - Caps_Lock => KeyCode::CapsLock, - KP_Decimal => KeyCode::NumpadDecimal, - KP_Multiply => KeyCode::NumpadMultiply, - KP_Add => KeyCode::NumpadAdd, - Num_Lock => KeyCode::NumLock, - KP_Divide => KeyCode::NumpadDivide, - KP_Enter => KeyCode::NumpadEnter, - KP_Subtract => KeyCode::NumpadSubtract, - KP_Equal => KeyCode::NumpadEquals, - KP_0 => KeyCode::Numpad0, - KP_1 => KeyCode::Numpad1, - KP_2 => KeyCode::Numpad2, - KP_3 => KeyCode::Numpad3, - KP_4 => KeyCode::Numpad4, - KP_5 => KeyCode::Numpad5, - KP_6 => KeyCode::Numpad6, - KP_7 => KeyCode::Numpad7, - KP_8 => KeyCode::Numpad8, - KP_9 => KeyCode::Numpad9, - F5 => KeyCode::F5, - F6 => KeyCode::F6, - F7 => KeyCode::F7, - F3 => KeyCode::F3, - F8 => KeyCode::F8, - F9 => KeyCode::F9, - F10 => KeyCode::F10, - F11 => KeyCode::F11, - F12 => KeyCode::F12, - Insert => KeyCode::Insert, - Home => KeyCode::Home, - Page_Up => KeyCode::PageUp, - Delete => KeyCode::Delete, - F4 => KeyCode::F4, - End => KeyCode::End, - F2 => KeyCode::F2, - Page_Down => KeyCode::PageDown, - F1 => KeyCode::F1, - Left => KeyCode::ArrowLeft, - Right => KeyCode::ArrowRight, - Down => KeyCode::ArrowDown, - Up => KeyCode::ArrowUp, - quoteright => KeyCode::Quote, - _ => { - eprintln!("Warning: unknown keyval {}", raw); - KeyCode::Unknown(RawKeyCode::Linux(raw)) - } - } - } -} - -fn next_timer_id() -> usize { - use std::sync::atomic::{AtomicUsize, Ordering}; - static TIMER_ID: AtomicUsize = AtomicUsize::new(1); - TIMER_ID.fetch_add(1, Ordering::Relaxed) -} diff --git a/druid-shell/src/keyboard.rs b/druid-shell/src/keyboard.rs index 1912faf8a6..47eace74e9 100644 --- a/druid-shell/src/keyboard.rs +++ b/druid-shell/src/keyboard.rs @@ -531,6 +531,113 @@ impl From for KeyCode { } } +#[cfg(target_os = "linux")] +impl From for KeyCode { + #[allow(non_upper_case_globals)] + fn from(raw: u32) -> KeyCode { + use gdk::enums::key::*; + match raw { + a | A => KeyCode::KeyA, + s | S => KeyCode::KeyS, + d | D => KeyCode::KeyD, + f | F => KeyCode::KeyF, + h | H => KeyCode::KeyH, + g | G => KeyCode::KeyG, + z | Z => KeyCode::KeyZ, + x | X => KeyCode::KeyX, + c | C => KeyCode::KeyC, + v | V => KeyCode::KeyV, + b | B => KeyCode::KeyB, + q | Q => KeyCode::KeyQ, + w | W => KeyCode::KeyW, + e | E => KeyCode::KeyE, + r | R => KeyCode::KeyR, + y | Y => KeyCode::KeyY, + t | T => KeyCode::KeyT, + _1 => KeyCode::Key1, + _2 => KeyCode::Key2, + _3 => KeyCode::Key3, + _4 => KeyCode::Key4, + _6 => KeyCode::Key6, + _5 => KeyCode::Key5, + equal => KeyCode::Equals, + _9 => KeyCode::Key9, + _7 => KeyCode::Key7, + minus => KeyCode::Minus, + _8 => KeyCode::Key8, + _0 => KeyCode::Key0, + bracketright => KeyCode::RightBracket, + o | O => KeyCode::KeyO, + u | U => KeyCode::KeyU, + bracketleft => KeyCode::LeftBracket, + i | I => KeyCode::KeyI, + p | P => KeyCode::KeyP, + Return => KeyCode::Return, + l | L => KeyCode::KeyL, + j | J => KeyCode::KeyJ, + grave => KeyCode::Backtick, + k | K => KeyCode::KeyK, + semicolon => KeyCode::Semicolon, + backslash => KeyCode::Backslash, + comma => KeyCode::Comma, + slash => KeyCode::Slash, + n | N => KeyCode::KeyN, + m | M => KeyCode::KeyM, + period => KeyCode::Period, + Tab => KeyCode::Tab, + space => KeyCode::Space, + BackSpace => KeyCode::Backspace, + Escape => KeyCode::Escape, + Caps_Lock => KeyCode::CapsLock, + KP_Decimal => KeyCode::NumpadDecimal, + KP_Multiply => KeyCode::NumpadMultiply, + KP_Add => KeyCode::NumpadAdd, + Num_Lock => KeyCode::NumLock, + KP_Divide => KeyCode::NumpadDivide, + KP_Enter => KeyCode::NumpadEnter, + KP_Subtract => KeyCode::NumpadSubtract, + KP_Equal => KeyCode::NumpadEquals, + KP_0 => KeyCode::Numpad0, + KP_1 => KeyCode::Numpad1, + KP_2 => KeyCode::Numpad2, + KP_3 => KeyCode::Numpad3, + KP_4 => KeyCode::Numpad4, + KP_5 => KeyCode::Numpad5, + KP_6 => KeyCode::Numpad6, + KP_7 => KeyCode::Numpad7, + KP_8 => KeyCode::Numpad8, + KP_9 => KeyCode::Numpad9, + F5 => KeyCode::F5, + F6 => KeyCode::F6, + F7 => KeyCode::F7, + F3 => KeyCode::F3, + F8 => KeyCode::F8, + F9 => KeyCode::F9, + F10 => KeyCode::F10, + F11 => KeyCode::F11, + F12 => KeyCode::F12, + Insert => KeyCode::Insert, + Home => KeyCode::Home, + Page_Up => KeyCode::PageUp, + Delete => KeyCode::Delete, + F4 => KeyCode::F4, + End => KeyCode::End, + F2 => KeyCode::F2, + Page_Down => KeyCode::PageDown, + F1 => KeyCode::F1, + Left => KeyCode::ArrowLeft, + Right => KeyCode::ArrowRight, + Down => KeyCode::ArrowDown, + Up => KeyCode::ArrowUp, + quoteright => KeyCode::Quote, + _ => { + eprintln!("Warning: unknown keyval {}", raw); + KeyCode::Unknown(RawKeyCode::Linux(raw)) + } + } + } +} + /// Should realistically be (8 * N) - 1; we need one byte for the length. const TINY_STR_CAPACITY: usize = 15; From be73afc9dc4ea3d19063ee482dbbe2c2d4fb8942 Mon Sep 17 00:00:00 2001 From: Steven Van Bael Date: Sun, 18 Aug 2019 11:52:53 +0200 Subject: [PATCH 42/78] GTK: Add use_gtk feature --- Cargo.toml | 3 +++ druid-shell/Cargo.toml | 12 ++++++++++++ druid-shell/src/keyboard.rs | 2 +- druid-shell/src/lib.rs | 24 ++++++++++++------------ 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index eb943b5ddd..2549bca387 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,9 @@ edition = "2018" [package.metadata.docs.rs] default-target = "x86_64-pc-windows-msvc" +[features] +use_gtk = ["druid-shell/use_gtk"] + [badges] travis-ci = { repository = "xi-editor/druid" } diff --git a/druid-shell/Cargo.toml b/druid-shell/Cargo.toml index 5e90b937a5..9ba741f278 100644 --- a/druid-shell/Cargo.toml +++ b/druid-shell/Cargo.toml @@ -8,6 +8,9 @@ repository = "https://github.com/xi-editor/druid" categories = ["os::macos-apis", "os::windows-apis", "gui"] edition = "2018" +[features] +use_gtk = ["gtk", "gio", "gdk", "gdk-sys", "glib", "glib-sys", "cairo-rs"] + [package.metadata.docs.rs] default-target = "x86_64-pc-windows-msvc" @@ -17,6 +20,15 @@ piet-common = "0.0.6" lazy_static = "1.0" time = "0.1.39" +cairo-rs = { version = "0.7.1", default_features = false, optional = true } +gio = { version = "0.7.0", optional = true } +gdk = { version = "0.11.0", optional = true } +gdk-sys = { version = "0.9.0", optional = true } +gtk = { version = "0.7.0", optional = true } +glib = { version = "0.8.1", optional = true } +glib-sys = { version = "0.9.0", optional = true } + + [target.'cfg(target_os="windows")'.dependencies] directwrite = "0.1.2" direct2d = "0.2.0" diff --git a/druid-shell/src/keyboard.rs b/druid-shell/src/keyboard.rs index 47eace74e9..c2fcb9f7ec 100644 --- a/druid-shell/src/keyboard.rs +++ b/druid-shell/src/keyboard.rs @@ -531,7 +531,7 @@ impl From for KeyCode { } } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", feature = "use_gtk"))] impl From for KeyCode { #[allow(non_upper_case_globals)] fn from(raw: u32) -> KeyCode { diff --git a/druid-shell/src/lib.rs b/druid-shell/src/lib.rs index 561da5bfe9..e0bb28bb86 100644 --- a/druid-shell/src/lib.rs +++ b/druid-shell/src/lib.rs @@ -25,15 +25,15 @@ extern crate winapi; #[macro_use] extern crate objc; -#[cfg(target_os = "linux")] +#[cfg(any(feature = "use_gtk", target_os = "linux"))] extern crate cairo; -#[cfg(target_os = "linux")] +#[cfg(any(feature = "use_gtk", target_os = "linux"))] extern crate gdk; -#[cfg(target_os = "linux")] +#[cfg(any(feature = "use_gtk", target_os = "linux"))] extern crate gio; -#[cfg(target_os = "linux")] +#[cfg(any(feature = "use_gtk", target_os = "linux"))] extern crate glib; -#[cfg(target_os = "linux")] +#[cfg(any(feature = "use_gtk", target_os = "linux"))] extern crate gtk as gtkrs; #[macro_use] @@ -44,21 +44,21 @@ pub mod keyboard; pub mod keycodes; pub mod window; -#[cfg(target_os = "windows")] +#[cfg(all(target_os = "windows", not(feature = "use_gtk")))] pub mod windows; -#[cfg(target_os = "windows")] +#[cfg(all(target_os = "windows", not(feature = "use_gtk")))] pub use windows as platform; -#[cfg(target_os = "windows")] +#[cfg(all(target_os = "windows", not(feature = "use_gtk")))] pub use windows::paint; -#[cfg(target_os = "macos")] +#[cfg(all(target_os = "macos", not(feature = "use_gtk")))] pub mod mac; -#[cfg(target_os = "macos")] +#[cfg(all(target_os = "macos", not(feature = "use_gtk")))] pub use mac as platform; -#[cfg(target_os = "linux")] +#[cfg(any(feature = "use_gtk", target_os = "linux"))] pub mod gtk; -#[cfg(target_os = "linux")] +#[cfg(any(feature = "use_gtk", target_os = "linux"))] pub use crate::gtk as platform; pub use error::Error; From 70fb879e3927f41098332b15a92edae58eba5655 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Fri, 13 Sep 2019 17:03:37 +0200 Subject: [PATCH 43/78] Fix typo --- druid-shell/src/gtk/menu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index 64d453f90c..70619af42b 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -135,7 +135,7 @@ fn modifiers_to_gdk_modifier_type(modifiers: Modifiers) -> gdk::ModifierType { result } -/// Strip the access keys from the menu strong. +/// Strip the access keys from the menu string. /// /// Changes "E&xit" to "Exit". Actual ampersands are escaped as "&&". fn strip_access_key(raw_menu_text: &str) -> String { From 1e75f88ca858aa2cdc959f0e5bd009502ff51d30 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Fri, 13 Sep 2019 17:23:26 +0200 Subject: [PATCH 44/78] Only include objc crate if macos and not gtk --- druid-shell/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/druid-shell/src/lib.rs b/druid-shell/src/lib.rs index e0bb28bb86..7c7b63ac24 100644 --- a/druid-shell/src/lib.rs +++ b/druid-shell/src/lib.rs @@ -21,7 +21,7 @@ pub use piet_common::kurbo; #[macro_use] extern crate winapi; -#[cfg(target_os = "macos")] +#[cfg(all(target_os = "macos", not(feature = "use_gtk")))] #[macro_use] extern crate objc; @@ -36,7 +36,6 @@ extern crate glib; #[cfg(any(feature = "use_gtk", target_os = "linux"))] extern crate gtk as gtkrs; -#[macro_use] extern crate lazy_static; pub mod error; From 74e47c12104297ee2439240f29e52ecd6b8959b7 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Fri, 13 Sep 2019 17:27:25 +0200 Subject: [PATCH 45/78] Formatting --- druid-shell/src/gtk/dialog.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/druid-shell/src/gtk/dialog.rs b/druid-shell/src/gtk/dialog.rs index d5cf60a1a8..57aabc1610 100644 --- a/druid-shell/src/gtk/dialog.rs +++ b/druid-shell/src/gtk/dialog.rs @@ -60,10 +60,7 @@ pub(crate) fn get_file_dialog_path( Some(path) => Ok(path.into_os_string()), None => Err(Error::Null), }, - ResponseType::DeleteEvent => { - // dialog was closed - Err(Error::Null) - } + ResponseType::DeleteEvent => Err(Error::Null), _ => { eprintln!("Unhandled dialog result: {:?}", result); Err(Error::Null) From b784064307fc8c8c70b63786ac43284c6e27c9f1 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Fri, 13 Sep 2019 17:28:26 +0200 Subject: [PATCH 46/78] Use rust 2018 dyn syntax --- druid-shell/src/gtk/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 1d9da270ca..8617c1e6b1 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -52,7 +52,7 @@ pub struct WindowHandle { /// Builder abstraction for creating new windows pub struct WindowBuilder { - handler: Option>, + handler: Option>, title: String, menu: Option, } @@ -65,11 +65,11 @@ pub struct IdleHandle { // TODO: move this out of platform-dependent section. trait IdleCallback: Send { - fn call(self: Box, a: &Any); + fn call(self: Box, a: &dyn Any); } -impl IdleCallback for F { - fn call(self: Box, a: &Any) { +impl IdleCallback for F { + fn call(self: Box, a: &dyn Any) { (*self)(a) } } @@ -95,7 +95,7 @@ impl WindowBuilder { } } - pub fn set_handler(&mut self, handler: Box) { + pub fn set_handler(&mut self, handler: Box) { self.handler = Some(handler); } @@ -482,7 +482,7 @@ impl IdleHandle { /// priority than other UI events, but that's not necessarily the case. pub fn add_idle(&self, callback: F) where - F: FnOnce(&Any) + Send + 'static, + F: FnOnce(&dyn Any) + Send + 'static, { let mut queue = self.idle_queue.lock().unwrap(); if let Some(state) = self.state.upgrade() { From 0954dd91654dd38a498fdb64d4ac9b7e167cf580 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sat, 14 Sep 2019 15:26:01 +0200 Subject: [PATCH 47/78] lazy_static is needed on mac --- druid-shell/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/druid-shell/src/lib.rs b/druid-shell/src/lib.rs index 7c7b63ac24..8597473944 100644 --- a/druid-shell/src/lib.rs +++ b/druid-shell/src/lib.rs @@ -36,6 +36,8 @@ extern crate glib; #[cfg(any(feature = "use_gtk", target_os = "linux"))] extern crate gtk as gtkrs; +#[cfg(all(target_os = "macos", not(feature = "use_gtk")))] +#[macro_use] extern crate lazy_static; pub mod error; From 74dbae20ab185519797e5b26524e9858b71f64bb Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sat, 14 Sep 2019 15:43:03 +0200 Subject: [PATCH 48/78] Lazy static is needed on windows --- druid-shell/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/druid-shell/src/lib.rs b/druid-shell/src/lib.rs index 8597473944..6c715055b5 100644 --- a/druid-shell/src/lib.rs +++ b/druid-shell/src/lib.rs @@ -36,7 +36,7 @@ extern crate glib; #[cfg(any(feature = "use_gtk", target_os = "linux"))] extern crate gtk as gtkrs; -#[cfg(all(target_os = "macos", not(feature = "use_gtk")))] +#[cfg(all(not(feature = "use_gtk")))] #[macro_use] extern crate lazy_static; From 055d7ac01dbac9b1a8a90a9135a0559757196b98 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sat, 14 Sep 2019 16:13:34 +0200 Subject: [PATCH 49/78] Change Error::Null to ::Other(str) --- druid-shell/src/error.rs | 4 ++-- druid-shell/src/gtk/dialog.rs | 6 +++--- druid-shell/src/gtk/mod.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/druid-shell/src/error.rs b/druid-shell/src/error.rs index 429fb83940..b0bd275843 100644 --- a/druid-shell/src/error.rs +++ b/druid-shell/src/error.rs @@ -22,7 +22,7 @@ use winapi::shared::winerror::HRESULT; /// Error codes. At the moment, this is little more than HRESULT, but that /// might change. pub enum Error { - Null, + Other(&'static str), #[cfg(target_os = "windows")] Hr(HRESULT), // Maybe include the full error from the direct2d crate. @@ -36,7 +36,7 @@ pub enum Error { impl fmt::Debug for Error { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - Error::Null => write!(f, "Null error"), + Error::Other(s) => write!(f, "{}", s), #[cfg(target_os = "windows")] Error::Hr(hr) => write!(f, "HRESULT 0x{:x}", hr), #[cfg(target_os = "windows")] diff --git a/druid-shell/src/gtk/dialog.rs b/druid-shell/src/gtk/dialog.rs index 57aabc1610..dedad3489f 100644 --- a/druid-shell/src/gtk/dialog.rs +++ b/druid-shell/src/gtk/dialog.rs @@ -58,12 +58,12 @@ pub(crate) fn get_file_dialog_path( let result = match result { ResponseType::Accept => match dialog.get_filename() { Some(path) => Ok(path.into_os_string()), - None => Err(Error::Null), + None => Err(Error::Other("No path received for filename")), }, - ResponseType::DeleteEvent => Err(Error::Null), + ResponseType::DeleteEvent => Err(Error::Other("Dialog was deleted")), _ => { eprintln!("Unhandled dialog result: {:?}", result); - Err(Error::Null) + Err(Error::Other("Unhandled dialog result")) } }; diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 8617c1e6b1..2de4384e79 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -463,7 +463,7 @@ impl WindowHandle { if let Some(state) = self.state.upgrade() { dialog::get_file_dialog_path(state.window.upcast_ref(), ty, options) } else { - Err(Error::Null) + Err(Error::Other("Cannot upgrade state from weak pointer to arc")) } } } From c3f79f70b0a1c0e54eb77d75890718174bc49881 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sat, 14 Sep 2019 16:18:27 +0200 Subject: [PATCH 50/78] Rustfmt --- druid-shell/src/gtk/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 2de4384e79..0e97f67dfa 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -463,7 +463,9 @@ impl WindowHandle { if let Some(state) = self.state.upgrade() { dialog::get_file_dialog_path(state.window.upcast_ref(), ty, options) } else { - Err(Error::Other("Cannot upgrade state from weak pointer to arc")) + Err(Error::Other( + "Cannot upgrade state from weak pointer to arc", + )) } } } From 18abc2b71754d4f65863e09bf67fe46af18ce641 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sat, 14 Sep 2019 16:23:01 +0200 Subject: [PATCH 51/78] Change Error::Null to ::Other(str) on windows too --- druid-shell/src/windows/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/druid-shell/src/windows/mod.rs b/druid-shell/src/windows/mod.rs index 428bfe9d23..b4b74dfbe9 100644 --- a/druid-shell/src/windows/mod.rs +++ b/druid-shell/src/windows/mod.rs @@ -798,7 +798,7 @@ impl WindowBuilder { }; let class_atom = RegisterClassW(&wnd); if class_atom == 0 { - return Err(Error::Null); + return Err(Error::Other("class_atom == 0")); } let dwrite_factory = directwrite::Factory::new().unwrap(); @@ -859,7 +859,7 @@ impl WindowBuilder { win.clone(), ); if hwnd.is_null() { - return Err(Error::Null); + return Err(Error::Other("hwnd.is_null() == true")); } let dcomp_state = create_dcomp_state(self.present_strategy, hwnd).unwrap_or_else(|e| { @@ -1115,7 +1115,7 @@ impl WindowHandle { ty: FileDialogType, options: FileDialogOptions, ) -> Result { - let hwnd = self.get_hwnd().ok_or(Error::Null)?; + let hwnd = self.get_hwnd().ok_or(Error::Other("get_hwnd() is None"))?; unsafe { get_file_dialog_path(hwnd, ty, options) } } From 51be8650204c54b5d7a4a27a69bcfeae104da966 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sat, 14 Sep 2019 22:09:28 +0200 Subject: [PATCH 52/78] Use clone! macro for gtk callbacks --- druid-shell/src/gtk/mod.rs | 67 ++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 0e97f67dfa..88d697a723 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -45,6 +45,24 @@ pub mod menu; pub mod util; pub mod win_main; +macro_rules! clone { + (@param _) => ( _ ); + (@param $x:ident) => ( $x ); + ($($n:ident),+ => move || $body:expr) => ( + { + $( let $n = $n.clone(); )+ + move || $body + } + ); + ($($n:ident),+ => move |$($p:tt),+| $body:expr) => ( + { + $( let $n = $n.clone(); )+ + move |$(clone!(@param $p),)+| $body + } + ); +} + + #[derive(Clone, Default)] pub struct WindowHandle { state: Weak, @@ -129,13 +147,12 @@ impl WindowBuilder { current_keyval: RefCell::new(None), }); - let state = win_state.clone(); - win_state.window.connect_destroy(move |_| { + win_state.window.connect_destroy(clone!(win_state => move |_| { // this ties a clone of Arc to the ApplicationWindow to keep it alive // when the ApplicationWindow is destroyed, the last Arc is dropped // and any Weak will be None on upgrade() - let _ = &state; - }); + let _ = &win_state; + })); let handle = WindowHandle { state: Arc::downgrade(&win_state), @@ -170,9 +187,8 @@ impl WindowBuilder { { let last_size = Cell::new((0, 0)); - let handle = handle.clone(); - drawing_area.connect_draw(move |widget, context| { + drawing_area.connect_draw(clone!(handle => move |widget, context| { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); @@ -212,12 +228,11 @@ impl WindowBuilder { } Inhibit(false) - }); + })); } { - let handle = handle.clone(); - drawing_area.connect_button_press_event(move |_widget, button| { + drawing_area.connect_button_press_event(clone!(handle => move |_widget, button| { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); @@ -233,12 +248,11 @@ impl WindowBuilder { } Inhibit(true) - }); + })); } { - let handle = handle.clone(); - drawing_area.connect_button_release_event(move |_widget, button| { + drawing_area.connect_button_release_event(clone!(handle => move |_widget, button| { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); @@ -254,12 +268,11 @@ impl WindowBuilder { } Inhibit(true) - }); + })); } { - let handle = handle.clone(); - drawing_area.connect_motion_notify_event(move |_widget, motion| { + drawing_area.connect_motion_notify_event(clone!(handle=>move |_widget, motion| { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); @@ -278,12 +291,11 @@ impl WindowBuilder { } Inhibit(true) - }); + })); } { - let handle = handle.clone(); - drawing_area.connect_scroll_event(move |_widget, scroll| { + drawing_area.connect_scroll_event(clone!(handle => move |_widget, scroll| { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); @@ -326,12 +338,11 @@ impl WindowBuilder { } Inhibit(true) - }); + })); } { - let handle = handle.clone(); - drawing_area.connect_key_press_event(move |_widget, key| { + drawing_area.connect_key_press_event(clone!(handle => move |_widget, key| { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); @@ -345,12 +356,11 @@ impl WindowBuilder { } Inhibit(true) - }); + })); } { - let handle = handle.clone(); - drawing_area.connect_key_release_event(move |_widget, key| { + drawing_area.connect_key_release_event(clone!(handle => move |_widget, key| { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); @@ -361,17 +371,16 @@ impl WindowBuilder { } Inhibit(true) - }); + })); } { - let handle = handle.clone(); - drawing_area.connect_destroy(move |_widget| { + drawing_area.connect_destroy(clone!(handle => move |_widget| { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); state.handler.borrow_mut().destroy(&mut ctx); } - }); + })); } vbox.pack_end(&drawing_area, true, true, 0); @@ -689,3 +698,5 @@ fn hardware_keycode_to_keyval(keycode: u16) -> Option { } } } + + From 54bdf47fd203d9876cf2cd00391ef5e2fcce2151 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sat, 14 Sep 2019 22:13:34 +0200 Subject: [PATCH 53/78] Rustfmt --- druid-shell/src/gtk/mod.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 88d697a723..767f971873 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -62,7 +62,6 @@ macro_rules! clone { ); } - #[derive(Clone, Default)] pub struct WindowHandle { state: Weak, @@ -147,12 +146,14 @@ impl WindowBuilder { current_keyval: RefCell::new(None), }); - win_state.window.connect_destroy(clone!(win_state => move |_| { - // this ties a clone of Arc to the ApplicationWindow to keep it alive - // when the ApplicationWindow is destroyed, the last Arc is dropped - // and any Weak will be None on upgrade() - let _ = &win_state; - })); + win_state + .window + .connect_destroy(clone!(win_state => move |_| { + // this ties a clone of Arc to the ApplicationWindow to keep it alive + // when the ApplicationWindow is destroyed, the last Arc is dropped + // and any Weak will be None on upgrade() + let _ = &win_state; + })); let handle = WindowHandle { state: Arc::downgrade(&win_state), @@ -698,5 +699,3 @@ fn hardware_keycode_to_keyval(keycode: u16) -> Option { } } } - - From af3c45f2390af0423357efab01c128285e072b19 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sat, 14 Sep 2019 22:32:09 +0200 Subject: [PATCH 54/78] Remove drawing test code --- druid-shell/src/gtk/mod.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 767f971873..820ac9c8b7 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -204,14 +204,6 @@ impl WindowBuilder { state.handler.borrow_mut().size(size.0, size.1, &mut ctx); } - context.set_source_rgb(0.0, 0.0, 0.0); - context.paint(); - - context.set_source_rgb(1.0, 0.0, 0.0); - context.rectangle(0.0, 0.0, 100.0, 100.0); - - context.fill(); - // For some reason piet needs a mutable context, so give it one I guess. let mut context = context.clone(); let mut piet_context = Piet::new(&mut context); From b7456e79db173403b74fdbead767a092aae2c2b1 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sat, 14 Sep 2019 23:32:03 +0200 Subject: [PATCH 55/78] Implement gtk menu separator and use it in example --- druid-shell/examples/hello.rs | 1 + druid-shell/src/gtk/menu.rs | 81 ++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 39 deletions(-) diff --git a/druid-shell/examples/hello.rs b/druid-shell/examples/hello.rs index a93388d057..571d2f73bd 100644 --- a/druid-shell/examples/hello.rs +++ b/druid-shell/examples/hello.rs @@ -116,6 +116,7 @@ fn main() { let mut file_menu = Menu::new(); file_menu.add_item(0x100, "E&xit", MenuKey::std_quit()); + file_menu.add_separator(); file_menu.add_item(0x101, "O&pen", MenuKey::command('o')); file_menu.add_item(0x102, "S&ave", MenuKey::command('s')); let mut menubar = Menu::new(); diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index 70619af42b..8e6dd5a9bd 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -20,7 +20,7 @@ use gtkrs::GtkMenuExt; use gtkrs::Menu as GtkMenu; use gtkrs::MenuBar as GtkMenuBar; use gtkrs::MenuItem as GtkMenuItem; -use gtkrs::{GtkMenuItemExt, MenuShellExt, WidgetExt}; +use gtkrs::{GtkMenuItemExt, MenuShellExt, SeparatorMenuItemBuilder, WidgetExt}; use crate::gtk::WinCtxImpl; use crate::keycodes::{KeySpec, MenuKey}; @@ -35,35 +35,7 @@ pub struct Menu { enum MenuItem { Entry(String, u32, MenuKey), SubMenu(String, Menu), -} - -impl MenuItem { - fn into_gtk_menu_item(self, handle: &WindowHandle, accel_group: &AccelGroup) -> GtkMenuItem { - match self { - MenuItem::Entry(name, id, key) => { - let item = GtkMenuItem::new_with_label(&name); - - register_accelerator(&item, accel_group, key); - - let handle = handle.clone(); - item.connect_activate(move |_| { - let mut ctx = WinCtxImpl::from(&handle); - - if let Some(state) = handle.state.upgrade() { - state.handler.borrow_mut().command(id, &mut ctx); - } - }); - - item - } - MenuItem::SubMenu(name, submenu) => { - let item = GtkMenuItem::new_with_label(&name); - item.set_submenu(Some(&submenu.into_gtk_menu(handle, accel_group))); - - item - } - } - } + Separator, } impl Menu { @@ -83,7 +55,42 @@ impl Menu { } pub fn add_separator(&mut self) { - eprintln!("Warning: GTK separators are not yet implemented"); + self.items.push(MenuItem::Separator) + } + + fn append_items_to_menu>( + self, + menu: &mut M, + handle: &WindowHandle, + accel_group: &AccelGroup, + ) { + for item in self.items { + match item { + MenuItem::Entry(name, id, key) => { + let item = GtkMenuItem::new_with_label(&name); + + register_accelerator(&item, accel_group, key); + + let handle = handle.clone(); + item.connect_activate(move |_| { + let mut ctx = WinCtxImpl::from(&handle); + + if let Some(state) = handle.state.upgrade() { + state.handler.borrow_mut().command(id, &mut ctx); + } + }); + + menu.append(&item); + } + MenuItem::SubMenu(name, submenu) => { + let item = GtkMenuItem::new_with_label(&name); + item.set_submenu(Some(&submenu.into_gtk_menu(handle, accel_group))); + + menu.append(&item); + } + MenuItem::Separator => menu.append(&SeparatorMenuItemBuilder::new().build()), + } + } } pub(crate) fn into_gtk_menubar( @@ -91,22 +98,18 @@ impl Menu { handle: &WindowHandle, accel_group: &AccelGroup, ) -> GtkMenuBar { - let menu = GtkMenuBar::new(); + let mut menu = GtkMenuBar::new(); - for item in self.items { - menu.append(&item.into_gtk_menu_item(handle, accel_group)); - } + self.append_items_to_menu(&mut menu, handle, accel_group); menu } fn into_gtk_menu(self, handle: &WindowHandle, accel_group: &AccelGroup) -> GtkMenu { - let menu = GtkMenu::new(); + let mut menu = GtkMenu::new(); menu.set_accel_group(Some(accel_group)); - for item in self.items { - menu.append(&item.into_gtk_menu_item(handle, accel_group)); - } + self.append_items_to_menu(&mut menu, handle, accel_group); menu } From cb862972d6dfb64fe5d6f6aaaac0a58ff3b7c572 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sun, 15 Sep 2019 00:25:58 +0200 Subject: [PATCH 56/78] Use FileChoserNative instead of FileChooserDialog --- Cargo.lock | 1 + druid-shell/Cargo.lock | 1 + druid-shell/Cargo.toml | 7 ++++- druid-shell/src/gtk/dialog.rs | 57 +++++++++-------------------------- 4 files changed, 23 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d625b09953..0c7e8f8f0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -203,6 +203,7 @@ dependencies = [ "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "piet-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/druid-shell/Cargo.lock b/druid-shell/Cargo.lock index a3d6bcc988..5a03cec6ff 100644 --- a/druid-shell/Cargo.lock +++ b/druid-shell/Cargo.lock @@ -196,6 +196,7 @@ dependencies = [ "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "gtk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "kurbo 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/druid-shell/Cargo.toml b/druid-shell/Cargo.toml index 9ba741f278..c161a69163 100644 --- a/druid-shell/Cargo.toml +++ b/druid-shell/Cargo.toml @@ -27,6 +27,7 @@ gdk-sys = { version = "0.9.0", optional = true } gtk = { version = "0.7.0", optional = true } glib = { version = "0.8.1", optional = true } glib-sys = { version = "0.9.0", optional = true } +gtk-sys = { version = "0.9.0", optional = true } [target.'cfg(target_os="windows")'.dependencies] @@ -49,9 +50,13 @@ cairo-rs = { version = "0.7.1", default_features = false } gio = "0.7.0" gdk = "0.11.0" gdk-sys = "0.9.0" -gtk = "0.7.0" glib = "0.8.1" glib-sys = "0.9.0" +gtk-sys = "0.9.0" + +[target.'cfg(target_os="linux")'.dependencies.gtk] +version = "0.7.0" +features = ["v3_20"] [dev-dependencies] kurbo = "0.2.1" diff --git a/druid-shell/src/gtk/dialog.rs b/druid-shell/src/gtk/dialog.rs index dedad3489f..6945582152 100644 --- a/druid-shell/src/gtk/dialog.rs +++ b/druid-shell/src/gtk/dialog.rs @@ -16,10 +16,7 @@ use std::ffi::OsString; -use gtkrs::{ - DialogExt, FileChooserAction, FileChooserDialog, FileChooserExt, ResponseType, WidgetExt, - Window, -}; +use gtkrs::{FileChooserAction, FileChooserExt, NativeDialogExt, Window}; use crate::Error; @@ -48,19 +45,28 @@ pub(crate) fn get_file_dialog_path( ty: FileDialogType, options: FileDialogOptions, ) -> Result { - let dialog = match ty { - FileDialogType::Open => build_open_dialog(window, options), - FileDialogType::Save => build_save_dialog(window, options), + let (title, action) = match ty { + FileDialogType::Open => ("Open File", FileChooserAction::Open), + FileDialogType::Save => ("Save File", FileChooserAction::Save), }; + let dialog = gtkrs::FileChooserNativeBuilder::new() + .transient_for(window) + .title(title) + .build(); + + dialog.set_action(action); + + dialog.set_show_hidden(options.show_hidden); + let result = dialog.run(); let result = match result { - ResponseType::Accept => match dialog.get_filename() { + gtk_sys::GTK_RESPONSE_ACCEPT => match dialog.get_filename() { Some(path) => Ok(path.into_os_string()), None => Err(Error::Other("No path received for filename")), }, - ResponseType::DeleteEvent => Err(Error::Other("Dialog was deleted")), + gtk_sys::GTK_RESPONSE_CANCEL => Err(Error::Other("Dialog was deleted")), _ => { eprintln!("Unhandled dialog result: {:?}", result); Err(Error::Other("Unhandled dialog result")) @@ -73,36 +79,3 @@ pub(crate) fn get_file_dialog_path( result } - -// TODO DRY this up -fn build_open_dialog(window: &Window, options: FileDialogOptions) -> FileChooserDialog { - let dialog = gtk::FileChooserDialogBuilder::new() - .transient_for(window) - .title("Open File") - .build(); - - dialog.set_action(FileChooserAction::Open); - - dialog.add_button("Open", ResponseType::Accept); - dialog.add_button("Cancel", ResponseType::Cancel); - - dialog.set_show_hidden(options.show_hidden); - - dialog -} - -fn build_save_dialog(window: &Window, options: FileDialogOptions) -> FileChooserDialog { - let dialog = gtk::FileChooserDialogBuilder::new() - .transient_for(window) - .title("Save File") - .build(); - - dialog.set_action(FileChooserAction::Save); - - dialog.add_button("Save", ResponseType::Accept); - dialog.add_button("Cancel", ResponseType::Cancel); - - dialog.set_show_hidden(options.show_hidden); - - dialog -} From 79a80df5a625f578b0fe5abab7e993b100eb538b Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sun, 15 Sep 2019 12:39:28 +0200 Subject: [PATCH 57/78] Replace destroy signal with shutdown --- druid-shell/src/gtk/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 820ac9c8b7..cbd311b059 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -24,6 +24,7 @@ use std::slice; use std::sync::{Arc, Mutex, Weak}; use gdk::{EventKey, EventMask, ModifierType, ScrollDirection, WindowExt}; +use gio::ApplicationExt; use gtk::{ AccelGroup, ApplicationWindow, BoxExt, Cast, ContainerExt, GtkApplicationExt, GtkWindowExt, Inhibit, WidgetExt, WidgetExtManual, @@ -146,14 +147,14 @@ impl WindowBuilder { current_keyval: RefCell::new(None), }); - win_state - .window - .connect_destroy(clone!(win_state => move |_| { + with_application(|app| { + app.connect_shutdown(clone!(win_state => move |_| { // this ties a clone of Arc to the ApplicationWindow to keep it alive // when the ApplicationWindow is destroyed, the last Arc is dropped // and any Weak will be None on upgrade() let _ = &win_state; - })); + })) + }); let handle = WindowHandle { state: Arc::downgrade(&win_state), From 5695a43609183732716df057349586b51acc6314 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Mon, 16 Sep 2019 16:40:06 +0200 Subject: [PATCH 58/78] Move strip_access_key to common_utils --- druid-shell/src/common_util.rs | 20 ++++++++++++++++++++ druid-shell/src/gtk/menu.rs | 21 +-------------------- druid-shell/src/lib.rs | 2 ++ druid-shell/src/mac/menu.rs | 22 ++-------------------- 4 files changed, 25 insertions(+), 40 deletions(-) create mode 100644 druid-shell/src/common_util.rs diff --git a/druid-shell/src/common_util.rs b/druid-shell/src/common_util.rs new file mode 100644 index 0000000000..2f35c7c070 --- /dev/null +++ b/druid-shell/src/common_util.rs @@ -0,0 +1,20 @@ +/// Strip the access keys from the menu string. +/// +/// Changes "E&xit" to "Exit". Actual ampersands are escaped as "&&". +pub fn strip_access_key(raw_menu_text: &str) -> String { + // TODO this is copied from mac/menu.rs maybe this should be moved somewhere common? + let mut saw_ampersand = false; + let mut result = String::new(); + for c in raw_menu_text.chars() { + if c == '&' { + if saw_ampersand { + result.push(c); + } + saw_ampersand = !saw_ampersand; + } else { + result.push(c); + saw_ampersand = false; + } + } + result +} diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index 8e6dd5a9bd..8ecf93e5bd 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -26,6 +26,7 @@ use crate::gtk::WinCtxImpl; use crate::keycodes::{KeySpec, MenuKey}; use crate::keycodes::{Modifiers, M_ALT, M_CTRL, M_META, M_SHIFT}; use crate::platform::WindowHandle; +use crate::common_util::{strip_access_key}; #[derive(Default)] pub struct Menu { @@ -138,23 +139,3 @@ fn modifiers_to_gdk_modifier_type(modifiers: Modifiers) -> gdk::ModifierType { result } -/// Strip the access keys from the menu string. -/// -/// Changes "E&xit" to "Exit". Actual ampersands are escaped as "&&". -fn strip_access_key(raw_menu_text: &str) -> String { - // TODO this is copied from mac/menu.rs maybe this should be moved somewhere common? - let mut saw_ampersand = false; - let mut result = String::new(); - for c in raw_menu_text.chars() { - if c == '&' { - if saw_ampersand { - result.push(c); - } - saw_ampersand = !saw_ampersand; - } else { - result.push(c); - saw_ampersand = false; - } - } - result -} diff --git a/druid-shell/src/lib.rs b/druid-shell/src/lib.rs index 6c715055b5..7dfe7517c9 100644 --- a/druid-shell/src/lib.rs +++ b/druid-shell/src/lib.rs @@ -71,3 +71,5 @@ pub use platform::util; pub use platform::win_main as runloop; // TODO: rename to "runloop" pub use platform::WindowBuilder; pub use util::init; + +mod common_util; diff --git a/druid-shell/src/mac/menu.rs b/druid-shell/src/mac/menu.rs index bf3a85fd99..92fa3bbfd5 100644 --- a/druid-shell/src/mac/menu.rs +++ b/druid-shell/src/mac/menu.rs @@ -23,6 +23,8 @@ use objc::runtime::{Class, Object, Sel}; use crate::keycodes::{KeySpec, MenuKey}; use crate::util::make_nsstring; +use crate::common_util::{strip_access_key}; + struct MenuItemProxyClass(*const Class); unsafe impl Sync for MenuItemProxyClass {} @@ -59,26 +61,6 @@ fn make_key_equivalent(key: impl Into) -> String { } } -/// Strip the access keys from the menu strong. -/// -/// Changes "E&xit" to "Exit". Actual ampersands are escaped as "&&". -fn strip_access_key(raw_menu_text: &str) -> String { - let mut saw_ampersand = false; - let mut result = String::new(); - for c in raw_menu_text.chars() { - if c == '&' { - if saw_ampersand { - result.push(c); - } - saw_ampersand = !saw_ampersand; - } else { - result.push(c); - saw_ampersand = false; - } - } - result -} - fn make_basic_menu_item(_id: u32, text: &str, key: impl Into) -> id { let key_equivalent = make_key_equivalent(key); let stripped_text = strip_access_key(text); From c42ad2e40176a4b89a47830d58a9adcfc94a300d Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Mon, 16 Sep 2019 16:46:57 +0200 Subject: [PATCH 59/78] Rustfmt --- druid-shell/src/gtk/menu.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index 8ecf93e5bd..be74acf378 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -22,11 +22,11 @@ use gtkrs::MenuBar as GtkMenuBar; use gtkrs::MenuItem as GtkMenuItem; use gtkrs::{GtkMenuItemExt, MenuShellExt, SeparatorMenuItemBuilder, WidgetExt}; +use crate::common_util::strip_access_key; use crate::gtk::WinCtxImpl; use crate::keycodes::{KeySpec, MenuKey}; use crate::keycodes::{Modifiers, M_ALT, M_CTRL, M_META, M_SHIFT}; use crate::platform::WindowHandle; -use crate::common_util::{strip_access_key}; #[derive(Default)] pub struct Menu { @@ -138,4 +138,3 @@ fn modifiers_to_gdk_modifier_type(modifiers: Modifiers) -> gdk::ModifierType { result } - From 20c088e417b84beabd1041814e06db2c09cf1908 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Mon, 16 Sep 2019 17:11:46 +0200 Subject: [PATCH 60/78] Rustfmt #2 --- druid-shell/src/mac/menu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/druid-shell/src/mac/menu.rs b/druid-shell/src/mac/menu.rs index 92fa3bbfd5..a8fa58f813 100644 --- a/druid-shell/src/mac/menu.rs +++ b/druid-shell/src/mac/menu.rs @@ -23,7 +23,7 @@ use objc::runtime::{Class, Object, Sel}; use crate::keycodes::{KeySpec, MenuKey}; use crate::util::make_nsstring; -use crate::common_util::{strip_access_key}; +use crate::common_util::strip_access_key; struct MenuItemProxyClass(*const Class); unsafe impl Sync for MenuItemProxyClass {} From 067253b8b0766315de3a724a7a3cdc9bc846bcc4 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Tue, 24 Sep 2019 16:04:11 +0200 Subject: [PATCH 61/78] Remove superflous blocks --- druid-shell/src/gtk/mod.rs | 304 ++++++++++++++++++------------------- 1 file changed, 144 insertions(+), 160 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index cbd311b059..c3162c274b 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -187,195 +187,179 @@ impl WindowBuilder { Inhibit(true) }); - { - let last_size = Cell::new((0, 0)); + let last_size = Cell::new((0, 0)); - drawing_area.connect_draw(clone!(handle => move |widget, context| { - if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl::from(&handle); + drawing_area.connect_draw(clone!(handle => move |widget, context| { + if let Some(state) = handle.state.upgrade() { + let mut ctx = WinCtxImpl::from(&handle); - let extents = context.clip_extents(); - let size = ( - (extents.2 - extents.0) as u32, - (extents.3 - extents.1) as u32, - ); + let extents = context.clip_extents(); + let size = ( + (extents.2 - extents.0) as u32, + (extents.3 - extents.1) as u32, + ); - if last_size.get() != size { - last_size.set(size); - state.handler.borrow_mut().size(size.0, size.1, &mut ctx); - } + if last_size.get() != size { + last_size.set(size); + state.handler.borrow_mut().size(size.0, size.1, &mut ctx); + } - // For some reason piet needs a mutable context, so give it one I guess. - let mut context = context.clone(); - let mut piet_context = Piet::new(&mut context); - let anim = state - .handler - .borrow_mut() - .paint(&mut piet_context, &mut ctx); - if let Err(e) = piet_context.finish() { - eprintln!("piet error on render: {:?}", e); - } + // For some reason piet needs a mutable context, so give it one I guess. + let mut context = context.clone(); + let mut piet_context = Piet::new(&mut context); + let anim = state + .handler + .borrow_mut() + .paint(&mut piet_context, &mut ctx); + if let Err(e) = piet_context.finish() { + eprintln!("piet error on render: {:?}", e); + } - if anim { - widget.queue_draw(); - } + if anim { + widget.queue_draw(); } + } - Inhibit(false) - })); - } + Inhibit(false) + })); - { - drawing_area.connect_button_press_event(clone!(handle => move |_widget, button| { - if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl::from(&handle); - - state.handler.borrow_mut().mouse_down( - &window::MouseEvent { - pos: Point::from(button.get_position()), - count: get_mouse_click_count(button.get_event_type()), - mods: get_modifiers(button.get_state()), - button: get_mouse_button(button.get_button()), - }, - &mut ctx, - ); - } + drawing_area.connect_button_press_event(clone!(handle => move |_widget, button| { + if let Some(state) = handle.state.upgrade() { + let mut ctx = WinCtxImpl::from(&handle); - Inhibit(true) - })); - } + state.handler.borrow_mut().mouse_down( + &window::MouseEvent { + pos: Point::from(button.get_position()), + count: get_mouse_click_count(button.get_event_type()), + mods: get_modifiers(button.get_state()), + button: get_mouse_button(button.get_button()), + }, + &mut ctx, + ); + } - { - drawing_area.connect_button_release_event(clone!(handle => move |_widget, button| { - if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl::from(&handle); - - state.handler.borrow_mut().mouse_up( - &window::MouseEvent { - pos: Point::from(button.get_position()), - mods: get_modifiers(button.get_state()), - count: 0, - button: get_mouse_button(button.get_button()), - }, - &mut ctx, - ); - } + Inhibit(true) + })); - Inhibit(true) - })); - } + drawing_area.connect_button_release_event(clone!(handle => move |_widget, button| { + if let Some(state) = handle.state.upgrade() { + let mut ctx = WinCtxImpl::from(&handle); - { - drawing_area.connect_motion_notify_event(clone!(handle=>move |_widget, motion| { - if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl::from(&handle); - - let pos = Point::from(motion.get_position()); - let mouse_event = window::MouseEvent { - pos, - mods: get_modifiers(motion.get_state()), + state.handler.borrow_mut().mouse_up( + &window::MouseEvent { + pos: Point::from(button.get_position()), + mods: get_modifiers(button.get_state()), count: 0, - button: get_mouse_button_from_modifiers(motion.get_state()), - }; + button: get_mouse_button(button.get_button()), + }, + &mut ctx, + ); + } - state - .handler - .borrow_mut() - .mouse_move(&mouse_event, &mut ctx); - } + Inhibit(true) + })); - Inhibit(true) - })); - } + drawing_area.connect_motion_notify_event(clone!(handle=>move |_widget, motion| { + if let Some(state) = handle.state.upgrade() { + let mut ctx = WinCtxImpl::from(&handle); - { - drawing_area.connect_scroll_event(clone!(handle => move |_widget, scroll| { - if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl::from(&handle); - - let _deltas = scroll.get_scroll_deltas(); - // TODO use these deltas (for smooth scrolling) - let modifiers = get_modifiers(scroll.get_state()); - - // The magic "120"s are from Microsoft's documentation for WM_MOUSEWHEEL. - // They claim that one "tick" on a scroll wheel should be 120 units. - // GTK simply reports the direction - let mut handler = state.handler.borrow_mut(); - match scroll.get_direction() { - ScrollDirection::Up => { - handler.wheel(Vec2::from((0.0, -120.0)), modifiers, &mut ctx); - } - ScrollDirection::Down => { - handler.wheel(Vec2::from((0.0, 120.0)), modifiers, &mut ctx); - } - ScrollDirection::Left => { - // Note: this direction is just a guess, I (bobtwinkles) don't - // have a way to test horizontal scroll events under GTK. - // If it's wrong, the right direction also needs to be changed - handler.wheel(Vec2::from((120.0, 0.0)), modifiers, &mut ctx); - } - ScrollDirection::Right => { - handler.wheel(-Vec2::from((-120.0, 0.0)), modifiers, &mut ctx); - } - ScrollDirection::Smooth => { - eprintln!( - "Warning: somehow the Druid widget got a smooth scroll event" - ); - } - e => { - eprintln!( - "Warning: the Druid widget got some whacky scroll direction {:?}", - e - ); - } + let pos = Point::from(motion.get_position()); + let mouse_event = window::MouseEvent { + pos, + mods: get_modifiers(motion.get_state()), + count: 0, + button: get_mouse_button_from_modifiers(motion.get_state()), + }; + + state + .handler + .borrow_mut() + .mouse_move(&mouse_event, &mut ctx); + } + + Inhibit(true) + })); + + drawing_area.connect_scroll_event(clone!(handle => move |_widget, scroll| { + if let Some(state) = handle.state.upgrade() { + let mut ctx = WinCtxImpl::from(&handle); + + let _deltas = scroll.get_scroll_deltas(); + // TODO use these deltas (for smooth scrolling) + let modifiers = get_modifiers(scroll.get_state()); + + // The magic "120"s are from Microsoft's documentation for WM_MOUSEWHEEL. + // They claim that one "tick" on a scroll wheel should be 120 units. + // GTK simply reports the direction + let mut handler = state.handler.borrow_mut(); + match scroll.get_direction() { + ScrollDirection::Up => { + handler.wheel(Vec2::from((0.0, -120.0)), modifiers, &mut ctx); + } + ScrollDirection::Down => { + handler.wheel(Vec2::from((0.0, 120.0)), modifiers, &mut ctx); + } + ScrollDirection::Left => { + // Note: this direction is just a guess, I (bobtwinkles) don't + // have a way to test horizontal scroll events under GTK. + // If it's wrong, the right direction also needs to be changed + handler.wheel(Vec2::from((120.0, 0.0)), modifiers, &mut ctx); + } + ScrollDirection::Right => { + handler.wheel(-Vec2::from((-120.0, 0.0)), modifiers, &mut ctx); + } + ScrollDirection::Smooth => { + eprintln!( + "Warning: somehow the Druid widget got a smooth scroll event" + ); + } + e => { + eprintln!( + "Warning: the Druid widget got some whacky scroll direction {:?}", + e + ); } } + } - Inhibit(true) - })); - } + Inhibit(true) + })); - { - drawing_area.connect_key_press_event(clone!(handle => move |_widget, key| { - if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl::from(&handle); + drawing_area.connect_key_press_event(clone!(handle => move |_widget, key| { + if let Some(state) = handle.state.upgrade() { + let mut ctx = WinCtxImpl::from(&handle); - let mut current_keyval = state.current_keyval.borrow_mut(); - let repeat = *current_keyval == Some(key.get_keyval()); + let mut current_keyval = state.current_keyval.borrow_mut(); + let repeat = *current_keyval == Some(key.get_keyval()); - *current_keyval = Some(key.get_keyval()); + *current_keyval = Some(key.get_keyval()); - let key_event = make_key_event(key, repeat); - state.handler.borrow_mut().key_down(key_event, &mut ctx); - } + let key_event = make_key_event(key, repeat); + state.handler.borrow_mut().key_down(key_event, &mut ctx); + } - Inhibit(true) - })); - } + Inhibit(true) + })); - { - drawing_area.connect_key_release_event(clone!(handle => move |_widget, key| { - if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl::from(&handle); + drawing_area.connect_key_release_event(clone!(handle => move |_widget, key| { + if let Some(state) = handle.state.upgrade() { + let mut ctx = WinCtxImpl::from(&handle); - *(state.current_keyval.borrow_mut()) = None; + *(state.current_keyval.borrow_mut()) = None; - let key_event = make_key_event(key, false); - state.handler.borrow_mut().key_up(key_event, &mut ctx); - } + let key_event = make_key_event(key, false); + state.handler.borrow_mut().key_up(key_event, &mut ctx); + } - Inhibit(true) - })); - } + Inhibit(true) + })); - { - drawing_area.connect_destroy(clone!(handle => move |_widget| { - if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl::from(&handle); - state.handler.borrow_mut().destroy(&mut ctx); - } - })); - } + drawing_area.connect_destroy(clone!(handle => move |_widget| { + if let Some(state) = handle.state.upgrade() { + let mut ctx = WinCtxImpl::from(&handle); + state.handler.borrow_mut().destroy(&mut ctx); + } + })); vbox.pack_end(&drawing_area, true, true, 0); From 8387aa2012bc21ddc8d6682b47c8793871e3b828 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Tue, 24 Sep 2019 16:06:18 +0200 Subject: [PATCH 62/78] Add copyright and top level docs --- druid-shell/src/common_util.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/druid-shell/src/common_util.rs b/druid-shell/src/common_util.rs index 2f35c7c070..d16cfc7019 100644 --- a/druid-shell/src/common_util.rs +++ b/druid-shell/src/common_util.rs @@ -1,3 +1,19 @@ +// Copyright 2019 The xi-editor Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Common functions used by the backends + /// Strip the access keys from the menu string. /// /// Changes "E&xit" to "Exit". Actual ampersands are escaped as "&&". From 2e2d7358f3cb50c15d8afc61dfa688e3c27e47ea Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Tue, 24 Sep 2019 16:08:28 +0200 Subject: [PATCH 63/78] Add dialog message localization todo --- druid-shell/src/gtk/dialog.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/druid-shell/src/gtk/dialog.rs b/druid-shell/src/gtk/dialog.rs index 6945582152..38c0a3e1d0 100644 --- a/druid-shell/src/gtk/dialog.rs +++ b/druid-shell/src/gtk/dialog.rs @@ -45,6 +45,7 @@ pub(crate) fn get_file_dialog_path( ty: FileDialogType, options: FileDialogOptions, ) -> Result { + // TODO: support message localization let (title, action) = match ty { FileDialogType::Open => ("Open File", FileChooserAction::Open), FileDialogType::Save => ("Save File", FileChooserAction::Save), From fd621fa2d486c0c1d9780f24e31b55ca627a2cd4 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Tue, 24 Sep 2019 16:15:16 +0200 Subject: [PATCH 64/78] Document clone! macro --- druid-shell/src/gtk/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index c3162c274b..191022206c 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -46,6 +46,19 @@ pub mod menu; pub mod util; pub mod win_main; +/// Taken from https://gtk-rs.org/docs-src/tutorial/closures +/// It is used to reduce the boilerplate of setting up gtk callbacks +/// Example: +/// ``` +/// button.connect_clicked(clone!(handle => move |_| { ... })) +/// ``` +/// is equivalent to: +/// ``` +/// { +/// let handle = handle.clone(); +/// button.connect_clicked(move |_| { ... }) +/// } +/// ``` macro_rules! clone { (@param _) => ( _ ); (@param $x:ident) => ( $x ); From 0757e5f0d0c646b3ecadd3c573ff64c9b8890bbd Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Tue, 24 Sep 2019 16:40:46 +0200 Subject: [PATCH 65/78] Update scroll event callback comments --- druid-shell/src/gtk/mod.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 191022206c..5ac2e933c3 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -297,13 +297,10 @@ impl WindowBuilder { if let Some(state) = handle.state.upgrade() { let mut ctx = WinCtxImpl::from(&handle); - let _deltas = scroll.get_scroll_deltas(); - // TODO use these deltas (for smooth scrolling) let modifiers = get_modifiers(scroll.get_state()); // The magic "120"s are from Microsoft's documentation for WM_MOUSEWHEEL. // They claim that one "tick" on a scroll wheel should be 120 units. - // GTK simply reports the direction let mut handler = state.handler.borrow_mut(); match scroll.get_direction() { ScrollDirection::Up => { @@ -322,6 +319,7 @@ impl WindowBuilder { handler.wheel(-Vec2::from((-120.0, 0.0)), modifiers, &mut ctx); } ScrollDirection::Smooth => { + // TODO: support smooth scrolling via scroll.get_delta and get_is_stop eprintln!( "Warning: somehow the Druid widget got a smooth scroll event" ); From 7ef6e90021f1cbf5e78de7fb6ddb80ee4ad06aad Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sat, 5 Oct 2019 20:20:12 +0200 Subject: [PATCH 66/78] Fix BorrowMutError --- druid-shell/src/gtk/mod.rs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 5ac2e933c3..62e87c97b1 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -220,17 +220,19 @@ impl WindowBuilder { // For some reason piet needs a mutable context, so give it one I guess. let mut context = context.clone(); let mut piet_context = Piet::new(&mut context); - let anim = state - .handler - .borrow_mut() - .paint(&mut piet_context, &mut ctx); - if let Err(e) = piet_context.finish() { - eprintln!("piet error on render: {:?}", e); - } - if anim { - widget.queue_draw(); + if let Ok(mut handler_borrow) = state.handler.try_borrow_mut() { + let anim = handler_borrow + .paint(&mut piet_context, &mut ctx); + if let Err(e) = piet_context.finish() { + eprintln!("piet error on render: {:?}", e); + } + + if anim { + widget.queue_draw(); + } } + } Inhibit(false) @@ -538,14 +540,13 @@ impl<'a> WinCtx<'a> for WinCtxImpl<'a> { gdk::threads_add_timeout(interval, move || { if let Some(state) = handle.state.upgrade() { - let mut ctx = WinCtxImpl::from(&handle); - - state - .handler - .borrow_mut() - .timer(TimerToken::new(token), &mut ctx); + if let Ok(mut handler_borrow) = state.handler.try_borrow_mut() { + let mut ctx = WinCtxImpl::from(&handle); + handler_borrow.timer(TimerToken::new(token), &mut ctx); + return false; + } } - false + true }); TimerToken::new(token) From 3bab041aba709d1773aa7362b5aedc769adb4a49 Mon Sep 17 00:00:00 2001 From: matt rice Date: Sat, 5 Oct 2019 19:37:32 -0700 Subject: [PATCH 67/78] Sort gtk key -> druid keycode from impl according to the order of druid's KeyCode enum. --- druid-shell/src/keyboard.rs | 114 ++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/druid-shell/src/keyboard.rs b/druid-shell/src/keyboard.rs index c2fcb9f7ec..a4f3e94717 100644 --- a/druid-shell/src/keyboard.rs +++ b/druid-shell/src/keyboard.rs @@ -537,99 +537,99 @@ impl From for KeyCode { fn from(raw: u32) -> KeyCode { use gdk::enums::key::*; match raw { - a | A => KeyCode::KeyA, - s | S => KeyCode::KeyS, - d | D => KeyCode::KeyD, - f | F => KeyCode::KeyF, - h | H => KeyCode::KeyH, - g | G => KeyCode::KeyG, - z | Z => KeyCode::KeyZ, - x | X => KeyCode::KeyX, - c | C => KeyCode::KeyC, - v | V => KeyCode::KeyV, - b | B => KeyCode::KeyB, - q | Q => KeyCode::KeyQ, - w | W => KeyCode::KeyW, - e | E => KeyCode::KeyE, - r | R => KeyCode::KeyR, - y | Y => KeyCode::KeyY, - t | T => KeyCode::KeyT, + Escape => KeyCode::Escape, + grave => KeyCode::Backtick, + _0 => KeyCode::Key0, _1 => KeyCode::Key1, _2 => KeyCode::Key2, _3 => KeyCode::Key3, _4 => KeyCode::Key4, - _6 => KeyCode::Key6, _5 => KeyCode::Key5, - equal => KeyCode::Equals, - _9 => KeyCode::Key9, + _6 => KeyCode::Key6, _7 => KeyCode::Key7, - minus => KeyCode::Minus, _8 => KeyCode::Key8, - _0 => KeyCode::Key0, - bracketright => KeyCode::RightBracket, - o | O => KeyCode::KeyO, + _9 => KeyCode::Key9, + minus => KeyCode::Minus, + equal => KeyCode::Equals, + BackSpace => KeyCode::Backspace, + Tab => KeyCode::Tab, + q | Q => KeyCode::KeyQ, + w | W => KeyCode::KeyW, + e | E => KeyCode::KeyE, + r | R => KeyCode::KeyR, + t | T => KeyCode::KeyT, + y | Y => KeyCode::KeyY, u | U => KeyCode::KeyU, - bracketleft => KeyCode::LeftBracket, i | I => KeyCode::KeyI, + o | O => KeyCode::KeyO, p | P => KeyCode::KeyP, + bracketleft => KeyCode::LeftBracket, + bracketright => KeyCode::RightBracket, Return => KeyCode::Return, - l | L => KeyCode::KeyL, + a | A => KeyCode::KeyA, + s | S => KeyCode::KeyS, + d | D => KeyCode::KeyD, + f | F => KeyCode::KeyF, + g | G => KeyCode::KeyG, + h | H => KeyCode::KeyH, j | J => KeyCode::KeyJ, - grave => KeyCode::Backtick, k | K => KeyCode::KeyK, + l | L => KeyCode::KeyL, semicolon => KeyCode::Semicolon, + quoteright => KeyCode::Quote, backslash => KeyCode::Backslash, - comma => KeyCode::Comma, - slash => KeyCode::Slash, + z | Z => KeyCode::KeyZ, + x | X => KeyCode::KeyX, + c | C => KeyCode::KeyC, + v | V => KeyCode::KeyV, + b | B => KeyCode::KeyB, n | N => KeyCode::KeyN, m | M => KeyCode::KeyM, + comma => KeyCode::Comma, period => KeyCode::Period, - Tab => KeyCode::Tab, + slash => KeyCode::Slash, space => KeyCode::Space, - BackSpace => KeyCode::Backspace, - Escape => KeyCode::Escape, Caps_Lock => KeyCode::CapsLock, - KP_Decimal => KeyCode::NumpadDecimal, - KP_Multiply => KeyCode::NumpadMultiply, - KP_Add => KeyCode::NumpadAdd, - Num_Lock => KeyCode::NumLock, - KP_Divide => KeyCode::NumpadDivide, - KP_Enter => KeyCode::NumpadEnter, - KP_Subtract => KeyCode::NumpadSubtract, - KP_Equal => KeyCode::NumpadEquals, - KP_0 => KeyCode::Numpad0, - KP_1 => KeyCode::Numpad1, - KP_2 => KeyCode::Numpad2, - KP_3 => KeyCode::Numpad3, - KP_4 => KeyCode::Numpad4, - KP_5 => KeyCode::Numpad5, - KP_6 => KeyCode::Numpad6, - KP_7 => KeyCode::Numpad7, - KP_8 => KeyCode::Numpad8, - KP_9 => KeyCode::Numpad9, + F1 => KeyCode::F1, + F2 => KeyCode::F2, + F3 => KeyCode::F3, + F4 => KeyCode::F4, F5 => KeyCode::F5, F6 => KeyCode::F6, F7 => KeyCode::F7, - F3 => KeyCode::F3, F8 => KeyCode::F8, F9 => KeyCode::F9, F10 => KeyCode::F10, F11 => KeyCode::F11, F12 => KeyCode::F12, Insert => KeyCode::Insert, - Home => KeyCode::Home, - Page_Up => KeyCode::PageUp, Delete => KeyCode::Delete, - F4 => KeyCode::F4, + Home => KeyCode::Home, End => KeyCode::End, - F2 => KeyCode::F2, + Page_Up => KeyCode::PageUp, Page_Down => KeyCode::PageDown, - F1 => KeyCode::F1, + KP_0 => KeyCode::Numpad0, + KP_1 => KeyCode::Numpad1, + KP_2 => KeyCode::Numpad2, + KP_3 => KeyCode::Numpad3, + KP_4 => KeyCode::Numpad4, + KP_5 => KeyCode::Numpad5, + KP_6 => KeyCode::Numpad6, + KP_7 => KeyCode::Numpad7, + KP_8 => KeyCode::Numpad8, + KP_9 => KeyCode::Numpad9, + KP_Equal => KeyCode::NumpadEquals, + KP_Subtract => KeyCode::NumpadSubtract, + KP_Add => KeyCode::NumpadAdd, + KP_Decimal => KeyCode::NumpadDecimal, + KP_Multiply => KeyCode::NumpadMultiply, + KP_Divide => KeyCode::NumpadDivide, + Num_Lock => KeyCode::NumLock, + KP_Enter => KeyCode::NumpadEnter, Left => KeyCode::ArrowLeft, Right => KeyCode::ArrowRight, Down => KeyCode::ArrowDown, Up => KeyCode::ArrowUp, - quoteright => KeyCode::Quote, _ => { eprintln!("Warning: unknown keyval {}", raw); KeyCode::Unknown(RawKeyCode::Linux(raw)) From c1bf4dfb0b6f248b9ae12324d1fcae1a81eda0b2 Mon Sep 17 00:00:00 2001 From: matt rice Date: Sat, 5 Oct 2019 19:47:48 -0700 Subject: [PATCH 68/78] Gtk: from() Add missing keys, and group by key row, remove a FIXME that was fixed already. --- druid-shell/src/keyboard.rs | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/druid-shell/src/keyboard.rs b/druid-shell/src/keyboard.rs index a4f3e94717..669e96448e 100644 --- a/druid-shell/src/keyboard.rs +++ b/druid-shell/src/keyboard.rs @@ -174,7 +174,6 @@ pub enum KeyCode { LeftMeta, RightMeta, - //FIXME: support lshift/rshift etc? Space, CapsLock, F1, @@ -552,6 +551,7 @@ impl From for KeyCode { minus => KeyCode::Minus, equal => KeyCode::Equals, BackSpace => KeyCode::Backspace, + Tab => KeyCode::Tab, q | Q => KeyCode::KeyQ, w | W => KeyCode::KeyW, @@ -566,6 +566,7 @@ impl From for KeyCode { bracketleft => KeyCode::LeftBracket, bracketright => KeyCode::RightBracket, Return => KeyCode::Return, + a | A => KeyCode::KeyA, s | S => KeyCode::KeyS, d | D => KeyCode::KeyD, @@ -578,6 +579,7 @@ impl From for KeyCode { semicolon => KeyCode::Semicolon, quoteright => KeyCode::Quote, backslash => KeyCode::Backslash, + z | Z => KeyCode::KeyZ, x | X => KeyCode::KeyX, c | C => KeyCode::KeyC, @@ -588,6 +590,16 @@ impl From for KeyCode { comma => KeyCode::Comma, period => KeyCode::Period, slash => KeyCode::Slash, + + Control_L => KeyCode::LeftControl, + Control_R => KeyCode::RightControl, + Alt_L => KeyCode::LeftAlt, + Alt_R => KeyCode::RightAlt, + Shift_L => KeyCode::LeftShift, + Shift_R => KeyCode::RightShift, + Meta_L => KeyCode::LeftMeta, + Meta_R => KeyCode::RightMeta, + space => KeyCode::Space, Caps_Lock => KeyCode::CapsLock, F1 => KeyCode::F1, @@ -602,12 +614,19 @@ impl From for KeyCode { F10 => KeyCode::F10, F11 => KeyCode::F11, F12 => KeyCode::F12, + + Print => KeyCode::PrintScreen, + Scroll_Lock => KeyCode::ScrollLock, + // Pause/Break not audio. + Pause => KeyCode::Pause, + Insert => KeyCode::Insert, Delete => KeyCode::Delete, Home => KeyCode::Home, End => KeyCode::End, Page_Up => KeyCode::PageUp, Page_Down => KeyCode::PageDown, + KP_0 => KeyCode::Numpad0, KP_1 => KeyCode::Numpad1, KP_2 => KeyCode::Numpad2, @@ -618,6 +637,7 @@ impl From for KeyCode { KP_7 => KeyCode::Numpad7, KP_8 => KeyCode::Numpad8, KP_9 => KeyCode::Numpad9, + KP_Equal => KeyCode::NumpadEquals, KP_Subtract => KeyCode::NumpadSubtract, KP_Add => KeyCode::NumpadAdd, @@ -626,10 +646,11 @@ impl From for KeyCode { KP_Divide => KeyCode::NumpadDivide, Num_Lock => KeyCode::NumLock, KP_Enter => KeyCode::NumpadEnter, + + Up => KeyCode::ArrowUp, + Down => KeyCode::ArrowDown, Left => KeyCode::ArrowLeft, Right => KeyCode::ArrowRight, - Down => KeyCode::ArrowDown, - Up => KeyCode::ArrowUp, _ => { eprintln!("Warning: unknown keyval {}", raw); KeyCode::Unknown(RawKeyCode::Linux(raw)) From 80abc3a5d6bbb9c1b381675096f23e76618fe4f5 Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Mon, 7 Oct 2019 12:35:35 -0400 Subject: [PATCH 69/78] Add ubuntu to ci test matrix --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79f7350f2e..a91d723393 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macOS-10.14, windows-2019] + os: [macOS-10.14, windows-2019, ubuntu-latest] name: cargo check stable steps: - uses: actions/checkout@v1 @@ -54,7 +54,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macOS-10.14, windows-2019] + os: [macOS-10.14, windows-2019, ubuntu-latest] name: rustfmt steps: - uses: actions/checkout@v1 @@ -86,7 +86,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macOS-10.14, windows-2019] + os: [macOS-10.14, windows-2019, ubuntu-latest] name: cargo test stable steps: - uses: actions/checkout@v1 @@ -119,7 +119,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macOS-10.14, windows-2019] + os: [macOS-10.14, windows-2019, ubuntu-latest] name: cargo test nightly steps: - uses: actions/checkout@v1 From aa52b8d789aa9be33bc7d820973f7b7aae219776 Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Mon, 21 Oct 2019 18:41:59 -0400 Subject: [PATCH 70/78] Install libgtk-dev in ci --- .github/workflows/ci.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a91d723393..53f0f71067 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,12 @@ jobs: run: brew install cairo if: contains(matrix.os, 'mac') + - name: install libgtk-dev + run: | + sudo apt update + sudo apt install libgtk-3-dev + if: contains(matrix.os, 'ubuntu') + - name: install stable toolchain uses: actions-rs/toolchain@v1 with: @@ -95,6 +101,12 @@ jobs: run: brew install cairo if: contains(matrix.os, 'mac') + - name: install libgtk-dev + run: | + sudo apt update + sudo apt install libgtk-3-dev + if: contains(matrix.os, 'ubuntu') + - name: install stable toolchain uses: actions-rs/toolchain@v1 with: @@ -128,6 +140,12 @@ jobs: run: brew install cairo if: contains(matrix.os, 'mac') + - name: install libgtk-dev + run: | + sudo apt update + sudo apt install libgtk-3-dev + if: contains(matrix.os, 'ubuntu') + - name: install nightly toolchain uses: actions-rs/toolchain@v1 with: From 731c8f6a9fe3871c482c5dd5f87afbd6046d664c Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Tue, 8 Oct 2019 21:59:01 +0200 Subject: [PATCH 71/78] Implement get_clipboard_contents --- druid-shell/src/gtk/application.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/druid-shell/src/gtk/application.rs b/druid-shell/src/gtk/application.rs index bec596484f..891f8819ed 100644 --- a/druid-shell/src/gtk/application.rs +++ b/druid-shell/src/gtk/application.rs @@ -14,10 +14,24 @@ //! GTK implementation of features at the application scope. +use crate::clipboard::ClipboardItem; + pub struct Application; impl Application { pub fn quit() { // Nothing to do: if this is called, we're already shutting down and GTK will pick it up (I hope?) } + + pub fn get_clipboard_contents() -> Option { + let display = gdk::Display::get_default().unwrap(); + let clipboard = gtk::Clipboard::get_default(&display).unwrap(); + + if let Some(gstring) = clipboard.wait_for_text() { + // TODO: does gstring need to be freed? + Some(ClipboardItem::Text(gstring.to_string())) + } else { + None + } + } } From 34e430d6e72eb751e645aa3f9ea19b8be42776cb Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Tue, 8 Oct 2019 21:59:27 +0200 Subject: [PATCH 72/78] Implement get_locale --- druid-shell/src/gtk/util.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/druid-shell/src/gtk/util.rs b/druid-shell/src/gtk/util.rs index 231ef33c9f..c2329c51c6 100644 --- a/druid-shell/src/gtk/util.rs +++ b/druid-shell/src/gtk/util.rs @@ -21,3 +21,8 @@ pub fn init() { pub fn assert_main_thread() { assert!(gtk::is_initialized_main_thread()); } + +pub fn get_locale() -> String { + //TODO ahem + "en-US".into() +} From 15ebeeb1f5b52235a6f2a0c64d0e67a57dd5ce18 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Tue, 8 Oct 2019 22:01:16 +0200 Subject: [PATCH 73/78] Implement set_clipboard_contents, open_file_sync --- druid-shell/src/gtk/dialog.rs | 15 ++----------- druid-shell/src/gtk/mod.rs | 41 ++++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/druid-shell/src/gtk/dialog.rs b/druid-shell/src/gtk/dialog.rs index 38c0a3e1d0..e970b0d649 100644 --- a/druid-shell/src/gtk/dialog.rs +++ b/druid-shell/src/gtk/dialog.rs @@ -16,6 +16,7 @@ use std::ffi::OsString; +use crate::dialog::FileDialogOptions; use gtkrs::{FileChooserAction, FileChooserExt, NativeDialogExt, Window}; use crate::Error; @@ -28,19 +29,7 @@ pub enum FileDialogType { Save, } -/// Options for file dialog. -#[derive(Default)] -pub struct FileDialogOptions { - show_hidden: bool, -} - -impl FileDialogOptions { - pub fn set_show_hidden(&mut self) { - self.show_hidden = true - } -} - -pub(crate) fn get_file_dialog_path( +pub(crate) fn open_file_sync( window: &Window, ty: FileDialogType, options: FileDialogOptions, diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 62e87c97b1..91687cfb84 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -33,11 +33,13 @@ use piet_common::{Piet, RenderContext}; use util::assert_main_thread; use win_main::with_application; +use crate::clipboard::ClipboardItem; +use crate::dialog::FileDialogOptions; use crate::keyboard; use crate::kurbo::{Point, Vec2}; -use crate::platform::dialog::{FileDialogOptions, FileDialogType}; +use crate::platform::dialog::FileDialogType; use crate::platform::menu::Menu; -use crate::window::{self, Cursor, MouseButton, Text, TimerToken, WinCtx, WinHandler}; +use crate::window::{self, Cursor, FileInfo, MouseButton, Text, TimerToken, WinCtx, WinHandler}; use crate::Error; pub mod application; @@ -455,13 +457,25 @@ impl WindowHandle { ((x.into() as f32) * scale, (y.into() as f32) * scale) } + pub fn set_menu(&self, _menu: Menu) { + unimplemented!(); + } + + pub fn show_context_menu(&self, _menu: Menu, _x: f64, _y: f64) { + unimplemented!(); + } + + pub fn set_title(&self, _title: impl Into) { + unimplemented!(); + } + pub fn file_dialog( &self, ty: FileDialogType, options: FileDialogOptions, ) -> Result { if let Some(state) = self.state.upgrade() { - dialog::get_file_dialog_path(state.window.upcast_ref(), ty, options) + dialog::open_file_sync(state.window.upcast_ref(), ty, options) } else { Err(Error::Other( "Cannot upgrade state from weak pointer to arc", @@ -532,6 +546,27 @@ impl<'a> WinCtx<'a> for WinCtxImpl<'a> { } } + fn open_file_sync(&mut self, options: FileDialogOptions) -> Option { + if let Some(state) = self.handle.state.upgrade() { + dialog::open_file_sync(state.window.upcast_ref(), FileDialogType::Open, options) + .ok() + .map(|s| FileInfo { path: s.into() }) + } else { + None + } + } + fn set_clipboard_contents(&mut self, item: ClipboardItem) { + let display = gdk::Display::get_default().unwrap(); + let clipboard = gtk::Clipboard::get_default(&display).unwrap(); + + match item { + ClipboardItem::Text(text) => { + clipboard.set_text(&text); + } + other => log::warn!("unhandled clipboard data {:?}", other), + } + } + fn request_timer(&mut self, deadline: std::time::Instant) -> TimerToken { let interval = time_interval_from_deadline(deadline); let token = next_timer_id(); From 736b99a2efef263313874635dac65d96a32ab0cc Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sun, 20 Oct 2019 22:49:27 +0200 Subject: [PATCH 74/78] Add keycode to u32 conversion --- druid-shell/src/keyboard.rs | 129 ++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/druid-shell/src/keyboard.rs b/druid-shell/src/keyboard.rs index 28f2c77642..582718ed82 100644 --- a/druid-shell/src/keyboard.rs +++ b/druid-shell/src/keyboard.rs @@ -667,6 +667,135 @@ impl From for KeyCode { } } +#[cfg(any(target_os = "linux", feature = "use_gtk"))] +impl Into for KeyCode { + #[allow(non_upper_case_globals)] + fn into(self) -> u32 { + use gdk::enums::key::*; + match self { + KeyCode::Escape => Escape, + KeyCode::Backtick => grave, + KeyCode::Key0 => _0, + KeyCode::Key1 => _1, + KeyCode::Key2 => _2, + KeyCode::Key3 => _3, + KeyCode::Key4 => _4, + KeyCode::Key5 => _5, + KeyCode::Key6 => _6, + KeyCode::Key7 => _7, + KeyCode::Key8 => _8, + KeyCode::Key9 => _9, + KeyCode::Minus => minus, + KeyCode::Equals => equal, + KeyCode::Backspace => BackSpace, + + KeyCode::Tab => Tab, + KeyCode::KeyQ => q | Q, + KeyCode::KeyW => w | W, + KeyCode::KeyE => e | E, + KeyCode::KeyR => r | R, + KeyCode::KeyT => t | T, + KeyCode::KeyY => y | Y, + KeyCode::KeyU => u | U, + KeyCode::KeyI => i | I, + KeyCode::KeyO => o | O, + KeyCode::KeyP => p | P, + KeyCode::LeftBracket => bracketleft, + KeyCode::RightBracket => bracketright, + KeyCode::Return => Return, + + KeyCode::KeyA => a | A, + KeyCode::KeyS => s | S, + KeyCode::KeyD => d | D, + KeyCode::KeyF => f | F, + KeyCode::KeyG => g | G, + KeyCode::KeyH => h | H, + KeyCode::KeyJ => j | J, + KeyCode::KeyK => k | K, + KeyCode::KeyL => l | L, + KeyCode::Semicolon => semicolon, + KeyCode::Quote => quoteright, + KeyCode::Backslash => backslash, + + KeyCode::KeyZ => z | Z, + KeyCode::KeyX => x | X, + KeyCode::KeyC => c | C, + KeyCode::KeyV => v | V, + KeyCode::KeyB => b | B, + KeyCode::KeyN => n | N, + KeyCode::KeyM => m | M, + KeyCode::Comma => comma, + KeyCode::Period => period, + KeyCode::Slash => slash, + + KeyCode::LeftControl => Control_L, + KeyCode::RightControl => Control_R, + KeyCode::LeftAlt => Alt_L, + KeyCode::RightAlt => Alt_R, + KeyCode::LeftShift => Shift_L, + KeyCode::RightShift => Shift_R, + KeyCode::LeftMeta => Meta_L, + KeyCode::RightMeta => Meta_R, + + KeyCode::Space => space, + KeyCode::CapsLock => Caps_Lock, + KeyCode::F1 => F1, + KeyCode::F2 => F2, + KeyCode::F3 => F3, + KeyCode::F4 => F4, + KeyCode::F5 => F5, + KeyCode::F6 => F6, + KeyCode::F7 => F7, + KeyCode::F8 => F8, + KeyCode::F9 => F9, + KeyCode::F10 => F10, + KeyCode::F11 => F11, + KeyCode::F12 => F12, + + KeyCode::PrintScreen => Print, + KeyCode::ScrollLock => Scroll_Lock, + // Pause/Break not audio. + KeyCode::Pause => Pause, + + KeyCode::Insert => Insert, + KeyCode::Delete => Delete, + KeyCode::Home => Home, + KeyCode::End => End, + KeyCode::PageUp => Page_Up, + KeyCode::PageDown => Page_Down, + + KeyCode::Numpad0 => KP_0, + KeyCode::Numpad1 => KP_1, + KeyCode::Numpad2 => KP_2, + KeyCode::Numpad3 => KP_3, + KeyCode::Numpad4 => KP_4, + KeyCode::Numpad5 => KP_5, + KeyCode::Numpad6 => KP_6, + KeyCode::Numpad7 => KP_7, + KeyCode::Numpad8 => KP_8, + KeyCode::Numpad9 => KP_9, + + KeyCode::NumpadEquals => KP_Equal, + KeyCode::NumpadSubtract => KP_Subtract, + KeyCode::NumpadAdd => KP_Add, + KeyCode::NumpadDecimal => KP_Decimal, + KeyCode::NumpadMultiply => KP_Multiply, + KeyCode::NumpadDivide => KP_Divide, + KeyCode::NumLock => Num_Lock, + KeyCode::NumpadEnter => KP_Enter, + + KeyCode::ArrowUp => Up, + KeyCode::ArrowDown => Down, + KeyCode::ArrowLeft => Left, + KeyCode::ArrowRight => Right, + KeyCode::Unknown(_) => unreachable!( + "Unreachable: converting unknown KeyCode {:?} to a keyval", + self + ), + } + } +} + /// Should realistically be (8 * N) - 1; we need one byte for the length. const TINY_STR_CAPACITY: usize = 15; From 041a71a7d92d206e2c8452bcc9db51f169c8a566 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sun, 20 Oct 2019 22:49:51 +0200 Subject: [PATCH 75/78] Implement set_title, set_menu, show_context_menu --- druid-shell/src/gtk/menu.rs | 73 ++++++++++++++++++++++++------------- druid-shell/src/gtk/mod.rs | 45 +++++++++++++++++++---- 2 files changed, 86 insertions(+), 32 deletions(-) diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index be74acf378..6fff08daa4 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -24,17 +24,18 @@ use gtkrs::{GtkMenuItemExt, MenuShellExt, SeparatorMenuItemBuilder, WidgetExt}; use crate::common_util::strip_access_key; use crate::gtk::WinCtxImpl; -use crate::keycodes::{KeySpec, MenuKey}; -use crate::keycodes::{Modifiers, M_ALT, M_CTRL, M_META, M_SHIFT}; +use crate::hotkey::{HotKey, KeyCompare, RawMods}; +use crate::keyboard::KeyModifiers; use crate::platform::WindowHandle; -#[derive(Default)] +#[derive(Default, Debug)] pub struct Menu { items: Vec, } +#[derive(Debug)] enum MenuItem { - Entry(String, u32, MenuKey), + Entry(String, u32, Option), SubMenu(String, Menu), Separator, } @@ -44,15 +45,30 @@ impl Menu { Menu { items: Vec::new() } } - pub fn add_dropdown(&mut self, menu: Menu, text: &str) { + pub fn new_for_popup() -> Menu { + Menu { items: Vec::new() } + } + + pub fn add_dropdown(&mut self, menu: Menu, text: &str, _enabled: bool) { + // TODO: use enabled self.items .push(MenuItem::SubMenu(strip_access_key(text), menu)); } - pub fn add_item(&mut self, id: u32, text: &str, key: impl Into) { + pub fn add_item( + &mut self, + id: u32, + text: &str, + key: Option<&HotKey>, + _enabled: bool, + _selected: bool, + ) { // TODO: handle accelerator shortcuts by parsing `text` - self.items - .push(MenuItem::Entry(strip_access_key(text), id, key.into())); + self.items.push(MenuItem::Entry( + strip_access_key(text), + id, + key.map(|k| k.clone()), + )); } pub fn add_separator(&mut self) { @@ -70,7 +86,9 @@ impl Menu { MenuItem::Entry(name, id, key) => { let item = GtkMenuItem::new_with_label(&name); - register_accelerator(&item, accel_group, key); + if let Some(k) = key { + register_accelerator(&item, accel_group, k); + } let handle = handle.clone(); item.connect_activate(move |_| { @@ -106,7 +124,7 @@ impl Menu { menu } - fn into_gtk_menu(self, handle: &WindowHandle, accel_group: &AccelGroup) -> GtkMenu { + pub fn into_gtk_menu(self, handle: &WindowHandle, accel_group: &AccelGroup) -> GtkMenu { let mut menu = GtkMenu::new(); menu.set_accel_group(Some(accel_group)); @@ -116,25 +134,30 @@ impl Menu { } } -fn register_accelerator(item: &GtkMenuItem, accel_group: &AccelGroup, menu_key: MenuKey) { - if let KeySpec::Char(c) = menu_key.key { - item.add_accelerator( - "activate", - accel_group, - gdk::unicode_to_keyval(c as u32), - modifiers_to_gdk_modifier_type(menu_key.modifiers), - gtk::AccelFlags::VISIBLE, - ); - } +fn register_accelerator(item: &GtkMenuItem, accel_group: &AccelGroup, menu_key: HotKey) { + let wc = match menu_key.key { + KeyCompare::Code(key_code) => key_code.into(), + KeyCompare::Text(text) => text.chars().next().unwrap() as u32, + }; + + item.add_accelerator( + "activate", + accel_group, + gdk::unicode_to_keyval(wc), + modifiers_to_gdk_modifier_type(menu_key.mods), + gtk::AccelFlags::VISIBLE, + ); } -fn modifiers_to_gdk_modifier_type(modifiers: Modifiers) -> gdk::ModifierType { +fn modifiers_to_gdk_modifier_type(raw_modifiers: RawMods) -> gdk::ModifierType { let mut result = ModifierType::empty(); - result.set(ModifierType::MOD1_MASK, modifiers & M_ALT == M_ALT); - result.set(ModifierType::CONTROL_MASK, modifiers & M_CTRL == M_CTRL); - result.set(ModifierType::SHIFT_MASK, modifiers & M_SHIFT == M_SHIFT); - result.set(ModifierType::META_MASK, modifiers & M_META == M_META); + let modifiers: KeyModifiers = raw_modifiers.into(); + + result.set(ModifierType::MOD1_MASK, modifiers.alt); + result.set(ModifierType::CONTROL_MASK, modifiers.ctrl); + result.set(ModifierType::SHIFT_MASK, modifiers.shift); + result.set(ModifierType::META_MASK, modifiers.meta); result } diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index 91687cfb84..bd211a24e6 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -27,8 +27,9 @@ use gdk::{EventKey, EventMask, ModifierType, ScrollDirection, WindowExt}; use gio::ApplicationExt; use gtk::{ AccelGroup, ApplicationWindow, BoxExt, Cast, ContainerExt, GtkApplicationExt, GtkWindowExt, - Inhibit, WidgetExt, WidgetExtManual, + Inhibit, ObjectExt, WidgetExt, WidgetExtManual, }; + use piet_common::{Piet, RenderContext}; use util::assert_main_thread; use win_main::with_application; @@ -457,16 +458,46 @@ impl WindowHandle { ((x.into() as f32) * scale, (y.into() as f32) * scale) } - pub fn set_menu(&self, _menu: Menu) { - unimplemented!(); + pub fn set_menu(&self, menu: Menu) { + if let Some(state) = self.state.upgrade() { + let window = &state.window; + + let accel_group = AccelGroup::new(); + window.add_accel_group(&accel_group); + + let vbox = window.get_children()[0] + .clone() + .downcast::() + .unwrap(); + + let first_child = &vbox.get_children()[0]; + if first_child.is::() { + vbox.remove(first_child); + } + let menubar = menu.into_gtk_menubar(&self, &accel_group); + vbox.pack_start(&menubar, false, false, 0); + menubar.show_all(); + } } - pub fn show_context_menu(&self, _menu: Menu, _x: f64, _y: f64) { - unimplemented!(); + pub fn show_context_menu(&self, menu: Menu, _x: f64, _y: f64) { + if let Some(state) = self.state.upgrade() { + let window = &state.window; + + let accel_group = AccelGroup::new(); + window.add_accel_group(&accel_group); + + let menu = menu.into_gtk_menu(&self, &accel_group); + menu.show_all(); + use crate::gtkrs::GtkMenuExtManual; + menu.popup_easy(3, gtkrs::get_current_event_time()); + } } - pub fn set_title(&self, _title: impl Into) { - unimplemented!(); + pub fn set_title(&self, title: impl Into) { + if let Some(state) = self.state.upgrade() { + state.window.set_title(&(title.into())); + } } pub fn file_dialog( From fefee404d862c19a874be90677b0cbba8c3f61ef Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Tue, 22 Oct 2019 20:03:55 +0200 Subject: [PATCH 76/78] Improve imports and remove superfluous TODO --- druid-shell/src/gtk/application.rs | 1 - druid-shell/src/gtk/mod.rs | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/druid-shell/src/gtk/application.rs b/druid-shell/src/gtk/application.rs index 891f8819ed..aceb689b75 100644 --- a/druid-shell/src/gtk/application.rs +++ b/druid-shell/src/gtk/application.rs @@ -28,7 +28,6 @@ impl Application { let clipboard = gtk::Clipboard::get_default(&display).unwrap(); if let Some(gstring) = clipboard.wait_for_text() { - // TODO: does gstring need to be freed? Some(ClipboardItem::Text(gstring.to_string())) } else { None diff --git a/druid-shell/src/gtk/mod.rs b/druid-shell/src/gtk/mod.rs index bd211a24e6..2475cc13ff 100644 --- a/druid-shell/src/gtk/mod.rs +++ b/druid-shell/src/gtk/mod.rs @@ -25,10 +25,8 @@ use std::sync::{Arc, Mutex, Weak}; use gdk::{EventKey, EventMask, ModifierType, ScrollDirection, WindowExt}; use gio::ApplicationExt; -use gtk::{ - AccelGroup, ApplicationWindow, BoxExt, Cast, ContainerExt, GtkApplicationExt, GtkWindowExt, - Inhibit, ObjectExt, WidgetExt, WidgetExtManual, -}; +use gtk::prelude::*; +use gtk::{AccelGroup, ApplicationWindow}; use piet_common::{Piet, RenderContext}; use util::assert_main_thread; @@ -489,7 +487,6 @@ impl WindowHandle { let menu = menu.into_gtk_menu(&self, &accel_group); menu.show_all(); - use crate::gtkrs::GtkMenuExtManual; menu.popup_easy(3, gtkrs::get_current_event_time()); } } From b9978bf37bd061f49cde4d9db348a4e4c223551e Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Tue, 22 Oct 2019 21:37:27 +0200 Subject: [PATCH 77/78] Add TODOs for unimplemented menu features --- druid-shell/src/gtk/menu.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/druid-shell/src/gtk/menu.rs b/druid-shell/src/gtk/menu.rs index 6fff08daa4..aca6fa787a 100644 --- a/druid-shell/src/gtk/menu.rs +++ b/druid-shell/src/gtk/menu.rs @@ -50,7 +50,7 @@ impl Menu { } pub fn add_dropdown(&mut self, menu: Menu, text: &str, _enabled: bool) { - // TODO: use enabled + // TODO: implement enabled dropdown self.items .push(MenuItem::SubMenu(strip_access_key(text), menu)); } @@ -63,7 +63,7 @@ impl Menu { _enabled: bool, _selected: bool, ) { - // TODO: handle accelerator shortcuts by parsing `text` + // TODO: implement enabled, selected item self.items.push(MenuItem::Entry( strip_access_key(text), id, From a108ff2d57fa017962c71202c0da28fbae08bd4e Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Tue, 22 Oct 2019 16:54:51 -0400 Subject: [PATCH 78/78] Post-merge (pre-merge?) housekeeping - fix some post-merge compiler warnings - add linux docs build to CI --- .github/workflows/ci.yml | 8 +++++++- druid-shell/src/common_util.rs | 1 + druid-shell/src/lib.rs | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9ba6fbc91..0d8a032109 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,7 +158,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macOS-10.14, windows-2019] + os: [macOS-10.14, windows-2019, ubuntu-latest] steps: - uses: actions/checkout@v1 @@ -166,6 +166,12 @@ jobs: run: brew install cairo if: contains(matrix.os, 'mac') + - name: install libgtk-dev + run: | + sudo apt update + sudo apt install libgtk-3-dev + if: contains(matrix.os, 'ubuntu') + - name: install nightly toolchain uses: actions-rs/toolchain@v1 with: diff --git a/druid-shell/src/common_util.rs b/druid-shell/src/common_util.rs index d16cfc7019..5b750802c9 100644 --- a/druid-shell/src/common_util.rs +++ b/druid-shell/src/common_util.rs @@ -17,6 +17,7 @@ /// Strip the access keys from the menu string. /// /// Changes "E&xit" to "Exit". Actual ampersands are escaped as "&&". +#[cfg(any(target_os = "macos", target_os = "linux"))] pub fn strip_access_key(raw_menu_text: &str) -> String { // TODO this is copied from mac/menu.rs maybe this should be moved somewhere common? let mut saw_ampersand = false; diff --git a/druid-shell/src/lib.rs b/druid-shell/src/lib.rs index d6a81559f5..243e2620af 100644 --- a/druid-shell/src/lib.rs +++ b/druid-shell/src/lib.rs @@ -38,8 +38,8 @@ extern crate glib; #[cfg(any(feature = "use_gtk", target_os = "linux"))] extern crate gtk as gtkrs; -#[cfg(all(not(feature = "use_gtk")))] -#[macro_use] +#[cfg_attr(not(any(feature = "use_gtk", target_os = "linux")), macro_use)] +#[cfg(not(any(feature = "use_gtk", target_os = "linux")))] extern crate lazy_static; pub mod clipboard;