aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Wilm <jwilm@users.noreply.github.com>2017-07-20 10:50:50 -0700
committerGitHub <noreply@github.com>2017-07-20 10:50:50 -0700
commit8e7dd009a4335e6d6673c1aabb2b92d27f86155c (patch)
tree9e1dddb26693ea2085f700d43ae9bc2d800df52d
parentc8e4f366e740b98377bf6faf157af358b3bc70d2 (diff)
downloadalacritty-8e7dd009a4335e6d6673c1aabb2b92d27f86155c.tar.gz
alacritty-8e7dd009a4335e6d6673c1aabb2b92d27f86155c.zip
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.
-rw-r--r--.travis.yml1
-rw-r--r--Cargo.lock169
-rw-r--r--Cargo.toml4
-rw-r--r--README.md2
-rw-r--r--src/config.rs324
-rw-r--r--src/display.rs14
-rw-r--r--src/event.rs237
-rw-r--r--src/input.rs163
-rw-r--r--src/lib.rs1
-rw-r--r--src/window.rs130
10 files changed, 562 insertions, 483 deletions
diff --git a/.travis.yml b/.travis.yml
index 1ccd0acd..e92c8591 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,6 @@ os:
- osx
rust:
- - 1.15.0
- stable
- nightly
diff --git a/Cargo.lock b/Cargo.lock
index 86a34f14..316da5ba 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -12,8 +12,7 @@ dependencies = [
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"font 0.1.0",
"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)",
- "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glutin 0.9.1 (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)",
"mio 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -60,22 +59,22 @@ dependencies = [
[[package]]
name = "bitflags"
-version = "0.3.3"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
-version = "0.4.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
-version = "0.7.0"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
-version = "0.8.2"
+version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -85,7 +84,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
-version = "0.5.3"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -100,10 +99,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cgl"
-version = "0.1.5"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
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)",
]
@@ -164,11 +163,12 @@ dependencies = [
[[package]]
name = "cocoa"
-version = "0.3.3"
+version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "bitflags 0.9.1 (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)",
"objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -184,15 +184,6 @@ dependencies = [
[[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]]
-name = "core-foundation"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
@@ -201,10 +192,11 @@ dependencies = [
]
[[package]]
-name = "core-foundation-sys"
-version = "0.2.3"
+name = "core-foundation"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
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)",
]
@@ -217,13 +209,11 @@ dependencies = [
]
[[package]]
-name = "core-graphics"
-version = "0.3.2"
+name = "core-foundation-sys"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
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)",
- "serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -247,11 +237,6 @@ dependencies = [
]
[[package]]
-name = "crossbeam"
-version = "0.2.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
name = "dlib"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -411,7 +396,7 @@ dependencies = [
[[package]]
name = "gleam"
-version = "0.2.32"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -420,31 +405,28 @@ dependencies = [
[[package]]
name = "glutin"
-version = "0.6.1"
-source = "git+https://github.com/jwilm/glutin?rev=cc64178d39a1fa06b2c5403117e5e0ef24deeac4#cc64178d39a1fa06b2c5403117e5e0ef24deeac4"
+version = "0.9.1"
+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)",
- "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "cgl 0.1.5 (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.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cgl 0.2.1 (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)",
"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)",
"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)",
- "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)",
"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)",
"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)",
- "wayland-client 0.5.12 (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)",
+ "wayland-client 0.9.9 (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)",
]
@@ -485,11 +467,6 @@ 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]]
-name = "lazy_static"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -549,7 +526,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "memmap"
-version = "0.2.3"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fs2 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -894,11 +871,6 @@ dependencies = [
[[package]]
name = "serde"
-version = "0.7.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "serde"
version = "0.9.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1144,32 +1116,30 @@ dependencies = [
[[package]]
name = "wayland-client"
-version = "0.5.12"
+version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"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)",
- "wayland-scanner 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "wayland-sys 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.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wayland-kbd"
-version = "0.3.6"
+version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"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)",
- "memmap 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "wayland-client 0.5.12 (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.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "wayland-client 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wayland-scanner"
-version = "0.5.11"
+version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1177,21 +1147,21 @@ dependencies = [
[[package]]
name = "wayland-sys"
-version = "0.5.11"
+version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"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]]
name = "wayland-window"
-version = "0.2.3"
+version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
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)",
- "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]]
@@ -1205,6 +1175,32 @@ version = "0.1.1"
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]]
name = "ws2_32-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1249,29 +1245,27 @@ dependencies = [
"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 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.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.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 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 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 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_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 cocoa 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3afe4613f57a171039a98db1773f5840b5743cf85aaf03afb65ddfade4f4a9db"
-"checksum core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25bfd746d203017f7d5cbd31ee5d8e17f94b6521c7af77ece6c9e4b2d4b16c67"
+"checksum cocoa 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4047fed6536f40cc2ae5e7834fb38e382c788270191c4cd69196f89686d076ce"
"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-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-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 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"
@@ -1289,14 +1283,13 @@ dependencies = [
"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 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 glutin 0.6.1 (git+https://github.com/jwilm/glutin?rev=cc64178d39a1fa06b2c5403117e5e0ef24deeac4)" = "<none>"
+"checksum gleam 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "917ee404f414ed77756c12cb44fdcc7cd02f207bf91e1dc91a3ce7da794ec361"
+"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 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 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 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 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"
@@ -1306,7 +1299,7 @@ dependencies = [
"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 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.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"
@@ -1345,7 +1338,6 @@ dependencies = [
"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.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_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"
@@ -1378,13 +1370,14 @@ dependencies = [
"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 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-kbd 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "73bc10e84c1da90777beffecd24742baea17564ffc2a9918af41871c748eb050"
-"checksum wayland-scanner 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "5a1869370d6bafcbabae8724511d803f4e209a70e94ad94a4249269534364f66"
-"checksum wayland-sys 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9633f7fe5de56544215f82eaf1b76bf1b584becf7f08b58cbef4c2c7d10e803a"
-"checksum wayland-window 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "309b69d3a863c9c21422d889fb7d98cf02f8a2ca054960a49243ce5b67ad884c"
+"checksum wayland-client 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)" = "15aaf730e0720ac3c25259bd8af44eacd509ae03e85a3ca64b0d4f7fe9d8da03"
+"checksum wayland-kbd 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "75485a10a894e48f4d21c15c8673ac84a073aef402e15060715fb3501416e58e"
+"checksum wayland-scanner 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)" = "0df992fcdb356c7bde978e7d2d8a407cfd8890370510e11dc0131bfd08cc064c"
+"checksum wayland-sys 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)" = "7b755ecdca8a7de5191b3ddbcbee1055ba4adfe74f6b0d9f299bf060a5e8c8dd"
+"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-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 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"
diff --git a/Cargo.toml b/Cargo.toml
index 4709ea67..971599ad 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,6 @@ notify = "2.6"
bitflags = "0.7"
font = { path = "./font" }
errno = "0.2"
-lazy_static = "0.2.2"
parking_lot = "0.3.1"
serde = "0.9"
serde_yaml = "0.6"
@@ -50,8 +49,7 @@ bench = []
gl_generator = "0.5"
[dependencies.glutin]
-git = "https://github.com/jwilm/glutin"
-rev = "cc64178d39a1fa06b2c5403117e5e0ef24deeac4"
+version = "0.9"
[profile.release]
lto = true
diff --git a/README.md b/README.md
index 5d591dbc..26e97b26 100644
--- a/README.md
+++ b/README.md
@@ -65,7 +65,7 @@ makepkg -isr
```
3. Make sure you have the right Rust compiler installed. Alacritty requires at
- least 1.15. Run
+ least 1.18. Run
```sh
rustup override set stable
diff --git a/src/config.rs b/src/config.rs
index e4f17ae7..59c675cd 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -21,6 +21,8 @@ use serde::de::Error as SerdeError;
use serde::de::{Visitor, MapVisitor, Unexpected};
use notify::{Watcher as WatcherApi, RecommendedWatcher as FileWatcher, op};
+use glutin::ModifiersState;
+
use input::{Action, Binding, MouseBinding, KeyBinding};
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
/// impl below.
-struct ModsWrapper(::glutin::Mods);
+struct ModsWrapper(ModifiersState);
impl ModsWrapper {
- fn into_inner(self) -> ::glutin::Mods {
+ fn into_inner(self) -> ModifiersState {
self.0
}
}
@@ -321,14 +323,13 @@ impl de::Deserialize for ModsWrapper {
fn visit_str<E>(self, value: &str) -> ::std::result::Result<ModsWrapper, E>
where E: de::Error,
{
- use ::glutin::{mods, Mods};
- let mut res = Mods::empty();
+ let mut res = ModifiersState::default();
for modifier in value.split('|') {
match modifier.trim() {
- "Command" | "Super" => res |= mods::SUPER,
- "Shift" => res |= mods::SHIFT,
- "Alt" | "Option" => res |= mods::ALT,
- "Control" => res |= mods::CONTROL,
+ "Command" | "Super" => res.logo = true,
+ "Shift" => res.shift = true,
+ "Alt" | "Option" => res.alt = true,
+ "Control" => res.ctrl = true,
_ => err_println!("unknown modifier {:?}", modifier),
}
}
@@ -482,7 +483,7 @@ impl de::Deserialize for MouseButton {
struct RawBinding {
key: Option<::glutin::VirtualKeyCode>,
mouse: Option<::glutin::MouseButton>,
- mods: ::glutin::Mods,
+ mods: ModifiersState,
mode: TermMode,
notmode: TermMode,
action: Action,
@@ -583,7 +584,7 @@ impl de::Deserialize for RawBinding {
) -> ::std::result::Result<RawBinding, V::Error>
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 chars: Option<String> = 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 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() {
return Err(V::Error::custom("bindings require mouse button or key"));
@@ -1644,158 +1645,159 @@ enum Key {
impl Key {
fn to_glutin_key(&self) -> ::glutin::VirtualKeyCode {
+ use ::glutin::VirtualKeyCode::*;
// Thank you, vim macros!
match *self {
- Key::Key1 => ::glutin::VirtualKeyCode::Key1,
- Key::Key2 => ::glutin::VirtualKeyCode::Key2,
- Key::Key3 => ::glutin::VirtualKeyCode::Key3,
- Key::Key4 => ::glutin::VirtualKeyCode::Key4,
- Key::Key5 => ::glutin::VirtualKeyCode::Key5,
- Key::Key6 => ::glutin::VirtualKeyCode::Key6,
- Key::Key7 => ::glutin::VirtualKeyCode::Key7,
- Key::Key8 => ::glutin::VirtualKeyCode::Key8,
- Key::Key9 => ::glutin::VirtualKeyCode::Key9,
- Key::Key0 => ::glutin::VirtualKeyCode::Key0,
- Key::A => ::glutin::VirtualKeyCode::A,
- Key::B => ::glutin::VirtualKeyCode::B,
- Key::C => ::glutin::VirtualKeyCode::C,
- Key::D => ::glutin::VirtualKeyCode::D,
- Key::E => ::glutin::VirtualKeyCode::E,
- Key::F => ::glutin::VirtualKeyCode::F,
- Key::G => ::glutin::VirtualKeyCode::G,
- Key::H => ::glutin::VirtualKeyCode::H,
- Key::I => ::glutin::VirtualKeyCode::I,
- Key::J => ::glutin::VirtualKeyCode::J,
- Key::K => ::glutin::VirtualKeyCode::K,
- Key::L => ::glutin::VirtualKeyCode::L,
- Key::M => ::glutin::VirtualKeyCode::M,
- Key::N => ::glutin::VirtualKeyCode::N,
- Key::O => ::glutin::VirtualKeyCode::O,
- Key::P => ::glutin::VirtualKeyCode::P,
- Key::Q => ::glutin::VirtualKeyCode::Q,
- Key::R => ::glutin::VirtualKeyCode::R,
- Key::S => ::glutin::VirtualKeyCode::S,
- Key::T => ::glutin::VirtualKeyCode::T,
- Key::U => ::glutin::VirtualKeyCode::U,
- Key::V => ::glutin::VirtualKeyCode::V,
- Key::W => ::glutin::VirtualKeyCode::W,
- Key::X => ::glutin::VirtualKeyCode::X,
- Key::Y => ::glutin::VirtualKeyCode::Y,
- Key::Z => ::glutin::VirtualKeyCode::Z,
- Key::Escape => ::glutin::VirtualKeyCode::Escape,
- Key::F1 => ::glutin::VirtualKeyCode::F1,
- Key::F2 => ::glutin::VirtualKeyCode::F2,
- Key::F3 => ::glutin::VirtualKeyCode::F3,
- Key::F4 => ::glutin::VirtualKeyCode::F4,
- Key::F5 => ::glutin::VirtualKeyCode::F5,
- Key::F6 => ::glutin::VirtualKeyCode::F6,
- Key::F7 => ::glutin::VirtualKeyCode::F7,
- Key::F8 => ::glutin::VirtualKeyCode::F8,
- Key::F9 => ::glutin::VirtualKeyCode::F9,
- Key::F10 => ::glutin::VirtualKeyCode::F10,
- Key::F11 => ::glutin::VirtualKeyCode::F11,
- Key::F12 => ::glutin::VirtualKeyCode::F12,
- Key::F13 => ::glutin::VirtualKeyCode::F13,
- Key::F14 => ::glutin::VirtualKeyCode::F14,
- Key::F15 => ::glutin::VirtualKeyCode::F15,
- Key::Snapshot => ::glutin::VirtualKeyCode::Snapshot,
- Key::Scroll => ::glutin::VirtualKeyCode::Scroll,
- Key::Pause => ::glutin::VirtualKeyCode::Pause,
- Key::Insert => ::glutin::VirtualKeyCode::Insert,
- Key::Home => ::glutin::VirtualKeyCode::Home,
- Key::Delete => ::glutin::VirtualKeyCode::Delete,
- Key::End => ::glutin::VirtualKeyCode::End,
- Key::PageDown => ::glutin::VirtualKeyCode::PageDown,
- Key::PageUp => ::glutin::VirtualKeyCode::PageUp,
- Key::Left => ::glutin::VirtualKeyCode::Left,
- Key::Up => ::glutin::VirtualKeyCode::Up,
- Key::Right => ::glutin::VirtualKeyCode::Right,
- Key::Down => ::glutin::VirtualKeyCode::Down,
- Key::Back => ::glutin::VirtualKeyCode::Back,
- Key::Return => ::glutin::VirtualKeyCode::Return,
- Key::Space => ::glutin::VirtualKeyCode::Space,
- Key::Compose => ::glutin::VirtualKeyCode::Compose,
- Key::Numlock => ::glutin::VirtualKeyCode::Numlock,
- Key::Numpad0 => ::glutin::VirtualKeyCode::Numpad0,
- Key::Numpad1 => ::glutin::VirtualKeyCode::Numpad1,
- Key::Numpad2 => ::glutin::VirtualKeyCode::Numpad2,
- Key::Numpad3 => ::glutin::VirtualKeyCode::Numpad3,
- Key::Numpad4 => ::glutin::VirtualKeyCode::Numpad4,
- Key::Numpad5 => ::glutin::VirtualKeyCode::Numpad5,
- Key::Numpad6 => ::glutin::VirtualKeyCode::Numpad6,
- Key::Numpad7 => ::glutin::VirtualKeyCode::Numpad7,
- Key::Numpad8 => ::glutin::VirtualKeyCode::Numpad8,
- Key::Numpad9 => ::glutin::VirtualKeyCode::Numpad9,
- Key::AbntC1 => ::glutin::VirtualKeyCode::AbntC1,
- Key::AbntC2 => ::glutin::VirtualKeyCode::AbntC2,
- Key::Add => ::glutin::VirtualKeyCode::Add,
- Key::Apostrophe => ::glutin::VirtualKeyCode::Apostrophe,
- Key::Apps => ::glutin::VirtualKeyCode::Apps,
- Key::At => ::glutin::VirtualKeyCode::At,
- Key::Ax => ::glutin::VirtualKeyCode::Ax,
- Key::Backslash => ::glutin::VirtualKeyCode::Backslash,
- Key::Calculator => ::glutin::VirtualKeyCode::Calculator,
- Key::Capital => ::glutin::VirtualKeyCode::Capital,
- Key::Colon => ::glutin::VirtualKeyCode::Colon,
- Key::Comma => ::glutin::VirtualKeyCode::Comma,
- Key::Convert => ::glutin::VirtualKeyCode::Convert,
- Key::Decimal => ::glutin::VirtualKeyCode::Decimal,
- Key::Divide => ::glutin::VirtualKeyCode::Divide,
- Key::Equals => ::glutin::VirtualKeyCode::Equals,
- Key::Grave => ::glutin::VirtualKeyCode::Grave,
- Key::Kana => ::glutin::VirtualKeyCode::Kana,
- Key::Kanji => ::glutin::VirtualKeyCode::Kanji,
- Key::LAlt => ::glutin::VirtualKeyCode::LAlt,
- Key::LBracket => ::glutin::VirtualKeyCode::LBracket,
- Key::LControl => ::glutin::VirtualKeyCode::LControl,
- Key::LMenu => ::glutin::VirtualKeyCode::LMenu,
- Key::LShift => ::glutin::VirtualKeyCode::LShift,
- Key::LWin => ::glutin::VirtualKeyCode::LWin,
- Key::Mail => ::glutin::VirtualKeyCode::Mail,
- Key::MediaSelect => ::glutin::VirtualKeyCode::MediaSelect,
- Key::MediaStop => ::glutin::VirtualKeyCode::MediaStop,
- Key::Minus => ::glutin::VirtualKeyCode::Minus,
- Key::Multiply => ::glutin::VirtualKeyCode::Multiply,
- Key::Mute => ::glutin::VirtualKeyCode::Mute,
- Key::MyComputer => ::glutin::VirtualKeyCode::MyComputer,
- Key::NavigateForward => ::glutin::VirtualKeyCode::NavigateForward,
- Key::NavigateBackward => ::glutin::VirtualKeyCode::NavigateBackward,
- Key::NextTrack => ::glutin::VirtualKeyCode::NextTrack,
- Key::NoConvert => ::glutin::VirtualKeyCode::NoConvert,
- Key::NumpadComma => ::glutin::VirtualKeyCode::NumpadComma,
- Key::NumpadEnter => ::glutin::VirtualKeyCode::NumpadEnter,
- Key::NumpadEquals => ::glutin::VirtualKeyCode::NumpadEquals,
- Key::OEM102 => ::glutin::VirtualKeyCode::OEM102,
- Key::Period => ::glutin::VirtualKeyCode::Period,
- Key::PlayPause => ::glutin::VirtualKeyCode::PlayPause,
- Key::Power => ::glutin::VirtualKeyCode::Power,
- Key::PrevTrack => ::glutin::VirtualKeyCode::PrevTrack,
- Key::RAlt => ::glutin::VirtualKeyCode::RAlt,
- Key::RBracket => ::glutin::VirtualKeyCode::RBracket,
- Key::RControl => ::glutin::VirtualKeyCode::RControl,
- Key::RMenu => ::glutin::VirtualKeyCode::RMenu,
- Key::RShift => ::glutin::VirtualKeyCode::RShift,
- Key::RWin => ::glutin::VirtualKeyCode::RWin,
- Key::Semicolon => ::glutin::VirtualKeyCode::Semicolon,
- Key::Slash => ::glutin::VirtualKeyCode::Slash,
- Key::Sleep => ::glutin::VirtualKeyCode::Sleep,
- Key::Stop => ::glutin::VirtualKeyCode::Stop,
- Key::Subtract => ::glutin::VirtualKeyCode::Subtract,
- Key::Sysrq => ::glutin::VirtualKeyCode::Sysrq,
- Key::Tab => ::glutin::VirtualKeyCode::Tab,
- Key::Underline => ::glutin::VirtualKeyCode::Underline,
- Key::Unlabeled => ::glutin::VirtualKeyCode::Unlabeled,
- Key::VolumeDown => ::glutin::VirtualKeyCode::VolumeDown,
- Key::VolumeUp => ::glutin::VirtualKeyCode::VolumeUp,
- Key::Wake => ::glutin::VirtualKeyCode::Wake,
- Key::WebBack => ::glutin::VirtualKeyCode::WebBack,
- Key::WebFavorites => ::glutin::VirtualKeyCode::WebFavorites,
- Key::WebForward => ::glutin::VirtualKeyCode::WebForward,
- Key::WebHome => ::glutin::VirtualKeyCode::WebHome,
- Key::WebRefresh => ::glutin::VirtualKeyCode::WebRefresh,
- Key::WebSearch => ::glutin::VirtualKeyCode::WebSearch,
- Key::WebStop => ::glutin::VirtualKeyCode::WebStop,
- Key::Yen => ::glutin::VirtualKeyCode::Yen,
+ Key::Key1 => Key1,
+ Key::Key2 => Key2,
+ Key::Key3 => Key3,
+ Key::Key4 => Key4,
+ Key::Key5 => Key5,
+ Key::Key6 => Key6,
+ Key::Key7 => Key7,
+ Key::Key8 => Key8,
+ Key::Key9 => Key9,
+ Key::Key0 => Key0,
+ Key::A => A,
+ Key::B => B,
+ Key::C => C,
+ Key::D => D,
+ Key::E => E,
+ Key::F => F,
+ Key::G => G,
+ Key::H => H,
+ Key::I => I,
+ Key::J => J,
+ Key::K => K,
+ Key::L => L,
+ Key::M => M,
+ Key::N => N,
+ Key::O => O,
+ Key::P => P,
+ Key::Q => Q,
+ Key::R => R,
+ Key::S => S,
+ Key::T => T,
+ Key::U => U,
+ Key::V => V,
+ Key::W => W,
+ Key::X => X,
+ Key::Y => Y,
+ Key::Z => Z,
+ Key::Escape => Escape,
+ Key::F1 => F1,
+ Key::F2 => F2,
+ Key::F3 => F3,
+ Key::F4 => F4,
+ Key::F5 => F5,
+ Key::F6 => F6,
+ Key::F7 => F7,
+ Key::F8 => F8,
+ Key::F9 => F9,
+ Key::F10 => F10,
+ Key::F11 => F11,
+ Key::F12 => F12,
+ Key::F13 => F13,
+ Key::F14 => F14,
+ Key::F15 => F15,
+ Key::Snapshot => Snapshot,
+ Key::Scroll => Scroll,
+ Key::Pause => Pause,
+ Key::Insert => Insert,
+ Key::Home => Home,
+ Key::Delete => Delete,
+ Key::End => End,
+ Key::PageDown => PageDown,
+ Key::PageUp => PageUp,
+ Key::Left => Left,
+ Key::Up => Up,
+ Key::Right => Right,
+ Key::Down => Down,
+ Key::Back => Back,
+ Key::Return => Return,
+ Key::Space => Space,
+ Key::Compose => Compose,
+ Key::Numlock => Numlock,
+ Key::Numpad0 => Numpad0,
+ Key::Numpad1 => Numpad1,
+ Key::Numpad2 => Numpad2,
+ Key::Numpad3 => Numpad3,
+ Key::Numpad4 => Numpad4,
+ Key::Numpad5 => Numpad5,
+ Key::Numpad6 => Numpad6,
+ Key::Numpad7 => Numpad7,
+ Key::Numpad8 => Numpad8,
+ Key::Numpad9 => Numpad9,
+ Key::AbntC1 => AbntC1,
+ Key::AbntC2 => AbntC2,
+ Key::Add => Add,
+ Key::Apostrophe => Apostrophe,
+ Key::Apps => Apps,
+ Key::At => At,
+ Key::Ax => Ax,
+ Key::Backslash => Backslash,
+ Key::Calculator => Calculator,
+ Key::Capital => Capital,
+ Key::Colon => Colon,
+ Key::Comma => Comma,
+ Key::Convert => Convert,
+ Key::Decimal => Decimal,
+ Key::Divide => Divide,
+ Key::Equals => Equals,
+ Key::Grave => Grave,
+ Key::Kana => Kana,
+ Key::Kanji => Kanji,
+ Key::LAlt => LAlt,
+ Key::LBracket => LBracket,
+ Key::LControl => LControl,
+ Key::LMenu => LMenu,
+ Key::LShift => LShift,
+ Key::LWin => LWin,
+ Key::Mail => Mail,
+ Key::MediaSelect => MediaSelect,
+ Key::MediaStop => MediaStop,
+ Key::Minus => Minus,
+ Key::Multiply => Multiply,
+ Key::Mute => Mute,
+ Key::MyComputer => MyComputer,
+ Key::NavigateForward => NavigateForward,
+ Key::NavigateBackward => NavigateBackward,
+ Key::NextTrack => NextTrack,
+ Key::NoConvert => NoConvert,
+ Key::NumpadComma => NumpadComma,
+ Key::NumpadEnter => NumpadEnter,
+ Key::NumpadEquals => NumpadEquals,
+ Key::OEM102 => OEM102,
+ Key::Period => Period,
+ Key::PlayPause => PlayPause,
+ Key::Power => Power,
+ Key::PrevTrack => PrevTrack,
+ Key::RAlt => RAlt,
+ Key::RBracket => RBracket,
+ Key::RControl => RControl,
+ Key::RMenu => RMenu,
+ Key::RShift => RShift,
+ Key::RWin => RWin,
+ Key::Semicolon => Semicolon,
+ Key::Slash => Slash,
+ Key::Sleep => Sleep,
+ Key::Stop => Stop,
+ Key::Subtract => Subtract,
+ Key::Sysrq => Sysrq,
+ Key::Tab => Tab,
+ Key::Underline => Underline,
+ Key::Unlabeled => Unlabeled,
+ Key::VolumeDown => VolumeDown,
+ Key::VolumeUp => VolumeUp,
+ Key::Wake => Wake,
+ Key::WebBack => WebBack,
+ Key::WebFavorites => WebFavorites,
+ Key::WebForward => WebForward,
+ Key::WebHome => WebHome,
+ Key::WebRefresh => WebRefresh,
+ Key::WebSearch => WebSearch,
+ Key::WebStop => WebStop,
+ Key::Yen => Yen,
}
}
}
diff --git a/src/display.rs b/src/display.rs
index 00427e34..0f2c526f 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -211,7 +211,7 @@ impl Display {
// Clear screen
renderer.with_api(config, &size_info, 0. /* visual bell intensity */, |api| api.clear());
- let mut display = Display {
+ Ok(Display {
window: window,
renderer: renderer,
glyph_cache: glyph_cache,
@@ -220,16 +220,7 @@ impl Display {
rx: rx,
meter: Meter::new(),
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]
@@ -267,6 +258,7 @@ impl Display {
item.on_resize(size)
}
+ self.window.resize(w, h);
self.renderer.resize(w as i32, h as i32);
}
diff --git a/src/event.rs b/src/event.rs
index 2987fce0..f91b3129 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -7,7 +7,7 @@ use std::time::{Instant};
use serde_json as json;
use parking_lot::MutexGuard;
-use glutin::{self, ElementState};
+use glutin::{self, ModifiersState, Event, ElementState};
use copypasta::{Clipboard, Load, Store};
use config::{self, Config};
@@ -37,6 +37,9 @@ pub struct ActionContext<'a, N: 'a> {
pub size_info: &'a SizeInfo,
pub mouse: &'a mut Mouse,
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> {
@@ -108,6 +111,21 @@ impl<'a, N: Notify + 'a> input::ActionContext for ActionContext<'a, N> {
fn mouse_mut(&mut self) -> &mut 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 {
@@ -164,6 +182,10 @@ pub struct Processor<N> {
pub selection: Option<Selection>,
hide_cursor_when_typing: bool,
hide_cursor: bool,
+ received_count: usize,
+ suppress_chars: bool,
+ last_modifiers: ModifiersState,
+ pending_events: Vec<Event>,
}
/// Notify that the terminal was resized
@@ -202,6 +224,10 @@ impl<N: Notify> Processor<N> {
size_info: size_info,
hide_cursor_when_typing: config.hide_cursor_when_typing(),
hide_cursor: false,
+ received_count: 0,
+ suppress_chars: false,
+ last_modifiers: Default::default(),
+ pending_events: Vec::with_capacity(4),
}
}
@@ -210,77 +236,95 @@ impl<N: Notify> Processor<N> {
/// Doesn't take self mutably due to borrow checking. Kinda uggo but w/e.
fn handle_event<'a>(
processor: &mut input::Processor<'a, ActionContext<'a, N>>,
- event: glutin::Event,
+ event: Event,
ref_test: bool,
resize_tx: &mpsc::Sender<(u32, u32)>,
hide_cursor: &mut bool,
) {
match event {
- glutin::Event::Closed => {
- if ref_test {
- // dump grid state
- let grid = processor.ctx.terminal.grid();
-
- let serialized_grid = json::to_string(&grid)
- .expect("serialize grid");
-
- let serialized_size = json::to_string(processor.ctx.terminal.size_info())
- .expect("serialize size");
-
- File::create("./grid.json")
- .and_then(|mut f| f.write_all(serialized_grid.as_bytes()))
- .expect("write grid.json");
-
- File::create("./size.json")
- .and_then(|mut f| f.write_all(serialized_size.as_bytes()))
- .expect("write size.json");
- }
-
- // FIXME should do a more graceful shutdown
- ::std::process::exit(0);
- },
- glutin::Event::Resized(w, h) => {
- resize_tx.send((w, h)).expect("send new size");
- processor.ctx.terminal.dirty = true;
- },
- glutin::Event::KeyboardInput(state, _code, key, mods, string) => {
- // Ensure that key event originates from our window. For example using a shortcut
- // to switch windows could generate a release key event.
- if state == ElementState::Pressed {
- *hide_cursor = true;
+ // Pass on device events
+ Event::DeviceEvent { .. } => (),
+ Event::WindowEvent { event, .. } => {
+ use glutin::WindowEvent::*;
+ match event {
+ Closed => {
+ if ref_test {
+ // dump grid state
+ let grid = processor.ctx.terminal.grid();
+
+ let serialized_grid = json::to_string(&grid)
+ .expect("serialize grid");
+
+ let serialized_size = json::to_string(processor.ctx.terminal.size_info())
+ .expect("serialize size");
+
+ File::create("./grid.json")
+ .and_then(|mut f| f.write_all(serialized_grid.as_bytes()))
+ .expect("write grid.json");
+
+ File::create("./size.json")
+ .and_then(|mut f| f.write_all(serialized_size.as_bytes()))
+ .expect("write size.json");
+ }
+
+ // FIXME should do a more graceful shutdown
+ ::std::process::exit(0);
+ },
+ Resized(w, h) => {
+ resize_tx.send((w, h)).expect("send new size");
+ processor.ctx.terminal.dirty = true;
+ },
+ KeyboardInput { input, .. } => {
+ let glutin::KeyboardInput { state, virtual_keycode, modifiers, .. } = input;
+ processor.process_key(state, virtual_keycode, &modifiers);
+ if state == ElementState::Pressed {
+ // Hide cursor while typing
+ *hide_cursor = true;
+ }
+ },
+ ReceivedCharacter(c) => {
+ processor.received_char(c);
+ },
+ MouseInput { state, button, .. } => {
+ *hide_cursor = false;
+ processor.mouse_input(state, button);
+ processor.ctx.terminal.dirty = true;
+ },
+ 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 y = limit(y, 0, processor.ctx.size_info.height as i32);
+
+ *hide_cursor = false;
+ processor.mouse_moved(x as u32, y as u32);
+
+ if !processor.ctx.selection.is_none() {
+ processor.ctx.terminal.dirty = true;
+ }
+ },
+ MouseWheel { delta, phase, .. } => {
+ *hide_cursor = false;
+ processor.on_mouse_wheel(delta, phase);
+ },
+ Refresh => {
+ processor.ctx.terminal.dirty = true;
+ },
+ Focused(is_focused) => {
+ if is_focused {
+ processor.ctx.terminal.dirty = true;
+ } else {
+ *hide_cursor = false;
+ }
+
+ processor.on_focus_change(is_focused);
+ }
+ _ => (),
}
- processor.process_key(state, key, mods, string);
- },
- glutin::Event::MouseInput(state, button) => {
- *hide_cursor = false;
- processor.mouse_input(state, button);
- processor.ctx.terminal.dirty = true;
},
- glutin::Event::MouseMoved(x, y) => {
- let x = limit(x, 0, processor.ctx.size_info.width as i32);
- let y = limit(y, 0, processor.ctx.size_info.height as i32);
-
- *hide_cursor = false;
- processor.mouse_moved(x as u32, y as u32);
- },
- glutin::Event::MouseWheel(scroll_delta, touch_phase) => {
- *hide_cursor = false;
- processor.on_mouse_wheel(scroll_delta, touch_phase);
- },
- glutin::Event::Refresh |
- glutin::Event::Awakened => {
+ Event::Awakened => {
processor.ctx.terminal.dirty = true;
- },
- glutin::Event::Focused(is_focused) => {
- if is_focused {
- processor.ctx.terminal.dirty = true;
- } else {
- *hide_cursor = false;
- }
-
- processor.on_focus_change(is_focused);
}
- _ => (),
}
}
@@ -296,32 +340,28 @@ impl<N: Notify> Processor<N> {
// be blocked the entire time we wait for input!
let mut terminal;
+ self.pending_events.clear();
+
{
// Ditto on lazy initialization for context and processor.
let context;
let mut processor: input::Processor<ActionContext<N>>;
- // Convenience macro which curries most arguments to handle_event.
- 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 print_events = self.print_events;
- let event = if self.wait_for_event {
- window.wait_events().next()
- } else {
- None
- };
+ let ref_test = self.ref_test;
+ let resize_tx = &self.resize_tx;
+
+ 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();
@@ -332,21 +372,40 @@ impl<N: Notify> Processor<N> {
mouse: &mut self.mouse,
size_info: &self.size_info,
selection_modified: false,
+ received_count: &mut self.received_count,
+ suppress_chars: &mut self.suppress_chars,
+ last_modifiers: &mut self.last_modifiers,
};
processor = input::Processor {
ctx: context,
mouse_config: &self.mouse_config,
key_bindings: &self.key_bindings[..],
- mouse_bindings: &self.mouse_bindings[..]
+ mouse_bindings: &self.mouse_bindings[..],
};
- if let Some(event) = event {
- process!(event);
- }
+ // Scope needed to that hide_cursor isn't borrowed after the scope
+ // 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() {
- process!(event);
+ window.poll_events(process);
}
if self.hide_cursor_when_typing {
diff --git a/src/input.rs b/src/input.rs
index 468e9ef3..6e3d6d0d 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -24,9 +24,8 @@ use std::process::Command;
use std::time::Instant;
use copypasta::{Clipboard, Load, Buffer};
-use glutin::{ElementState, VirtualKeyCode, MouseButton};
-use glutin::{Mods, mods};
-use glutin::{TouchPhase, MouseScrollDelta};
+use glutin::{ElementState, VirtualKeyCode, MouseButton, TouchPhase, MouseScrollDelta};
+use glutin::ModifiersState;
use config;
use event::{ClickState, Mouse};
@@ -60,6 +59,9 @@ pub trait ActionContext {
fn line_selection(&mut self, point: Point);
fn mouse_mut(&mut self) -> &mut Mouse;
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
@@ -68,7 +70,7 @@ pub trait ActionContext {
#[derive(Debug, Clone)]
pub struct Binding<T> {
/// Modifier keys required to activate binding
- pub mods: Mods,
+ pub mods: ModifiersState,
/// String to send to pty if mods and mode match
pub action: Action,
@@ -96,7 +98,7 @@ impl<T: Eq> Binding<T> {
fn is_triggered_by(
&self,
mode: TermMode,
- mods: &Mods,
+ mods: &ModifiersState,
input: &T
) -> bool {
// 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)
}
+ /// Check that two mods descriptions for equivalence
+ ///
+ /// Optimized to use single check instead of four (one per modifier)
#[inline]
- fn mods_match(&self, mods: &Mods) -> bool {
- self.mods.is_all() || *mods == self.mods
+ fn mods_match(&self, mods: &ModifiersState) -> bool {
+ 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;
}
- 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(
&mut self,
state: ElementState,
key: Option<VirtualKeyCode>,
- mods: Mods,
- string: Option<String>,
+ mods: &ModifiersState,
) {
- if let Some(key) = key {
- // Ignore release events
- if state == ElementState::Released {
- return;
- }
+ match (key, state) {
+ (Some(key), ElementState::Pressed) => {
+ *self.ctx.last_modifiers() = *mods;
+ *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) {
- return;
- }
+ /// Process a received character
+ pub fn received_char(&mut self, c: char) {
+ if !*self.ctx.suppress_chars() {
+ 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());
+ }
- // 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');
+ let mut bytes = Vec::with_capacity(utf8_len);
+ unsafe {
+ bytes.set_len(utf8_len);
+ c.encode_utf8(&mut bytes[..]);
}
- self.ctx.write_to_pty(string.into_bytes());
- self.ctx.clear_selection();
+ 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.
///
/// 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 {
- 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.execute(&mut self.ctx);
return true;
@@ -472,9 +495,9 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
/// for its action to be 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 {
- 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.execute(&mut self.ctx);
return true;
@@ -490,7 +513,7 @@ mod tests {
use std::borrow::Cow;
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 event::{Mouse, ClickState};
@@ -515,6 +538,9 @@ mod tests {
pub size_info: &'a SizeInfo,
pub mouse: &'a mut Mouse,
pub last_action: MultiClick,
+ pub received_count: usize,
+ pub suppress_chars: bool,
+ pub last_modifiers: ModifiersState,
}
impl <'a>super::ActionContext for ActionContext<'a> {
@@ -555,6 +581,15 @@ mod tests {
fn mouse_mut(&mut self) -> &mut 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 {
@@ -590,6 +625,9 @@ mod tests {
mouse: &mut mouse,
size_info: &size,
last_action: MultiClick::None,
+ received_count: 0,
+ suppress_chars: false,
+ last_modifiers: ModifiersState::default(),
};
let mut processor = Processor {
@@ -606,8 +644,8 @@ mod tests {
mouse_bindings: &config.mouse_bindings()[..],
};
- if let Event::MouseInput(state, input) = $input {
- processor.mouse_input(state, input);
+ if let Event::WindowEvent { event: WindowEvent::MouseInput { state, button, .. }, .. } = $input {
+ processor.mouse_input(state, button);
};
assert!(match mouse.click_state {
@@ -640,7 +678,14 @@ mod tests {
test_clickstate! {
name: single_click,
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,
last_action: MultiClick::None
}
@@ -648,7 +693,14 @@ mod tests {
test_clickstate! {
name: double_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,
last_action: MultiClick::DoubleClick
}
@@ -656,72 +708,79 @@ mod tests {
test_clickstate! {
name: triple_click,
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,
last_action: MultiClick::TripleClick
}
test_process_binding! {
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,
mode: mode::NONE,
- mods: mods::SHIFT
+ mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false }
}
test_process_binding! {
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,
mode: mode::NONE,
- mods: mods::NONE
+ mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }
}
test_process_binding! {
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,
mode: mode::NONE,
- mods: mods::CONTROL
+ mods: ModifiersState { ctrl: true, shift: false, alt: false, logo: false }
}
test_process_binding! {
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,
mode: mode::NONE,
- mods: mods::NONE
+ mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }
}
test_process_binding! {
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,
mode: mode::APP_CURSOR,
- mods: mods::NONE
+ mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }
}
test_process_binding! {
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,
mode: mode::NONE,
- mods: mods::NONE
+ mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }
}
test_process_binding! {
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,
mode: mode::APP_CURSOR | mode::APP_KEYPAD,
- mods: mods::NONE
+ mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }
}
test_process_binding! {
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,
mode: mode::NONE,
- mods: mods::SUPER | mods::ALT
+ mods: ModifiersState { shift: false, ctrl: false, alt: true, logo: true }
}
}
diff --git a/src/lib.rs b/src/lib.rs
index 684e89af..90f4aa5d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -24,7 +24,6 @@
#[macro_use] extern crate bitflags;
#[macro_use] extern crate clap;
-#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
#[macro_use] extern crate serde_derive;
diff --git a/src/window.rs b/src/window.rs
index d0a51e6b..4fbe8631 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -14,32 +14,16 @@
use std::convert::From;
use std::fmt::{self, Display};
use std::ops::Deref;
-use std::sync::Mutex;
use gl;
-use glutin;
-
-/// 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);
-}
+use glutin::{self, EventsLoop, WindowBuilder, Event, CursorState, ControlFlow, ContextBuilder};
+use glutin::GlContext;
/// Window errors
#[derive(Debug)]
pub enum Error {
/// Error creating the window
- Creation(glutin::CreationError),
+ ContextCreation(glutin::CreationError),
/// Error manipulating the rendering context
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
pub struct Window {
- glutin_window: glutin::Window,
+ event_loop: EventsLoop,
+ window: glutin::GlWindow,
cursor_visible: bool,
}
/// Threadsafe APIs for the window
pub struct Proxy {
- inner: glutin::WindowProxy,
+ inner: glutin::EventsLoopProxy,
}
/// 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 {
fn cause(&self) -> Option<&::std::error::Error> {
match *self {
- Error::Creation(ref err) => Some(err),
+ Error::ContextCreation(ref err) => Some(err),
Error::Context(ref err) => Some(err),
}
}
fn description(&self) -> &str {
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",
}
}
@@ -168,8 +153,8 @@ impl ::std::error::Error for Error {
impl Display for Error {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
match *self {
- Error::Creation(ref err) => {
- write!(f, "Error creating glutin::Window; {}", err)
+ Error::ContextCreation(ref err) => {
+ write!(f, "Error creating GL context; {}", err)
},
Error::Context(ref err) => {
write!(f, "Error operating on render context; {}", err)
@@ -180,7 +165,7 @@ impl Display for Error {
impl From<glutin::CreationError> for Error {
fn from(val: glutin::CreationError) -> Error {
- Error::Creation(val)
+ Error::ContextCreation(val)
}
}
@@ -197,28 +182,24 @@ impl Window {
pub fn new(
title: &str
) -> Result<Window> {
- /// Create a glutin::Window
- let mut window = glutin::WindowBuilder::new()
- .with_vsync()
- .with_title(title)
- .build()?;
-
- /// 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)));
+ let event_loop = EventsLoop::new();
+ let window = WindowBuilder::new()
+ .with_title(title);
+ let context = ContextBuilder::new()
+ .with_vsync(true);
+ let window = ::glutin::GlWindow::new(window, context, &event_loop)?;
/// Set OpenGL symbol loader
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 {
window.make_current()?;
}
let window = Window {
- glutin_window: window,
+ event_loop: event_loop,
+ window: window,
cursor_visible: true,
};
@@ -233,74 +214,71 @@ impl Window {
/// rasterization depend on DPI and scale factor.
pub fn device_properties(&self) -> 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>>> {
- self.glutin_window
+ self.window
.get_inner_size_pixels()
.map(|(w, h)| Size { width: Pixels(w), height: Pixels(h) })
}
#[inline]
pub fn hidpi_factor(&self) -> f32 {
- self.glutin_window.hidpi_factor()
+ self.window.hidpi_factor()
}
#[inline]
pub fn create_window_proxy(&self) -> Proxy {
Proxy {
- inner: self.glutin_window.create_window_proxy(),
+ inner: self.event_loop.create_proxy(),
}
}
#[inline]
pub fn swap_buffers(&self) -> Result<()> {
- self.glutin_window
+ self.window
.swap_buffers()
.map_err(From::from)
}
/// Poll for any available events
#[inline]
- pub fn poll_events(&self) -> glutin::PollEventsIterator {
- self.glutin_window.poll_events()
+ pub fn poll_events<F>(&mut self, func: F)
+ 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
- ///
- /// FIXME should return our own type
#[inline]
- pub fn wait_events(&self) -> glutin::WaitEventsIterator {
- self.glutin_window.wait_events()
+ pub fn wait_events<F>(&mut self, func: F)
+ where F: FnMut(Event) -> ControlFlow
+ {
+ self.event_loop.run_forever(func);
}
/// Set the window title
#[inline]
pub fn set_title(&self, title: &str) {
- self.glutin_window.set_title(title);
+ self.window.set_title(title);
}
/// Set cursor visible
pub fn set_cursor_visible(&mut self, visible: bool) {
if visible != self.cursor_visible {
self.cursor_visible = visible;
- self.glutin_window.set_cursor_state(if visible { glutin::CursorState::Normal }
- else { glutin::CursorState::Hide }).unwrap();
+ self.window.set_cursor_state(if visible {
+ CursorState::Normal
+ } else {
+ CursorState::Hide
+ }).unwrap();
}
}
@@ -308,7 +286,7 @@ impl Window {
pub fn get_window_id(&self) -> Option<usize> {
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),
None => None
}
@@ -330,14 +308,14 @@ impl OsExtensions for Window { }
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os="dragonfly", target_os="openbsd"))]
impl OsExtensions for Window {
fn run_os_extensions(&self) {
- use ::glutin::os::unix::WindowExt;
- use ::x11_dl::xlib::{self, XA_CARDINAL, PropModeReplace};
- use ::std::ffi::{CStr};
- use ::std::ptr;
- use ::libc::getpid;
+ use glutin::os::unix::WindowExt;
+ use x11_dl::xlib::{self, XA_CARDINAL, PropModeReplace};
+ use std::ffi::{CStr};
+ use std::ptr;
+ use libc::getpid;
- let xlib_display = self.glutin_window.get_xlib_display();
- let xlib_window = self.glutin_window.get_xlib_window();
+ let xlib_display = self.window.get_xlib_display();
+ let xlib_window = self.window.get_xlib_window();
if let (Some(xlib_window), Some(xlib_display)) = (xlib_window, xlib_display) {
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
/// be waiting on user input.
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 {
fn set_inner_size<T: ToPoints>(&mut self, size: &T) {
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 _);
}
}