1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00

Update to latest Glutin/winit (#671)

* Update to latest Glutin/winit

This *finally* gets us off the fork of Glutin we've been on for so long
and will unblock a number of other items. Functionality should be the
same as before.

The update forced our hand on a compiler update. It's no longer
feasible to pin on an old version. From now on, we require latest
stable.
This commit is contained in:
Joe Wilm 2017-07-20 10:50:50 -07:00 committed by GitHub
parent c8e4f366e7
commit 8e7dd009a4
10 changed files with 559 additions and 480 deletions

View file

@ -8,7 +8,6 @@ os:
- osx - osx
rust: rust:
- 1.15.0
- stable - stable
- nightly - nightly

171
Cargo.lock generated
View file

@ -12,8 +12,7 @@ dependencies = [
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"font 0.1.0", "font 0.1.0",
"gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin 0.6.1 (git+https://github.com/jwilm/glutin?rev=cc64178d39a1fa06b2c5403117e5e0ef24deeac4)", "glutin 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -58,11 +57,6 @@ dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "bitflags"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "0.4.0" version = "0.4.0"
@ -78,6 +72,11 @@ name = "bitflags"
version = "0.8.2" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "block" name = "block"
version = "0.1.6" version = "0.1.6"
@ -85,7 +84,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
version = "0.5.3" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -100,10 +99,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "cgl" name = "cgl"
version = "0.1.5" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -164,11 +163,12 @@ dependencies = [
[[package]] [[package]]
name = "cocoa" name = "cocoa"
version = "0.3.3" version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -182,15 +182,6 @@ dependencies = [
"objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "core-foundation"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "core-foundation" name = "core-foundation"
version = "0.3.0" version = "0.3.0"
@ -201,10 +192,11 @@ dependencies = [
] ]
[[package]] [[package]]
name = "core-foundation-sys" name = "core-foundation"
version = "0.2.3" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"core-foundation-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -217,13 +209,11 @@ dependencies = [
] ]
[[package]] [[package]]
name = "core-graphics" name = "core-foundation-sys"
version = "0.3.2" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -246,11 +236,6 @@ dependencies = [
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "crossbeam"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "dlib" name = "dlib"
version = "0.3.1" version = "0.3.1"
@ -411,7 +396,7 @@ dependencies = [
[[package]] [[package]]
name = "gleam" name = "gleam"
version = "0.2.32" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -420,31 +405,28 @@ dependencies = [
[[package]] [[package]]
name = "glutin" name = "glutin"
version = "0.6.1" version = "0.9.1"
source = "git+https://github.com/jwilm/glutin?rev=cc64178d39a1fa06b2c5403117e5e0ef24deeac4#cc64178d39a1fa06b2c5403117e5e0ef24deeac4" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"android_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "android_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "cocoa 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cocoa 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdi32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"user32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "user32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-kbd 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-window 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winit 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"x11-dl 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "x11-dl 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -483,11 +465,6 @@ name = "khronos_api"
version = "1.0.1" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "lazy_static"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "0.2.8" version = "0.2.8"
@ -549,7 +526,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "memmap" name = "memmap"
version = "0.2.3" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"fs2 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "fs2 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -892,11 +869,6 @@ dependencies = [
"nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "serde"
version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "serde" name = "serde"
version = "0.9.15" version = "0.9.15"
@ -1144,32 +1116,30 @@ dependencies = [
[[package]] [[package]]
name = "wayland-client" name = "wayland-client"
version = "0.5.12" version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"dlib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-scanner 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-scanner 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-sys 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-sys 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "wayland-kbd" name = "wayland-kbd"
version = "0.3.6" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dlib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "dlib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "wayland-scanner" name = "wayland-scanner"
version = "0.5.11" version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1177,21 +1147,21 @@ dependencies = [
[[package]] [[package]]
name = "wayland-sys" name = "wayland-sys"
version = "0.5.11" version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"dlib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "dlib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "wayland-window" name = "wayland-window"
version = "0.2.3" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1204,6 +1174,32 @@ name = "winapi-build"
version = "0.1.1" version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winit"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"android_glue 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cocoa 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdi32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"user32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-kbd 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-window 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"x11-dl 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "ws2_32-sys" name = "ws2_32-sys"
version = "0.2.1" version = "0.2.1"
@ -1249,29 +1245,27 @@ dependencies = [
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
"checksum arraydeque 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "96e774cadb24c2245225280c6799793f9802b918a58a79615e9490607489a717" "checksum arraydeque 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "96e774cadb24c2245225280c6799793f9802b918a58a79615e9490607489a717"
"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159" "checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159"
"checksum bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "32866f4d103c4e438b1db1158aa1b1a80ee078e5d77a59a2f906fd62a577389c"
"checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3" "checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4" "checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" "checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" "checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8"
"checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27" "checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27"
"checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c" "checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c"
"checksum cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8bdd78cca65a739cb5475dbf6b6bbb49373e327f4a6f2b499c0f98632df38c10" "checksum cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "86765cb42c2a2c497e142af72517c1b4d7ae5bb2f25dfa77a5c69642f2342d89"
"checksum cgmath 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75e93b3eb66e74ffb946a69ff54c6026c1399960241c843f249ea0127b96b9f6" "checksum cgmath 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75e93b3eb66e74ffb946a69ff54c6026c1399960241c843f249ea0127b96b9f6"
"checksum clap 2.24.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b8f69e518f967224e628896b54e41ff6acfb4dcfefc5076325c36525dac900f" "checksum clap 2.24.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b8f69e518f967224e628896b54e41ff6acfb4dcfefc5076325c36525dac900f"
"checksum clippy 0.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3fb361e922a08b698e746d4f199ff2d1e8d4b5f1984eaf8881e720cf5b8e34" "checksum clippy 0.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3fb361e922a08b698e746d4f199ff2d1e8d4b5f1984eaf8881e720cf5b8e34"
"checksum clippy_lints 0.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "70812027c1a8de9277d125557dce08262bc27508f2eb99592ad2d39a24a0b1c7" "checksum clippy_lints 0.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "70812027c1a8de9277d125557dce08262bc27508f2eb99592ad2d39a24a0b1c7"
"checksum cmake 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ebbb35d3dc9cd09497168f33de1acb79b265d350ab0ac34133b98f8509af1f" "checksum cmake 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ebbb35d3dc9cd09497168f33de1acb79b265d350ab0ac34133b98f8509af1f"
"checksum cocoa 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3afe4613f57a171039a98db1773f5840b5743cf85aaf03afb65ddfade4f4a9db" "checksum cocoa 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4047fed6536f40cc2ae5e7834fb38e382c788270191c4cd69196f89686d076ce"
"checksum core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25bfd746d203017f7d5cbd31ee5d8e17f94b6521c7af77ece6c9e4b2d4b16c67"
"checksum core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f51ce3b8ebe311c56de14231eb57572c15abebd2d32b3bcb99bcdb9c101f5ac3" "checksum core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f51ce3b8ebe311c56de14231eb57572c15abebd2d32b3bcb99bcdb9c101f5ac3"
"checksum core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "065a5d7ffdcbc8fa145d6f0746f3555025b9097a9e9cda59f7467abae670c78d" "checksum core-foundation 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "462f17573db7da7f2ff79843caa59ea5058530f585aff609bf5dcc28627f2031"
"checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624" "checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624"
"checksum core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0c56c6022ba22aedbaa7d231be545778becbe1c7aceda4c82ba2f2084dd4c723" "checksum core-foundation-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "53f5f209da674a33b660333a4d15eda39d515ba847c3af13f5d838a7fe686c63"
"checksum core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a9f841e9637adec70838c537cae52cb4c751cc6514ad05669b51d107c2021c79" "checksum core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a9f841e9637adec70838c537cae52cb4c751cc6514ad05669b51d107c2021c79"
"checksum core-text 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74ba2a7abdccb94fb6c00822addef48504182b285aa45a30e78286487888fcb4" "checksum core-text 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74ba2a7abdccb94fb6c00822addef48504182b285aa45a30e78286487888fcb4"
"checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97"
"checksum dlib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "148bce4ce1c36c4509f29cb54e62c2bd265551a9b00b38070fad551a851866ec" "checksum dlib 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "148bce4ce1c36c4509f29cb54e62c2bd265551a9b00b38070fad551a851866ec"
"checksum dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80c8b71fd71146990a9742fc06dcbbde19161a267e0ad4e572c35162f4578c90" "checksum dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80c8b71fd71146990a9742fc06dcbbde19161a267e0ad4e572c35162f4578c90"
"checksum dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07c4c7cc7b396419bc0a4d90371d0cee16cb5053b53647d287c0b728000c41fe" "checksum dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07c4c7cc7b396419bc0a4d90371d0cee16cb5053b53647d287c0b728000c41fe"
@ -1289,14 +1283,13 @@ dependencies = [
"checksum gcc 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "9be730064c122681712957ba1a9abaf082150be8aaf94526a805d900015b65b9" "checksum gcc 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "9be730064c122681712957ba1a9abaf082150be8aaf94526a805d900015b65b9"
"checksum gdi32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "65256ec4dc2592e6f05bfc1ca3b956a4e0698aa90b1dff1f5687d55a5a3fd59a" "checksum gdi32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "65256ec4dc2592e6f05bfc1ca3b956a4e0698aa90b1dff1f5687d55a5a3fd59a"
"checksum gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0940975a4ca12b088d32b5d5134826c47d2e73de4b0b459b05244c01503eccbb" "checksum gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0940975a4ca12b088d32b5d5134826c47d2e73de4b0b459b05244c01503eccbb"
"checksum gleam 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "9590e0e578d528a080c5abac678e7efbe349a73c7316faafd4073edf5f462d01" "checksum gleam 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "917ee404f414ed77756c12cb44fdcc7cd02f207bf91e1dc91a3ce7da794ec361"
"checksum glutin 0.6.1 (git+https://github.com/jwilm/glutin?rev=cc64178d39a1fa06b2c5403117e5e0ef24deeac4)" = "<none>" "checksum glutin 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dcbc8a7702324d4a878ad78b21d2338c33b12217cf4bdfea945edc9091bf1dca"
"checksum heapsize 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "556cd479866cf85c3f671209c85e8a6990211c916d1002c2fcb2e9b7cf60bc36" "checksum heapsize 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "556cd479866cf85c3f671209c85e8a6990211c916d1002c2fcb2e9b7cf60bc36"
"checksum inotify 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8458c07bdbdaf309c80e2c3304d14c3db64e7465d4f07cf589ccb83fd0ff31a" "checksum inotify 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8458c07bdbdaf309c80e2c3304d14c3db64e7465d4f07cf589ccb83fd0ff31a"
"checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c" "checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum khronos_api 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d5a08e2a31d665af8f1ca437eab6d00a93c9d62a549f73f9ed8fc2e55b5a91a7" "checksum khronos_api 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d5a08e2a31d665af8f1ca437eab6d00a93c9d62a549f73f9ed8fc2e55b5a91a7"
"checksum lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "cf186d1a8aa5f5bee5fd662bc9c1b949e0259e1bcc379d1f006847b0080c7417"
"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" "checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf"
"checksum lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce12306c4739d86ee97c23139f3a34ddf0387bbf181bc7929d287025a8c3ef6b" "checksum lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce12306c4739d86ee97c23139f3a34ddf0387bbf181bc7929d287025a8c3ef6b"
"checksum libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)" = "e7eb6b826bfc1fdea7935d46556250d1799b7fe2d9f7951071f4291710665e3e" "checksum libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)" = "e7eb6b826bfc1fdea7935d46556250d1799b7fe2d9f7951071f4291710665e3e"
@ -1306,7 +1299,7 @@ dependencies = [
"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b"
"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" "checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1" "checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1"
"checksum memmap 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f20f72ed93291a72e22e8b16bb18762183bb4943f0f483da5b8be1a9e8192752" "checksum memmap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "69253224aa10070855ea8fe9dbe94a03fc2b1d7930bb340c9e586a7513716fea"
"checksum mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a637d1ca14eacae06296a008fa7ad955347e34efcb5891cfd8ba05491a37907e" "checksum mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a637d1ca14eacae06296a008fa7ad955347e34efcb5891cfd8ba05491a37907e"
"checksum mio 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5b493dc9fd96bd2077f2117f178172b0765db4dfda3ea4d8000401e6d65d3e80" "checksum mio 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5b493dc9fd96bd2077f2117f178172b0765db4dfda3ea4d8000401e6d65d3e80"
"checksum miow 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3e690c5df6b2f60acd45d56378981e827ff8295562fc8d34f573deb267a59cd1" "checksum miow 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3e690c5df6b2f60acd45d56378981e827ff8295562fc8d34f573deb267a59cd1"
@ -1345,7 +1338,6 @@ dependencies = [
"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084"
"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"
"checksum semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d5b7638a1f03815d94e88cb3b3c08e87f0db4d683ef499d1836aaf70a45623f" "checksum semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d5b7638a1f03815d94e88cb3b3c08e87f0db4d683ef499d1836aaf70a45623f"
"checksum serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "1b0e0732aa8ec4267f61815a396a942ba3525062e3bd5520aa8419927cfc0a92"
"checksum serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af" "checksum serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af"
"checksum serde_codegen_internals 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bc888bd283bd2420b16ad0d860e35ad8acb21941180a83a189bb2046f9d00400" "checksum serde_codegen_internals 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bc888bd283bd2420b16ad0d860e35ad8acb21941180a83a189bb2046f9d00400"
"checksum serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "978fd866f4d4872084a81ccc35e275158351d3b9fe620074e7d7504b816b74ba" "checksum serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "978fd866f4d4872084a81ccc35e275158351d3b9fe620074e7d7504b816b74ba"
@ -1378,13 +1370,14 @@ dependencies = [
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum vte 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dedaf1f1d987ce88dce3aa7500421c3e32f0e399f9d3fcb5887a60569af1f9b8" "checksum vte 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dedaf1f1d987ce88dce3aa7500421c3e32f0e399f9d3fcb5887a60569af1f9b8"
"checksum walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c66c0b9792f0a765345452775f3adbd28dde9d33f30d13e5dcc5ae17cf6f3780" "checksum walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c66c0b9792f0a765345452775f3adbd28dde9d33f30d13e5dcc5ae17cf6f3780"
"checksum wayland-client 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ced3094c157b5cc0a08d40530e1a627d9f88b9a436971338d2646439128a559e" "checksum wayland-client 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)" = "15aaf730e0720ac3c25259bd8af44eacd509ae03e85a3ca64b0d4f7fe9d8da03"
"checksum wayland-kbd 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "73bc10e84c1da90777beffecd24742baea17564ffc2a9918af41871c748eb050" "checksum wayland-kbd 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "75485a10a894e48f4d21c15c8673ac84a073aef402e15060715fb3501416e58e"
"checksum wayland-scanner 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "5a1869370d6bafcbabae8724511d803f4e209a70e94ad94a4249269534364f66" "checksum wayland-scanner 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)" = "0df992fcdb356c7bde978e7d2d8a407cfd8890370510e11dc0131bfd08cc064c"
"checksum wayland-sys 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9633f7fe5de56544215f82eaf1b76bf1b584becf7f08b58cbef4c2c7d10e803a" "checksum wayland-sys 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)" = "7b755ecdca8a7de5191b3ddbcbee1055ba4adfe74f6b0d9f299bf060a5e8c8dd"
"checksum wayland-window 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "309b69d3a863c9c21422d889fb7d98cf02f8a2ca054960a49243ce5b67ad884c" "checksum wayland-window 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4355498f67d61401169926daca72bf04db53c95bad863aa3e6c6e5e5ec20973c"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum winit 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "698ba650b7118385bf776b13134d58793af062bcb95ea6f84f6f4d682e1ed590"
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
"checksum x11-dl 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "326c500cdc166fd7c70dd8c8a829cd5c0ce7be5a5d98c25817de2b9bdc67faf8" "checksum x11-dl 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "326c500cdc166fd7c70dd8c8a829cd5c0ce7be5a5d98c25817de2b9bdc67faf8"
"checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61" "checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61"

View file

@ -18,7 +18,6 @@ notify = "2.6"
bitflags = "0.7" bitflags = "0.7"
font = { path = "./font" } font = { path = "./font" }
errno = "0.2" errno = "0.2"
lazy_static = "0.2.2"
parking_lot = "0.3.1" parking_lot = "0.3.1"
serde = "0.9" serde = "0.9"
serde_yaml = "0.6" serde_yaml = "0.6"
@ -50,8 +49,7 @@ bench = []
gl_generator = "0.5" gl_generator = "0.5"
[dependencies.glutin] [dependencies.glutin]
git = "https://github.com/jwilm/glutin" version = "0.9"
rev = "cc64178d39a1fa06b2c5403117e5e0ef24deeac4"
[profile.release] [profile.release]
lto = true lto = true

View file

@ -65,7 +65,7 @@ makepkg -isr
``` ```
3. Make sure you have the right Rust compiler installed. Alacritty requires at 3. Make sure you have the right Rust compiler installed. Alacritty requires at
least 1.15. Run least 1.18. Run
```sh ```sh
rustup override set stable rustup override set stable

View file

@ -21,6 +21,8 @@ use serde::de::Error as SerdeError;
use serde::de::{Visitor, MapVisitor, Unexpected}; use serde::de::{Visitor, MapVisitor, Unexpected};
use notify::{Watcher as WatcherApi, RecommendedWatcher as FileWatcher, op}; use notify::{Watcher as WatcherApi, RecommendedWatcher as FileWatcher, op};
use glutin::ModifiersState;
use input::{Action, Binding, MouseBinding, KeyBinding}; use input::{Action, Binding, MouseBinding, KeyBinding};
use index::{Line, Column}; use index::{Line, Column};
@ -297,10 +299,10 @@ impl Default for Config {
/// ///
/// Our deserialize impl wouldn't be covered by a derive(Deserialize); see the /// Our deserialize impl wouldn't be covered by a derive(Deserialize); see the
/// impl below. /// impl below.
struct ModsWrapper(::glutin::Mods); struct ModsWrapper(ModifiersState);
impl ModsWrapper { impl ModsWrapper {
fn into_inner(self) -> ::glutin::Mods { fn into_inner(self) -> ModifiersState {
self.0 self.0
} }
} }
@ -321,14 +323,13 @@ impl de::Deserialize for ModsWrapper {
fn visit_str<E>(self, value: &str) -> ::std::result::Result<ModsWrapper, E> fn visit_str<E>(self, value: &str) -> ::std::result::Result<ModsWrapper, E>
where E: de::Error, where E: de::Error,
{ {
use ::glutin::{mods, Mods}; let mut res = ModifiersState::default();
let mut res = Mods::empty();
for modifier in value.split('|') { for modifier in value.split('|') {
match modifier.trim() { match modifier.trim() {
"Command" | "Super" => res |= mods::SUPER, "Command" | "Super" => res.logo = true,
"Shift" => res |= mods::SHIFT, "Shift" => res.shift = true,
"Alt" | "Option" => res |= mods::ALT, "Alt" | "Option" => res.alt = true,
"Control" => res |= mods::CONTROL, "Control" => res.ctrl = true,
_ => err_println!("unknown modifier {:?}", modifier), _ => err_println!("unknown modifier {:?}", modifier),
} }
} }
@ -482,7 +483,7 @@ impl de::Deserialize for MouseButton {
struct RawBinding { struct RawBinding {
key: Option<::glutin::VirtualKeyCode>, key: Option<::glutin::VirtualKeyCode>,
mouse: Option<::glutin::MouseButton>, mouse: Option<::glutin::MouseButton>,
mods: ::glutin::Mods, mods: ModifiersState,
mode: TermMode, mode: TermMode,
notmode: TermMode, notmode: TermMode,
action: Action, action: Action,
@ -583,7 +584,7 @@ impl de::Deserialize for RawBinding {
) -> ::std::result::Result<RawBinding, V::Error> ) -> ::std::result::Result<RawBinding, V::Error>
where V: MapVisitor, where V: MapVisitor,
{ {
let mut mods: Option<::glutin::Mods> = None; let mut mods: Option<ModifiersState> = None;
let mut key: Option<::glutin::VirtualKeyCode> = None; let mut key: Option<::glutin::VirtualKeyCode> = None;
let mut chars: Option<String> = None; let mut chars: Option<String> = None;
let mut action: Option<::input::Action> = None; let mut action: Option<::input::Action> = None;
@ -670,7 +671,7 @@ impl de::Deserialize for RawBinding {
let mode = mode.unwrap_or_else(TermMode::empty); let mode = mode.unwrap_or_else(TermMode::empty);
let not_mode = not_mode.unwrap_or_else(TermMode::empty); let not_mode = not_mode.unwrap_or_else(TermMode::empty);
let mods = mods.unwrap_or_else(::glutin::Mods::empty); let mods = mods.unwrap_or_else(ModifiersState::default);
if mouse.is_none() && key.is_none() { if mouse.is_none() && key.is_none() {
return Err(V::Error::custom("bindings require mouse button or key")); return Err(V::Error::custom("bindings require mouse button or key"));
@ -1644,158 +1645,159 @@ enum Key {
impl Key { impl Key {
fn to_glutin_key(&self) -> ::glutin::VirtualKeyCode { fn to_glutin_key(&self) -> ::glutin::VirtualKeyCode {
use ::glutin::VirtualKeyCode::*;
// Thank you, vim macros! // Thank you, vim macros!
match *self { match *self {
Key::Key1 => ::glutin::VirtualKeyCode::Key1, Key::Key1 => Key1,
Key::Key2 => ::glutin::VirtualKeyCode::Key2, Key::Key2 => Key2,
Key::Key3 => ::glutin::VirtualKeyCode::Key3, Key::Key3 => Key3,
Key::Key4 => ::glutin::VirtualKeyCode::Key4, Key::Key4 => Key4,
Key::Key5 => ::glutin::VirtualKeyCode::Key5, Key::Key5 => Key5,
Key::Key6 => ::glutin::VirtualKeyCode::Key6, Key::Key6 => Key6,
Key::Key7 => ::glutin::VirtualKeyCode::Key7, Key::Key7 => Key7,
Key::Key8 => ::glutin::VirtualKeyCode::Key8, Key::Key8 => Key8,
Key::Key9 => ::glutin::VirtualKeyCode::Key9, Key::Key9 => Key9,
Key::Key0 => ::glutin::VirtualKeyCode::Key0, Key::Key0 => Key0,
Key::A => ::glutin::VirtualKeyCode::A, Key::A => A,
Key::B => ::glutin::VirtualKeyCode::B, Key::B => B,
Key::C => ::glutin::VirtualKeyCode::C, Key::C => C,
Key::D => ::glutin::VirtualKeyCode::D, Key::D => D,
Key::E => ::glutin::VirtualKeyCode::E, Key::E => E,
Key::F => ::glutin::VirtualKeyCode::F, Key::F => F,
Key::G => ::glutin::VirtualKeyCode::G, Key::G => G,
Key::H => ::glutin::VirtualKeyCode::H, Key::H => H,
Key::I => ::glutin::VirtualKeyCode::I, Key::I => I,
Key::J => ::glutin::VirtualKeyCode::J, Key::J => J,
Key::K => ::glutin::VirtualKeyCode::K, Key::K => K,
Key::L => ::glutin::VirtualKeyCode::L, Key::L => L,
Key::M => ::glutin::VirtualKeyCode::M, Key::M => M,
Key::N => ::glutin::VirtualKeyCode::N, Key::N => N,
Key::O => ::glutin::VirtualKeyCode::O, Key::O => O,
Key::P => ::glutin::VirtualKeyCode::P, Key::P => P,
Key::Q => ::glutin::VirtualKeyCode::Q, Key::Q => Q,
Key::R => ::glutin::VirtualKeyCode::R, Key::R => R,
Key::S => ::glutin::VirtualKeyCode::S, Key::S => S,
Key::T => ::glutin::VirtualKeyCode::T, Key::T => T,
Key::U => ::glutin::VirtualKeyCode::U, Key::U => U,
Key::V => ::glutin::VirtualKeyCode::V, Key::V => V,
Key::W => ::glutin::VirtualKeyCode::W, Key::W => W,
Key::X => ::glutin::VirtualKeyCode::X, Key::X => X,
Key::Y => ::glutin::VirtualKeyCode::Y, Key::Y => Y,
Key::Z => ::glutin::VirtualKeyCode::Z, Key::Z => Z,
Key::Escape => ::glutin::VirtualKeyCode::Escape, Key::Escape => Escape,
Key::F1 => ::glutin::VirtualKeyCode::F1, Key::F1 => F1,
Key::F2 => ::glutin::VirtualKeyCode::F2, Key::F2 => F2,
Key::F3 => ::glutin::VirtualKeyCode::F3, Key::F3 => F3,
Key::F4 => ::glutin::VirtualKeyCode::F4, Key::F4 => F4,
Key::F5 => ::glutin::VirtualKeyCode::F5, Key::F5 => F5,
Key::F6 => ::glutin::VirtualKeyCode::F6, Key::F6 => F6,
Key::F7 => ::glutin::VirtualKeyCode::F7, Key::F7 => F7,
Key::F8 => ::glutin::VirtualKeyCode::F8, Key::F8 => F8,
Key::F9 => ::glutin::VirtualKeyCode::F9, Key::F9 => F9,
Key::F10 => ::glutin::VirtualKeyCode::F10, Key::F10 => F10,
Key::F11 => ::glutin::VirtualKeyCode::F11, Key::F11 => F11,
Key::F12 => ::glutin::VirtualKeyCode::F12, Key::F12 => F12,
Key::F13 => ::glutin::VirtualKeyCode::F13, Key::F13 => F13,
Key::F14 => ::glutin::VirtualKeyCode::F14, Key::F14 => F14,
Key::F15 => ::glutin::VirtualKeyCode::F15, Key::F15 => F15,
Key::Snapshot => ::glutin::VirtualKeyCode::Snapshot, Key::Snapshot => Snapshot,
Key::Scroll => ::glutin::VirtualKeyCode::Scroll, Key::Scroll => Scroll,
Key::Pause => ::glutin::VirtualKeyCode::Pause, Key::Pause => Pause,
Key::Insert => ::glutin::VirtualKeyCode::Insert, Key::Insert => Insert,
Key::Home => ::glutin::VirtualKeyCode::Home, Key::Home => Home,
Key::Delete => ::glutin::VirtualKeyCode::Delete, Key::Delete => Delete,
Key::End => ::glutin::VirtualKeyCode::End, Key::End => End,
Key::PageDown => ::glutin::VirtualKeyCode::PageDown, Key::PageDown => PageDown,
Key::PageUp => ::glutin::VirtualKeyCode::PageUp, Key::PageUp => PageUp,
Key::Left => ::glutin::VirtualKeyCode::Left, Key::Left => Left,
Key::Up => ::glutin::VirtualKeyCode::Up, Key::Up => Up,
Key::Right => ::glutin::VirtualKeyCode::Right, Key::Right => Right,
Key::Down => ::glutin::VirtualKeyCode::Down, Key::Down => Down,
Key::Back => ::glutin::VirtualKeyCode::Back, Key::Back => Back,
Key::Return => ::glutin::VirtualKeyCode::Return, Key::Return => Return,
Key::Space => ::glutin::VirtualKeyCode::Space, Key::Space => Space,
Key::Compose => ::glutin::VirtualKeyCode::Compose, Key::Compose => Compose,
Key::Numlock => ::glutin::VirtualKeyCode::Numlock, Key::Numlock => Numlock,
Key::Numpad0 => ::glutin::VirtualKeyCode::Numpad0, Key::Numpad0 => Numpad0,
Key::Numpad1 => ::glutin::VirtualKeyCode::Numpad1, Key::Numpad1 => Numpad1,
Key::Numpad2 => ::glutin::VirtualKeyCode::Numpad2, Key::Numpad2 => Numpad2,
Key::Numpad3 => ::glutin::VirtualKeyCode::Numpad3, Key::Numpad3 => Numpad3,
Key::Numpad4 => ::glutin::VirtualKeyCode::Numpad4, Key::Numpad4 => Numpad4,
Key::Numpad5 => ::glutin::VirtualKeyCode::Numpad5, Key::Numpad5 => Numpad5,
Key::Numpad6 => ::glutin::VirtualKeyCode::Numpad6, Key::Numpad6 => Numpad6,
Key::Numpad7 => ::glutin::VirtualKeyCode::Numpad7, Key::Numpad7 => Numpad7,
Key::Numpad8 => ::glutin::VirtualKeyCode::Numpad8, Key::Numpad8 => Numpad8,
Key::Numpad9 => ::glutin::VirtualKeyCode::Numpad9, Key::Numpad9 => Numpad9,
Key::AbntC1 => ::glutin::VirtualKeyCode::AbntC1, Key::AbntC1 => AbntC1,
Key::AbntC2 => ::glutin::VirtualKeyCode::AbntC2, Key::AbntC2 => AbntC2,
Key::Add => ::glutin::VirtualKeyCode::Add, Key::Add => Add,
Key::Apostrophe => ::glutin::VirtualKeyCode::Apostrophe, Key::Apostrophe => Apostrophe,
Key::Apps => ::glutin::VirtualKeyCode::Apps, Key::Apps => Apps,
Key::At => ::glutin::VirtualKeyCode::At, Key::At => At,
Key::Ax => ::glutin::VirtualKeyCode::Ax, Key::Ax => Ax,
Key::Backslash => ::glutin::VirtualKeyCode::Backslash, Key::Backslash => Backslash,
Key::Calculator => ::glutin::VirtualKeyCode::Calculator, Key::Calculator => Calculator,
Key::Capital => ::glutin::VirtualKeyCode::Capital, Key::Capital => Capital,
Key::Colon => ::glutin::VirtualKeyCode::Colon, Key::Colon => Colon,
Key::Comma => ::glutin::VirtualKeyCode::Comma, Key::Comma => Comma,
Key::Convert => ::glutin::VirtualKeyCode::Convert, Key::Convert => Convert,
Key::Decimal => ::glutin::VirtualKeyCode::Decimal, Key::Decimal => Decimal,
Key::Divide => ::glutin::VirtualKeyCode::Divide, Key::Divide => Divide,
Key::Equals => ::glutin::VirtualKeyCode::Equals, Key::Equals => Equals,
Key::Grave => ::glutin::VirtualKeyCode::Grave, Key::Grave => Grave,
Key::Kana => ::glutin::VirtualKeyCode::Kana, Key::Kana => Kana,
Key::Kanji => ::glutin::VirtualKeyCode::Kanji, Key::Kanji => Kanji,
Key::LAlt => ::glutin::VirtualKeyCode::LAlt, Key::LAlt => LAlt,
Key::LBracket => ::glutin::VirtualKeyCode::LBracket, Key::LBracket => LBracket,
Key::LControl => ::glutin::VirtualKeyCode::LControl, Key::LControl => LControl,
Key::LMenu => ::glutin::VirtualKeyCode::LMenu, Key::LMenu => LMenu,
Key::LShift => ::glutin::VirtualKeyCode::LShift, Key::LShift => LShift,
Key::LWin => ::glutin::VirtualKeyCode::LWin, Key::LWin => LWin,
Key::Mail => ::glutin::VirtualKeyCode::Mail, Key::Mail => Mail,
Key::MediaSelect => ::glutin::VirtualKeyCode::MediaSelect, Key::MediaSelect => MediaSelect,
Key::MediaStop => ::glutin::VirtualKeyCode::MediaStop, Key::MediaStop => MediaStop,
Key::Minus => ::glutin::VirtualKeyCode::Minus, Key::Minus => Minus,
Key::Multiply => ::glutin::VirtualKeyCode::Multiply, Key::Multiply => Multiply,
Key::Mute => ::glutin::VirtualKeyCode::Mute, Key::Mute => Mute,
Key::MyComputer => ::glutin::VirtualKeyCode::MyComputer, Key::MyComputer => MyComputer,
Key::NavigateForward => ::glutin::VirtualKeyCode::NavigateForward, Key::NavigateForward => NavigateForward,
Key::NavigateBackward => ::glutin::VirtualKeyCode::NavigateBackward, Key::NavigateBackward => NavigateBackward,
Key::NextTrack => ::glutin::VirtualKeyCode::NextTrack, Key::NextTrack => NextTrack,
Key::NoConvert => ::glutin::VirtualKeyCode::NoConvert, Key::NoConvert => NoConvert,
Key::NumpadComma => ::glutin::VirtualKeyCode::NumpadComma, Key::NumpadComma => NumpadComma,
Key::NumpadEnter => ::glutin::VirtualKeyCode::NumpadEnter, Key::NumpadEnter => NumpadEnter,
Key::NumpadEquals => ::glutin::VirtualKeyCode::NumpadEquals, Key::NumpadEquals => NumpadEquals,
Key::OEM102 => ::glutin::VirtualKeyCode::OEM102, Key::OEM102 => OEM102,
Key::Period => ::glutin::VirtualKeyCode::Period, Key::Period => Period,
Key::PlayPause => ::glutin::VirtualKeyCode::PlayPause, Key::PlayPause => PlayPause,
Key::Power => ::glutin::VirtualKeyCode::Power, Key::Power => Power,
Key::PrevTrack => ::glutin::VirtualKeyCode::PrevTrack, Key::PrevTrack => PrevTrack,
Key::RAlt => ::glutin::VirtualKeyCode::RAlt, Key::RAlt => RAlt,
Key::RBracket => ::glutin::VirtualKeyCode::RBracket, Key::RBracket => RBracket,
Key::RControl => ::glutin::VirtualKeyCode::RControl, Key::RControl => RControl,
Key::RMenu => ::glutin::VirtualKeyCode::RMenu, Key::RMenu => RMenu,
Key::RShift => ::glutin::VirtualKeyCode::RShift, Key::RShift => RShift,
Key::RWin => ::glutin::VirtualKeyCode::RWin, Key::RWin => RWin,
Key::Semicolon => ::glutin::VirtualKeyCode::Semicolon, Key::Semicolon => Semicolon,
Key::Slash => ::glutin::VirtualKeyCode::Slash, Key::Slash => Slash,
Key::Sleep => ::glutin::VirtualKeyCode::Sleep, Key::Sleep => Sleep,
Key::Stop => ::glutin::VirtualKeyCode::Stop, Key::Stop => Stop,
Key::Subtract => ::glutin::VirtualKeyCode::Subtract, Key::Subtract => Subtract,
Key::Sysrq => ::glutin::VirtualKeyCode::Sysrq, Key::Sysrq => Sysrq,
Key::Tab => ::glutin::VirtualKeyCode::Tab, Key::Tab => Tab,
Key::Underline => ::glutin::VirtualKeyCode::Underline, Key::Underline => Underline,
Key::Unlabeled => ::glutin::VirtualKeyCode::Unlabeled, Key::Unlabeled => Unlabeled,
Key::VolumeDown => ::glutin::VirtualKeyCode::VolumeDown, Key::VolumeDown => VolumeDown,
Key::VolumeUp => ::glutin::VirtualKeyCode::VolumeUp, Key::VolumeUp => VolumeUp,
Key::Wake => ::glutin::VirtualKeyCode::Wake, Key::Wake => Wake,
Key::WebBack => ::glutin::VirtualKeyCode::WebBack, Key::WebBack => WebBack,
Key::WebFavorites => ::glutin::VirtualKeyCode::WebFavorites, Key::WebFavorites => WebFavorites,
Key::WebForward => ::glutin::VirtualKeyCode::WebForward, Key::WebForward => WebForward,
Key::WebHome => ::glutin::VirtualKeyCode::WebHome, Key::WebHome => WebHome,
Key::WebRefresh => ::glutin::VirtualKeyCode::WebRefresh, Key::WebRefresh => WebRefresh,
Key::WebSearch => ::glutin::VirtualKeyCode::WebSearch, Key::WebSearch => WebSearch,
Key::WebStop => ::glutin::VirtualKeyCode::WebStop, Key::WebStop => WebStop,
Key::Yen => ::glutin::VirtualKeyCode::Yen, Key::Yen => Yen,
} }
} }
} }

View file

@ -211,7 +211,7 @@ impl Display {
// Clear screen // Clear screen
renderer.with_api(config, &size_info, 0. /* visual bell intensity */, |api| api.clear()); renderer.with_api(config, &size_info, 0. /* visual bell intensity */, |api| api.clear());
let mut display = Display { Ok(Display {
window: window, window: window,
renderer: renderer, renderer: renderer,
glyph_cache: glyph_cache, glyph_cache: glyph_cache,
@ -220,16 +220,7 @@ impl Display {
rx: rx, rx: rx,
meter: Meter::new(), meter: Meter::new(),
size_info: size_info, size_info: size_info,
}; })
let resize_tx = display.resize_channel();
let proxy = display.window.create_window_proxy();
display.window.set_resize_callback(move |width, height| {
let _ = resize_tx.send((width, height));
proxy.wakeup_event_loop();
});
Ok(display)
} }
#[inline] #[inline]
@ -267,6 +258,7 @@ impl Display {
item.on_resize(size) item.on_resize(size)
} }
self.window.resize(w, h);
self.renderer.resize(w as i32, h as i32); self.renderer.resize(w as i32, h as i32);
} }

View file

@ -7,7 +7,7 @@ use std::time::{Instant};
use serde_json as json; use serde_json as json;
use parking_lot::MutexGuard; use parking_lot::MutexGuard;
use glutin::{self, ElementState}; use glutin::{self, ModifiersState, Event, ElementState};
use copypasta::{Clipboard, Load, Store}; use copypasta::{Clipboard, Load, Store};
use config::{self, Config}; use config::{self, Config};
@ -37,6 +37,9 @@ pub struct ActionContext<'a, N: 'a> {
pub size_info: &'a SizeInfo, pub size_info: &'a SizeInfo,
pub mouse: &'a mut Mouse, pub mouse: &'a mut Mouse,
pub selection_modified: bool, pub selection_modified: bool,
pub received_count: &'a mut usize,
pub suppress_chars: &'a mut bool,
pub last_modifiers: &'a mut ModifiersState,
} }
impl<'a, N: Notify + 'a> input::ActionContext for ActionContext<'a, N> { impl<'a, N: Notify + 'a> input::ActionContext for ActionContext<'a, N> {
@ -108,6 +111,21 @@ impl<'a, N: Notify + 'a> input::ActionContext for ActionContext<'a, N> {
fn mouse_mut(&mut self) -> &mut Mouse { fn mouse_mut(&mut self) -> &mut Mouse {
self.mouse self.mouse
} }
#[inline]
fn received_count(&mut self) -> &mut usize {
&mut self.received_count
}
#[inline]
fn suppress_chars(&mut self) -> &mut bool {
&mut self.suppress_chars
}
#[inline]
fn last_modifiers(&mut self) -> &mut ModifiersState {
&mut self.last_modifiers
}
} }
pub enum ClickState { pub enum ClickState {
@ -164,6 +182,10 @@ pub struct Processor<N> {
pub selection: Option<Selection>, pub selection: Option<Selection>,
hide_cursor_when_typing: bool, hide_cursor_when_typing: bool,
hide_cursor: bool, hide_cursor: bool,
received_count: usize,
suppress_chars: bool,
last_modifiers: ModifiersState,
pending_events: Vec<Event>,
} }
/// Notify that the terminal was resized /// Notify that the terminal was resized
@ -202,6 +224,10 @@ impl<N: Notify> Processor<N> {
size_info: size_info, size_info: size_info,
hide_cursor_when_typing: config.hide_cursor_when_typing(), hide_cursor_when_typing: config.hide_cursor_when_typing(),
hide_cursor: false, hide_cursor: false,
received_count: 0,
suppress_chars: false,
last_modifiers: Default::default(),
pending_events: Vec::with_capacity(4),
} }
} }
@ -210,13 +236,18 @@ impl<N: Notify> Processor<N> {
/// Doesn't take self mutably due to borrow checking. Kinda uggo but w/e. /// Doesn't take self mutably due to borrow checking. Kinda uggo but w/e.
fn handle_event<'a>( fn handle_event<'a>(
processor: &mut input::Processor<'a, ActionContext<'a, N>>, processor: &mut input::Processor<'a, ActionContext<'a, N>>,
event: glutin::Event, event: Event,
ref_test: bool, ref_test: bool,
resize_tx: &mpsc::Sender<(u32, u32)>, resize_tx: &mpsc::Sender<(u32, u32)>,
hide_cursor: &mut bool, hide_cursor: &mut bool,
) { ) {
match event { match event {
glutin::Event::Closed => { // Pass on device events
Event::DeviceEvent { .. } => (),
Event::WindowEvent { event, .. } => {
use glutin::WindowEvent::*;
match event {
Closed => {
if ref_test { if ref_test {
// dump grid state // dump grid state
let grid = processor.ctx.terminal.grid(); let grid = processor.ctx.terminal.grid();
@ -239,39 +270,47 @@ impl<N: Notify> Processor<N> {
// FIXME should do a more graceful shutdown // FIXME should do a more graceful shutdown
::std::process::exit(0); ::std::process::exit(0);
}, },
glutin::Event::Resized(w, h) => { Resized(w, h) => {
resize_tx.send((w, h)).expect("send new size"); resize_tx.send((w, h)).expect("send new size");
processor.ctx.terminal.dirty = true; processor.ctx.terminal.dirty = true;
}, },
glutin::Event::KeyboardInput(state, _code, key, mods, string) => { KeyboardInput { input, .. } => {
// Ensure that key event originates from our window. For example using a shortcut let glutin::KeyboardInput { state, virtual_keycode, modifiers, .. } = input;
// to switch windows could generate a release key event. processor.process_key(state, virtual_keycode, &modifiers);
if state == ElementState::Pressed { if state == ElementState::Pressed {
// Hide cursor while typing
*hide_cursor = true; *hide_cursor = true;
} }
processor.process_key(state, key, mods, string);
}, },
glutin::Event::MouseInput(state, button) => { ReceivedCharacter(c) => {
processor.received_char(c);
},
MouseInput { state, button, .. } => {
*hide_cursor = false; *hide_cursor = false;
processor.mouse_input(state, button); processor.mouse_input(state, button);
processor.ctx.terminal.dirty = true; processor.ctx.terminal.dirty = true;
}, },
glutin::Event::MouseMoved(x, y) => { MouseMoved { position: (x, y), .. } => {
let x = x as i32;
let y = y as i32;
let x = limit(x, 0, processor.ctx.size_info.width as i32); let x = limit(x, 0, processor.ctx.size_info.width as i32);
let y = limit(y, 0, processor.ctx.size_info.height as i32); let y = limit(y, 0, processor.ctx.size_info.height as i32);
*hide_cursor = false; *hide_cursor = false;
processor.mouse_moved(x as u32, y as u32); processor.mouse_moved(x as u32, y as u32);
if !processor.ctx.selection.is_none() {
processor.ctx.terminal.dirty = true;
}
}, },
glutin::Event::MouseWheel(scroll_delta, touch_phase) => { MouseWheel { delta, phase, .. } => {
*hide_cursor = false; *hide_cursor = false;
processor.on_mouse_wheel(scroll_delta, touch_phase); processor.on_mouse_wheel(delta, phase);
}, },
glutin::Event::Refresh | Refresh => {
glutin::Event::Awakened => {
processor.ctx.terminal.dirty = true; processor.ctx.terminal.dirty = true;
}, },
glutin::Event::Focused(is_focused) => { Focused(is_focused) => {
if is_focused { if is_focused {
processor.ctx.terminal.dirty = true; processor.ctx.terminal.dirty = true;
} else { } else {
@ -282,6 +321,11 @@ impl<N: Notify> Processor<N> {
} }
_ => (), _ => (),
} }
},
Event::Awakened => {
processor.ctx.terminal.dirty = true;
}
}
} }
/// Process events. When `wait_for_event` is set, this method is guaranteed /// Process events. When `wait_for_event` is set, this method is guaranteed
@ -296,32 +340,28 @@ impl<N: Notify> Processor<N> {
// be blocked the entire time we wait for input! // be blocked the entire time we wait for input!
let mut terminal; let mut terminal;
self.pending_events.clear();
{ {
// Ditto on lazy initialization for context and processor. // Ditto on lazy initialization for context and processor.
let context; let context;
let mut processor: input::Processor<ActionContext<N>>; let mut processor: input::Processor<ActionContext<N>>;
// Convenience macro which curries most arguments to handle_event. let print_events = self.print_events;
macro_rules! process {
($event:expr) => {
if self.print_events {
println!("glutin event: {:?}", $event);
}
Processor::handle_event(
&mut processor,
$event,
self.ref_test,
&self.resize_tx,
&mut self.hide_cursor,
)
}
}
let event = if self.wait_for_event { let ref_test = self.ref_test;
window.wait_events().next() let resize_tx = &self.resize_tx;
} else {
None if self.wait_for_event {
}; // A Vec is used here since wait_events can potentially yield
// multiple events before the interrupt is handled. For example,
// Resize and Moved events.
let pending_events = &mut self.pending_events;
window.wait_events(|e| {
pending_events.push(e);
glutin::ControlFlow::Break
});
}
terminal = term.lock(); terminal = term.lock();
@ -332,21 +372,40 @@ impl<N: Notify> Processor<N> {
mouse: &mut self.mouse, mouse: &mut self.mouse,
size_info: &self.size_info, size_info: &self.size_info,
selection_modified: false, selection_modified: false,
received_count: &mut self.received_count,
suppress_chars: &mut self.suppress_chars,
last_modifiers: &mut self.last_modifiers,
}; };
processor = input::Processor { processor = input::Processor {
ctx: context, ctx: context,
mouse_config: &self.mouse_config, mouse_config: &self.mouse_config,
key_bindings: &self.key_bindings[..], key_bindings: &self.key_bindings[..],
mouse_bindings: &self.mouse_bindings[..] mouse_bindings: &self.mouse_bindings[..],
}; };
if let Some(event) = event { // Scope needed to that hide_cursor isn't borrowed after the scope
process!(event); // ends.
{
let hide_cursor = &mut self.hide_cursor;
let mut process = |event| {
if print_events {
println!("glutin event: {:?}", event);
}
Processor::handle_event(
&mut processor,
event,
ref_test,
resize_tx,
hide_cursor,
);
};
for event in self.pending_events.drain(..) {
process(event);
} }
for event in window.poll_events() { window.poll_events(process);
process!(event);
} }
if self.hide_cursor_when_typing { if self.hide_cursor_when_typing {

View file

@ -24,9 +24,8 @@ use std::process::Command;
use std::time::Instant; use std::time::Instant;
use copypasta::{Clipboard, Load, Buffer}; use copypasta::{Clipboard, Load, Buffer};
use glutin::{ElementState, VirtualKeyCode, MouseButton}; use glutin::{ElementState, VirtualKeyCode, MouseButton, TouchPhase, MouseScrollDelta};
use glutin::{Mods, mods}; use glutin::ModifiersState;
use glutin::{TouchPhase, MouseScrollDelta};
use config; use config;
use event::{ClickState, Mouse}; use event::{ClickState, Mouse};
@ -60,6 +59,9 @@ pub trait ActionContext {
fn line_selection(&mut self, point: Point); fn line_selection(&mut self, point: Point);
fn mouse_mut(&mut self) -> &mut Mouse; fn mouse_mut(&mut self) -> &mut Mouse;
fn mouse_coords(&self) -> Option<Point>; fn mouse_coords(&self) -> Option<Point>;
fn received_count(&mut self) -> &mut usize;
fn suppress_chars(&mut self) -> &mut bool;
fn last_modifiers(&mut self) -> &mut ModifiersState;
} }
/// Describes a state and action to take in that state /// Describes a state and action to take in that state
@ -68,7 +70,7 @@ pub trait ActionContext {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Binding<T> { pub struct Binding<T> {
/// Modifier keys required to activate binding /// Modifier keys required to activate binding
pub mods: Mods, pub mods: ModifiersState,
/// String to send to pty if mods and mode match /// String to send to pty if mods and mode match
pub action: Action, pub action: Action,
@ -96,7 +98,7 @@ impl<T: Eq> Binding<T> {
fn is_triggered_by( fn is_triggered_by(
&self, &self,
mode: TermMode, mode: TermMode,
mods: &Mods, mods: &ModifiersState,
input: &T input: &T
) -> bool { ) -> bool {
// Check input first since bindings are stored in one big list. This is // Check input first since bindings are stored in one big list. This is
@ -126,9 +128,15 @@ impl<T> Binding<T> {
self.notmode.is_empty() || !mode.intersects(self.notmode) self.notmode.is_empty() || !mode.intersects(self.notmode)
} }
/// Check that two mods descriptions for equivalence
///
/// Optimized to use single check instead of four (one per modifier)
#[inline] #[inline]
fn mods_match(&self, mods: &Mods) -> bool { fn mods_match(&self, mods: &ModifiersState) -> bool {
self.mods.is_all() || *mods == self.mods debug_assert!(4 == mem::size_of::<ModifiersState>());
unsafe {
mem::transmute_copy::<_, u32>(&self.mods) == mem::transmute_copy::<_, u32>(mods)
}
} }
} }
@ -414,37 +422,52 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
return; return;
} }
self.process_mouse_bindings(mods::NONE, button); self.process_mouse_bindings(&ModifiersState::default(), button);
} }
/// Process key input
///
/// If a keybinding was run, returns true. Otherwise returns false.
pub fn process_key( pub fn process_key(
&mut self, &mut self,
state: ElementState, state: ElementState,
key: Option<VirtualKeyCode>, key: Option<VirtualKeyCode>,
mods: Mods, mods: &ModifiersState,
string: Option<String>,
) { ) {
if let Some(key) = key { match (key, state) {
// Ignore release events (Some(key), ElementState::Pressed) => {
if state == ElementState::Released { *self.ctx.last_modifiers() = *mods;
return; *self.ctx.received_count() = 0;
*self.ctx.suppress_chars() = false;
if self.process_key_bindings(&mods, key) {
*self.ctx.suppress_chars() = true;
}
},
(_, ElementState::Released) => *self.ctx.suppress_chars() = false,
_ => ()
}
} }
if self.process_key_bindings(mods, key) { /// Process a received character
return; pub fn received_char(&mut self, c: char) {
} if !*self.ctx.suppress_chars() {
}
// Didn't process a binding; print the provided character
if let Some(mut string) = string {
// from ST
if string.len() == 1 && mods.contains(mods::ALT) {
string.insert(0, '\x1b');
}
self.ctx.write_to_pty(string.into_bytes());
self.ctx.clear_selection(); self.ctx.clear_selection();
let utf8_len = c.len_utf8();
if *self.ctx.received_count() == 0 && self.ctx.last_modifiers().alt && utf8_len == 1 {
self.ctx.write_to_pty(b"\x1b".to_vec());
}
let mut bytes = Vec::with_capacity(utf8_len);
unsafe {
bytes.set_len(utf8_len);
c.encode_utf8(&mut bytes[..]);
}
self.ctx.write_to_pty(bytes);
*self.ctx.received_count() += 1;
} }
} }
@ -454,9 +477,9 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
/// for its action to be executed. /// for its action to be executed.
/// ///
/// Returns true if an action is executed. /// Returns true if an action is executed.
fn process_key_bindings(&mut self, mods: Mods, key: VirtualKeyCode) -> bool { fn process_key_bindings(&mut self, mods: &ModifiersState, key: VirtualKeyCode) -> bool {
for binding in self.key_bindings { for binding in self.key_bindings {
if binding.is_triggered_by(self.ctx.terminal_mode(), &mods, &key) { if binding.is_triggered_by(self.ctx.terminal_mode(), mods, &key) {
// binding was triggered; run the action // binding was triggered; run the action
binding.execute(&mut self.ctx); binding.execute(&mut self.ctx);
return true; return true;
@ -472,9 +495,9 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
/// for its action to be executed. /// for its action to be executed.
/// ///
/// Returns true if an action is executed. /// Returns true if an action is executed.
fn process_mouse_bindings(&mut self, mods: Mods, button: MouseButton) -> bool { fn process_mouse_bindings(&mut self, mods: &ModifiersState, button: MouseButton) -> bool {
for binding in self.mouse_bindings { for binding in self.mouse_bindings {
if binding.is_triggered_by(self.ctx.terminal_mode(), &mods, &button) { if binding.is_triggered_by(self.ctx.terminal_mode(), mods, &button) {
// binding was triggered; run the action // binding was triggered; run the action
binding.execute(&mut self.ctx); binding.execute(&mut self.ctx);
return true; return true;
@ -490,7 +513,7 @@ mod tests {
use std::borrow::Cow; use std::borrow::Cow;
use std::time::Duration; use std::time::Duration;
use glutin::{mods, VirtualKeyCode, Event, ElementState, MouseButton}; use glutin::{VirtualKeyCode, Event, WindowEvent, ElementState, MouseButton, ModifiersState};
use term::{SizeInfo, Term, TermMode, mode}; use term::{SizeInfo, Term, TermMode, mode};
use event::{Mouse, ClickState}; use event::{Mouse, ClickState};
@ -515,6 +538,9 @@ mod tests {
pub size_info: &'a SizeInfo, pub size_info: &'a SizeInfo,
pub mouse: &'a mut Mouse, pub mouse: &'a mut Mouse,
pub last_action: MultiClick, pub last_action: MultiClick,
pub received_count: usize,
pub suppress_chars: bool,
pub last_modifiers: ModifiersState,
} }
impl <'a>super::ActionContext for ActionContext<'a> { impl <'a>super::ActionContext for ActionContext<'a> {
@ -555,6 +581,15 @@ mod tests {
fn mouse_mut(&mut self) -> &mut Mouse { fn mouse_mut(&mut self) -> &mut Mouse {
self.mouse self.mouse
} }
fn received_count(&mut self) -> &mut usize {
&mut self.received_count
}
fn suppress_chars(&mut self) -> &mut bool {
&mut self.suppress_chars
}
fn last_modifiers(&mut self) -> &mut ModifiersState {
&mut self.last_modifiers
}
} }
macro_rules! test_clickstate { macro_rules! test_clickstate {
@ -590,6 +625,9 @@ mod tests {
mouse: &mut mouse, mouse: &mut mouse,
size_info: &size, size_info: &size,
last_action: MultiClick::None, last_action: MultiClick::None,
received_count: 0,
suppress_chars: false,
last_modifiers: ModifiersState::default(),
}; };
let mut processor = Processor { let mut processor = Processor {
@ -606,8 +644,8 @@ mod tests {
mouse_bindings: &config.mouse_bindings()[..], mouse_bindings: &config.mouse_bindings()[..],
}; };
if let Event::MouseInput(state, input) = $input { if let Event::WindowEvent { event: WindowEvent::MouseInput { state, button, .. }, .. } = $input {
processor.mouse_input(state, input); processor.mouse_input(state, button);
}; };
assert!(match mouse.click_state { assert!(match mouse.click_state {
@ -640,7 +678,14 @@ mod tests {
test_clickstate! { test_clickstate! {
name: single_click, name: single_click,
initial_state: ClickState::None, initial_state: ClickState::None,
input: Event::MouseInput(ElementState::Pressed, MouseButton::Left), input: Event::WindowEvent {
event: WindowEvent::MouseInput {
state: ElementState::Pressed,
button: MouseButton::Left,
device_id: unsafe { ::std::mem::transmute_copy(&0) },
},
window_id: unsafe { ::std::mem::transmute_copy(&0) },
},
end_state: ClickState::Click, end_state: ClickState::Click,
last_action: MultiClick::None last_action: MultiClick::None
} }
@ -648,7 +693,14 @@ mod tests {
test_clickstate! { test_clickstate! {
name: double_click, name: double_click,
initial_state: ClickState::Click, initial_state: ClickState::Click,
input: Event::MouseInput(ElementState::Pressed, MouseButton::Left), input: Event::WindowEvent {
event: WindowEvent::MouseInput {
state: ElementState::Pressed,
button: MouseButton::Left,
device_id: unsafe { ::std::mem::transmute_copy(&0) },
},
window_id: unsafe { ::std::mem::transmute_copy(&0) },
},
end_state: ClickState::DoubleClick, end_state: ClickState::DoubleClick,
last_action: MultiClick::DoubleClick last_action: MultiClick::DoubleClick
} }
@ -656,72 +708,79 @@ mod tests {
test_clickstate! { test_clickstate! {
name: triple_click, name: triple_click,
initial_state: ClickState::DoubleClick, initial_state: ClickState::DoubleClick,
input: Event::MouseInput(ElementState::Pressed, MouseButton::Left), input: Event::WindowEvent {
event: WindowEvent::MouseInput {
state: ElementState::Pressed,
button: MouseButton::Left,
device_id: unsafe { ::std::mem::transmute_copy(&0) },
},
window_id: unsafe { ::std::mem::transmute_copy(&0) },
},
end_state: ClickState::TripleClick, end_state: ClickState::TripleClick,
last_action: MultiClick::TripleClick last_action: MultiClick::TripleClick
} }
test_process_binding! { test_process_binding! {
name: process_binding_nomode_shiftmod_require_shift, name: process_binding_nomode_shiftmod_require_shift,
binding: Binding { trigger: KEY, mods: mods::SHIFT, action: Action::from("\x1b[1;2D"), mode: mode::NONE, notmode: mode::NONE }, binding: Binding { trigger: KEY, mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[1;2D"), mode: mode::NONE, notmode: mode::NONE },
triggers: true, triggers: true,
mode: mode::NONE, mode: mode::NONE,
mods: mods::SHIFT mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false }
} }
test_process_binding! { test_process_binding! {
name: process_binding_nomode_nomod_require_shift, name: process_binding_nomode_nomod_require_shift,
binding: Binding { trigger: KEY, mods: mods::SHIFT, action: Action::from("\x1b[1;2D"), mode: mode::NONE, notmode: mode::NONE }, binding: Binding { trigger: KEY, mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[1;2D"), mode: mode::NONE, notmode: mode::NONE },
triggers: false, triggers: false,
mode: mode::NONE, mode: mode::NONE,
mods: mods::NONE mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }
} }
test_process_binding! { test_process_binding! {
name: process_binding_nomode_controlmod, name: process_binding_nomode_controlmod,
binding: Binding { trigger: KEY, mods: mods::CONTROL, action: Action::from("\x1b[1;5D"), mode: mode::NONE, notmode: mode::NONE }, binding: Binding { trigger: KEY, mods: ModifiersState { ctrl: true, shift: false, alt: false, logo: false }, action: Action::from("\x1b[1;5D"), mode: mode::NONE, notmode: mode::NONE },
triggers: true, triggers: true,
mode: mode::NONE, mode: mode::NONE,
mods: mods::CONTROL mods: ModifiersState { ctrl: true, shift: false, alt: false, logo: false }
} }
test_process_binding! { test_process_binding! {
name: process_binding_nomode_nomod_require_not_appcursor, name: process_binding_nomode_nomod_require_not_appcursor,
binding: Binding { trigger: KEY, mods: mods::ANY, action: Action::from("\x1b[D"), mode: mode::NONE, notmode: mode::APP_CURSOR }, binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[D"), mode: mode::NONE, notmode: mode::APP_CURSOR },
triggers: true, triggers: true,
mode: mode::NONE, mode: mode::NONE,
mods: mods::NONE mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }
} }
test_process_binding! { test_process_binding! {
name: process_binding_appcursormode_nomod_require_appcursor, name: process_binding_appcursormode_nomod_require_appcursor,
binding: Binding { trigger: KEY, mods: mods::ANY, action: Action::from("\x1bOD"), mode: mode::APP_CURSOR, notmode: mode::NONE }, binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: mode::APP_CURSOR, notmode: mode::NONE },
triggers: true, triggers: true,
mode: mode::APP_CURSOR, mode: mode::APP_CURSOR,
mods: mods::NONE mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }
} }
test_process_binding! { test_process_binding! {
name: process_binding_nomode_nomod_require_appcursor, name: process_binding_nomode_nomod_require_appcursor,
binding: Binding { trigger: KEY, mods: mods::ANY, action: Action::from("\x1bOD"), mode: mode::APP_CURSOR, notmode: mode::NONE }, binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: mode::APP_CURSOR, notmode: mode::NONE },
triggers: false, triggers: false,
mode: mode::NONE, mode: mode::NONE,
mods: mods::NONE mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }
} }
test_process_binding! { test_process_binding! {
name: process_binding_appcursormode_appkeypadmode_nomod_require_appcursor, name: process_binding_appcursormode_appkeypadmode_nomod_require_appcursor,
binding: Binding { trigger: KEY, mods: mods::ANY, action: Action::from("\x1bOD"), mode: mode::APP_CURSOR, notmode: mode::NONE }, binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: mode::APP_CURSOR, notmode: mode::NONE },
triggers: true, triggers: true,
mode: mode::APP_CURSOR | mode::APP_KEYPAD, mode: mode::APP_CURSOR | mode::APP_KEYPAD,
mods: mods::NONE mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }
} }
test_process_binding! { test_process_binding! {
name: process_binding_fail_with_extra_mods, name: process_binding_fail_with_extra_mods,
binding: Binding { trigger: KEY, mods: mods::SUPER, action: Action::from("arst"), mode: mode::NONE, notmode: mode::NONE }, binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: true }, action: Action::from("arst"), mode: mode::NONE, notmode: mode::NONE },
triggers: false, triggers: false,
mode: mode::NONE, mode: mode::NONE,
mods: mods::SUPER | mods::ALT mods: ModifiersState { shift: false, ctrl: false, alt: true, logo: true }
} }
} }

View file

@ -24,7 +24,6 @@
#[macro_use] extern crate bitflags; #[macro_use] extern crate bitflags;
#[macro_use] extern crate clap; #[macro_use] extern crate clap;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log; #[macro_use] extern crate log;
#[macro_use] extern crate serde_derive; #[macro_use] extern crate serde_derive;

View file

@ -14,32 +14,16 @@
use std::convert::From; use std::convert::From;
use std::fmt::{self, Display}; use std::fmt::{self, Display};
use std::ops::Deref; use std::ops::Deref;
use std::sync::Mutex;
use gl; use gl;
use glutin; use glutin::{self, EventsLoop, WindowBuilder, Event, CursorState, ControlFlow, ContextBuilder};
use glutin::GlContext;
/// Resize handling for Mac and maybe other platforms
///
/// This delegates to a statically referenced closure for convenience. The
/// C-style callback doesn't receive a pointer or anything, so we are forced to
/// use static storage.
///
/// This will fail horribly if more than one window is created. Don't do that :)
fn window_resize_handler(width: u32, height: u32) {
RESIZE_CALLBACK.lock().unwrap().as_ref().map(|func| (*func)(width, height));
}
lazy_static! {
/// The resize callback invoked by `window_resize_handler`
static ref RESIZE_CALLBACK: Mutex<Option<Box<Fn(u32, u32) + 'static + Send>>> = Mutex::new(None);
}
/// Window errors /// Window errors
#[derive(Debug)] #[derive(Debug)]
pub enum Error { pub enum Error {
/// Error creating the window /// Error creating the window
Creation(glutin::CreationError), ContextCreation(glutin::CreationError),
/// Error manipulating the rendering context /// Error manipulating the rendering context
Context(glutin::ContextError), Context(glutin::ContextError),
@ -52,13 +36,14 @@ type Result<T> = ::std::result::Result<T, Error>;
/// ///
/// Wraps the underlying windowing library to provide a stable API in Alacritty /// Wraps the underlying windowing library to provide a stable API in Alacritty
pub struct Window { pub struct Window {
glutin_window: glutin::Window, event_loop: EventsLoop,
window: glutin::GlWindow,
cursor_visible: bool, cursor_visible: bool,
} }
/// Threadsafe APIs for the window /// Threadsafe APIs for the window
pub struct Proxy { pub struct Proxy {
inner: glutin::WindowProxy, inner: glutin::EventsLoopProxy,
} }
/// Information about where the window is being displayed /// Information about where the window is being displayed
@ -152,14 +137,14 @@ impl<T: Display> Display for Points<T> {
impl ::std::error::Error for Error { impl ::std::error::Error for Error {
fn cause(&self) -> Option<&::std::error::Error> { fn cause(&self) -> Option<&::std::error::Error> {
match *self { match *self {
Error::Creation(ref err) => Some(err), Error::ContextCreation(ref err) => Some(err),
Error::Context(ref err) => Some(err), Error::Context(ref err) => Some(err),
} }
} }
fn description(&self) -> &str { fn description(&self) -> &str {
match *self { match *self {
Error::Creation(ref _err) => "Error creating glutin Window", Error::ContextCreation(ref _err) => "Error creating gl context",
Error::Context(ref _err) => "Error operating on render context", Error::Context(ref _err) => "Error operating on render context",
} }
} }
@ -168,8 +153,8 @@ impl ::std::error::Error for Error {
impl Display for Error { impl Display for Error {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
match *self { match *self {
Error::Creation(ref err) => { Error::ContextCreation(ref err) => {
write!(f, "Error creating glutin::Window; {}", err) write!(f, "Error creating GL context; {}", err)
}, },
Error::Context(ref err) => { Error::Context(ref err) => {
write!(f, "Error operating on render context; {}", err) write!(f, "Error operating on render context; {}", err)
@ -180,7 +165,7 @@ impl Display for Error {
impl From<glutin::CreationError> for Error { impl From<glutin::CreationError> for Error {
fn from(val: glutin::CreationError) -> Error { fn from(val: glutin::CreationError) -> Error {
Error::Creation(val) Error::ContextCreation(val)
} }
} }
@ -197,28 +182,24 @@ impl Window {
pub fn new( pub fn new(
title: &str title: &str
) -> Result<Window> { ) -> Result<Window> {
/// Create a glutin::Window let event_loop = EventsLoop::new();
let mut window = glutin::WindowBuilder::new() let window = WindowBuilder::new()
.with_vsync() .with_title(title);
.with_title(title) let context = ContextBuilder::new()
.build()?; .with_vsync(true);
let window = ::glutin::GlWindow::new(window, context, &event_loop)?;
/// Set the glutin window resize callback for *this* window. The
/// function pointer must be a C-style callback. This sets such a
/// callback which simply delegates to a statically referenced Rust
/// closure.
window.set_window_resize_callback(Some(window_resize_handler as fn(u32, u32)));
/// Set OpenGL symbol loader /// Set OpenGL symbol loader
gl::load_with(|symbol| window.get_proc_address(symbol) as *const _); gl::load_with(|symbol| window.get_proc_address(symbol) as *const _);
/// Make the window's context current so OpenGL operations can run /// Make the context current so OpenGL operations can run
unsafe { unsafe {
window.make_current()?; window.make_current()?;
} }
let window = Window { let window = Window {
glutin_window: window, event_loop: event_loop,
window: window,
cursor_visible: true, cursor_visible: true,
}; };
@ -233,74 +214,71 @@ impl Window {
/// rasterization depend on DPI and scale factor. /// rasterization depend on DPI and scale factor.
pub fn device_properties(&self) -> DeviceProperties { pub fn device_properties(&self) -> DeviceProperties {
DeviceProperties { DeviceProperties {
scale_factor: self.glutin_window.hidpi_factor(), scale_factor: self.window.hidpi_factor(),
} }
} }
/// Set the window resize callback
///
/// Pass a `move` closure which will be called with the new width and height
/// when the window is resized. According to the glutin docs, this can be
/// used to draw during resizing.
///
/// This method takes self mutably to ensure there's no race condition
/// setting the callback.
pub fn set_resize_callback<F: Fn(u32, u32) + 'static + Send>(&mut self, func: F) {
let mut guard = RESIZE_CALLBACK.lock().unwrap();
*guard = Some(Box::new(func));
}
pub fn inner_size_pixels(&self) -> Option<Size<Pixels<u32>>> { pub fn inner_size_pixels(&self) -> Option<Size<Pixels<u32>>> {
self.glutin_window self.window
.get_inner_size_pixels() .get_inner_size_pixels()
.map(|(w, h)| Size { width: Pixels(w), height: Pixels(h) }) .map(|(w, h)| Size { width: Pixels(w), height: Pixels(h) })
} }
#[inline] #[inline]
pub fn hidpi_factor(&self) -> f32 { pub fn hidpi_factor(&self) -> f32 {
self.glutin_window.hidpi_factor() self.window.hidpi_factor()
} }
#[inline] #[inline]
pub fn create_window_proxy(&self) -> Proxy { pub fn create_window_proxy(&self) -> Proxy {
Proxy { Proxy {
inner: self.glutin_window.create_window_proxy(), inner: self.event_loop.create_proxy(),
} }
} }
#[inline] #[inline]
pub fn swap_buffers(&self) -> Result<()> { pub fn swap_buffers(&self) -> Result<()> {
self.glutin_window self.window
.swap_buffers() .swap_buffers()
.map_err(From::from) .map_err(From::from)
} }
/// Poll for any available events /// Poll for any available events
#[inline] #[inline]
pub fn poll_events(&self) -> glutin::PollEventsIterator { pub fn poll_events<F>(&mut self, func: F)
self.glutin_window.poll_events() where F: FnMut(Event)
{
self.event_loop.poll_events(func);
}
#[inline]
pub fn resize(&self, width: u32, height: u32) {
self.window.resize(width, height);
} }
/// Block waiting for events /// Block waiting for events
///
/// FIXME should return our own type
#[inline] #[inline]
pub fn wait_events(&self) -> glutin::WaitEventsIterator { pub fn wait_events<F>(&mut self, func: F)
self.glutin_window.wait_events() where F: FnMut(Event) -> ControlFlow
{
self.event_loop.run_forever(func);
} }
/// Set the window title /// Set the window title
#[inline] #[inline]
pub fn set_title(&self, title: &str) { pub fn set_title(&self, title: &str) {
self.glutin_window.set_title(title); self.window.set_title(title);
} }
/// Set cursor visible /// Set cursor visible
pub fn set_cursor_visible(&mut self, visible: bool) { pub fn set_cursor_visible(&mut self, visible: bool) {
if visible != self.cursor_visible { if visible != self.cursor_visible {
self.cursor_visible = visible; self.cursor_visible = visible;
self.glutin_window.set_cursor_state(if visible { glutin::CursorState::Normal } self.window.set_cursor_state(if visible {
else { glutin::CursorState::Hide }).unwrap(); CursorState::Normal
} else {
CursorState::Hide
}).unwrap();
} }
} }
@ -308,7 +286,7 @@ impl Window {
pub fn get_window_id(&self) -> Option<usize> { pub fn get_window_id(&self) -> Option<usize> {
use glutin::os::unix::WindowExt; use glutin::os::unix::WindowExt;
match self.glutin_window.get_xlib_window() { match self.window.get_xlib_window() {
Some(xlib_window) => Some(xlib_window as usize), Some(xlib_window) => Some(xlib_window as usize),
None => None None => None
} }
@ -330,14 +308,14 @@ impl OsExtensions for Window { }
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os="dragonfly", target_os="openbsd"))] #[cfg(any(target_os = "linux", target_os = "freebsd", target_os="dragonfly", target_os="openbsd"))]
impl OsExtensions for Window { impl OsExtensions for Window {
fn run_os_extensions(&self) { fn run_os_extensions(&self) {
use ::glutin::os::unix::WindowExt; use glutin::os::unix::WindowExt;
use ::x11_dl::xlib::{self, XA_CARDINAL, PropModeReplace}; use x11_dl::xlib::{self, XA_CARDINAL, PropModeReplace};
use ::std::ffi::{CStr}; use std::ffi::{CStr};
use ::std::ptr; use std::ptr;
use ::libc::getpid; use libc::getpid;
let xlib_display = self.glutin_window.get_xlib_display(); let xlib_display = self.window.get_xlib_display();
let xlib_window = self.glutin_window.get_xlib_window(); let xlib_window = self.window.get_xlib_window();
if let (Some(xlib_window), Some(xlib_display)) = (xlib_window, xlib_display) { if let (Some(xlib_window), Some(xlib_display)) = (xlib_window, xlib_display) {
let xlib = xlib::Xlib::open().expect("get xlib"); let xlib = xlib::Xlib::open().expect("get xlib");
@ -370,7 +348,7 @@ impl Proxy {
/// This is useful for triggering a draw when the renderer would otherwise /// This is useful for triggering a draw when the renderer would otherwise
/// be waiting on user input. /// be waiting on user input.
pub fn wakeup_event_loop(&self) { pub fn wakeup_event_loop(&self) {
self.inner.wakeup_event_loop(); self.inner.wakeup().unwrap();
} }
} }
@ -381,6 +359,6 @@ pub trait SetInnerSize<T> {
impl SetInnerSize<Pixels<u32>> for Window { impl SetInnerSize<Pixels<u32>> for Window {
fn set_inner_size<T: ToPoints>(&mut self, size: &T) { fn set_inner_size<T: ToPoints>(&mut self, size: &T) {
let size = size.to_points(self.hidpi_factor()); let size = size.to_points(self.hidpi_factor());
self.glutin_window.set_inner_size(*size.width as _, *size.height as _); self.window.set_inner_size(*size.width as _, *size.height as _);
} }
} }