diff --git a/CHANGELOG.md b/CHANGELOG.md index 01a32238..e87e2ec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Terminal escape bindings with combined modifiers for Delete and Insert - /Applications symlink into OS X DMG for easier installation - Colored emojis on Linux/BSD +- Value `randr` for `WINIT_HIDPI_FACTOR`, to ignore `Xft.dpi` and scale based on screen dimensions ### Changed @@ -37,6 +38,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Entire screen getting underlined/stroke out when running `clear` - Slow startup on some Wayland compositors - Padding not consistently visible on macOS +- Decorations ignoring Windows dark theme +- Crash on macOS when starting maximized without decorations +- Resize cursor not showing up on Wayland +- Maximized windows spawning behind system panel on Gnome Wayland ### Removed diff --git a/Cargo.lock b/Cargo.lock index 61070efb..3aed5e77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -33,14 +33,14 @@ dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "font 0.1.0", "gl_generator 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glutin 0.22.0-alpha5 (git+https://github.com/chrisduerr/glutin)", + "glutin 0.22.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "notify 4.0.14 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_tools_util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -63,14 +63,14 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "mio-anonymous-pipes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-extras 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "notify 4.0.14 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)", "signal-hook 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -253,7 +253,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", - "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-extras 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -493,8 +493,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -533,7 +533,7 @@ dependencies = [ [[package]] name = "euclid" -version = "0.20.6" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -562,9 +562,9 @@ name = "failure_derive" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -604,7 +604,7 @@ dependencies = [ "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 13.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.20.6 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.7 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "freetype-rs 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -634,9 +634,9 @@ name = "foreign-types-macros" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -715,6 +715,16 @@ dependencies = [ "wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "gl_generator" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "gl_generator" version = "0.13.1" @@ -743,18 +753,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "glutin" version = "0.22.0-alpha5" -source = "git+https://github.com/chrisduerr/glutin#7e479dca8be6244b96e2a080714fc4babf7fe30d" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "cgl 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "cocoa 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glutin_egl_sys 0.1.4 (git+https://github.com/chrisduerr/glutin)", - "glutin_emscripten_sys 0.1.0 (git+https://github.com/chrisduerr/glutin)", - "glutin_gles2_sys 0.1.3 (git+https://github.com/chrisduerr/glutin)", - "glutin_glx_sys 0.1.5 (git+https://github.com/chrisduerr/glutin)", - "glutin_wgl_sys 0.1.3 (git+https://github.com/chrisduerr/glutin)", + "glutin_egl_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_emscripten_sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_gles2_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_glx_sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_wgl_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -763,13 +773,13 @@ dependencies = [ "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.23.6 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winit 0.20.0-alpha4 (git+https://github.com/rust-windowing/winit)", + "winit 0.20.0-alpha6 (git+https://github.com/rust-windowing/winit?rev=d1c6506865c7bddbb5fb4d80a613e43ddc1370b5)", ] [[package]] name = "glutin_egl_sys" version = "0.1.4" -source = "git+https://github.com/chrisduerr/glutin#7e479dca8be6244b96e2a080714fc4babf7fe30d" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -778,37 +788,37 @@ dependencies = [ [[package]] name = "glutin_emscripten_sys" version = "0.1.0" -source = "git+https://github.com/chrisduerr/glutin#7e479dca8be6244b96e2a080714fc4babf7fe30d" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "glutin_gles2_sys" version = "0.1.3" -source = "git+https://github.com/chrisduerr/glutin#7e479dca8be6244b96e2a080714fc4babf7fe30d" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glutin_glx_sys" version = "0.1.5" -source = "git+https://github.com/chrisduerr/glutin#7e479dca8be6244b96e2a080714fc4babf7fe30d" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "x11-dl 2.18.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glutin_wgl_sys" version = "0.1.3" -source = "git+https://github.com/chrisduerr/glutin#7e479dca8be6244b96e2a080714fc4babf7fe30d" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hermit-abi" -version = "0.1.3" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -816,7 +826,7 @@ dependencies = [ [[package]] name = "http_req" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -828,7 +838,7 @@ name = "humantime" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -971,7 +981,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lock_api" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1064,7 +1074,7 @@ dependencies = [ [[package]] name = "mio-extras" -version = "2.0.5" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1193,7 +1203,7 @@ dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", - "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-extras 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1240,7 +1250,7 @@ name = "num_cpus" version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1321,7 +1331,7 @@ name = "parking_lot" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1331,7 +1341,7 @@ name = "parking_lot" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1358,7 +1368,7 @@ dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1442,7 +1452,7 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1450,7 +1460,7 @@ dependencies = [ [[package]] name = "quick-error" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1471,7 +1481,7 @@ name = "quote" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1791,20 +1801,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1814,7 +1824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1824,7 +1834,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1834,12 +1844,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-fontconfig-sys 4.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-fontconfig-sys 4.0.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "servo-fontconfig-sys" -version = "4.0.7" +version = "4.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "expat-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1902,7 +1912,7 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1960,10 +1970,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1973,9 +1983,9 @@ name = "synstructure" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2063,7 +2073,7 @@ name = "unicode-normalization" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2283,8 +2293,8 @@ dependencies = [ [[package]] name = "winit" -version = "0.20.0-alpha4" -source = "git+https://github.com/rust-windowing/winit#1a514dff3881771af1ccc5e3ffa786b1ddd0200f" +version = "0.20.0-alpha6" +source = "git+https://github.com/rust-windowing/winit?rev=d1c6506865c7bddbb5fb4d80a613e43ddc1370b5#d1c6506865c7bddbb5fb4d80a613e43ddc1370b5" dependencies = [ "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2313,7 +2323,7 @@ name = "winpty" version = "0.1.0" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "http_req 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "http_req 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "named_pipe 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2460,7 +2470,7 @@ dependencies = [ "checksum embed-resource 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bbaba4684ab0af1cbb3ef0b1f540ddc4b57b31940c920ea594efe09ab86e2a6c" "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum euclid 0.20.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2ea1cb302e02466d06f864fd214767de416f1e074fb6257f5addff9e4f7df9bc" +"checksum euclid 0.20.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f852d320142e1cceb15dccef32ed72a9970b83109d8a4e24b1ab04d579f485d" "checksum expat-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa" "checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9" "checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08" @@ -2480,17 +2490,18 @@ dependencies = [ "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" +"checksum gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "39a23d5e872a275135d66895d954269cf5e8661d234eb1c2480f4ce0d586acbd" "checksum gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ca98bbde17256e02d17336a6bdb5a50f7d0ccacee502e191d3e3d0ec2f96f84a" "checksum gl_generator 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum glutin 0.22.0-alpha5 (git+https://github.com/chrisduerr/glutin)" = "" -"checksum glutin_egl_sys 0.1.4 (git+https://github.com/chrisduerr/glutin)" = "" -"checksum glutin_emscripten_sys 0.1.0 (git+https://github.com/chrisduerr/glutin)" = "" -"checksum glutin_gles2_sys 0.1.3 (git+https://github.com/chrisduerr/glutin)" = "" -"checksum glutin_glx_sys 0.1.5 (git+https://github.com/chrisduerr/glutin)" = "" -"checksum glutin_wgl_sys 0.1.3 (git+https://github.com/chrisduerr/glutin)" = "" -"checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120" -"checksum http_req 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3235907ba93aeeb84419957956ab7055f1cc4aacfabd4cd1f32f49addab3ec" +"checksum glutin 0.22.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)" = "4f29f0d8e02e304b15a4464118387dcad1f543695057a60276a196311cc93452" +"checksum glutin_egl_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "772edef3b28b8ad41e4ea202748e65eefe8e5ffd1f4535f1219793dbb20b3d4c" +"checksum glutin_emscripten_sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "245b3fdb08df6ffed7585365851f8404af9c7e2dd4b59f15262e968b6a95a0c7" +"checksum glutin_gles2_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "89996c30857ae1b4de4b5189abf1ea822a20a9fe9e1c93e5e7b862ff0bdd5cdf" +"checksum glutin_glx_sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1290a5ca5e46fcfa7f66f949cc9d9194b2cb6f2ed61892c8c2b82343631dba57" +"checksum glutin_wgl_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f801bbc91efc22dd1c4818a47814fc72bf74d024510451b119381579bfa39021" +"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772" +"checksum http_req 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "dae71e8a6f38118bf04540fe592d31b69930127469c1de1ab6abefcded205c61" "checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" "checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" "checksum image 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4be8aaefbe7545dc42ae925afb55a0098f226a3fe5ef721872806f44f57826" @@ -2510,7 +2521,7 @@ dependencies = [ "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum line_drawing 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5cc7ad3d82c845bdb5dde34ffdcc7a5fb4d2996e1e1ee0f19c33bc80e15196b9" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" -"checksum lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e57b3997725d2b60dbec1297f6c2e2957cc383db1cebd6be812163f969c7d586" +"checksum lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" @@ -2521,7 +2532,7 @@ dependencies = [ "checksum miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6f3f74f726ae935c3f514300cc6773a0c9492abc5e972d42ba0c0ebb88757625" "checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" "checksum mio-anonymous-pipes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8c274c3c52dcd1d78c5d7ed841eca1e9ea2db8353f3b8ec25789cc62c471aaf" -"checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" +"checksum mio-extras 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" "checksum mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" @@ -2561,8 +2572,8 @@ dependencies = [ "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" "checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" -"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" +"checksum proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0319972dcae462681daf4da1adeeaa066e3ebd29c69be96c6abb1259d2ee2bcc" +"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" @@ -2603,26 +2614,26 @@ dependencies = [ "checksum security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e31493fc37615debb8c5090a7aeb4a9730bc61e77ab10b9af59f1a202284f895" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "1217f97ab8e8904b57dd22eb61cde455fa7446a9c1cf43966066da047c1f3702" -"checksum serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "a8c6faef9a2e64b0064f48570289b4bf8823b7581f1d6157c1b52152306651d0" +"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" +"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" "checksum serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "48c575e0cc52bdd09b47f330f646cf59afc586e9c4e3ccd6fc1f625b8ea1dad7" "checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35" "checksum servo-fontconfig 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a088f8d775a5c5314aae09bd77340bc9c67d72b9a45258be34c83548b4814cd9" -"checksum servo-fontconfig-sys 4.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b46d201addcfbd25c1798ad1281d98c40743824e0b0f1e611bd3d5d0d31a7b8d" +"checksum servo-fontconfig-sys 4.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "62b3e166450f523f4db06c14f02a2d39e76d49b5d8cbd224338d93e3595c156c" "checksum shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" "checksum signal-hook 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "7a9c17dd3ba2d36023a5c9472ecddeda07e27fd0b05436e8c1e0c8f178185652" "checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" -"checksum smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecf3b85f68e8abaa7555aa5abdb1153079387e60b718283d732f03897fcfc86" +"checksum smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4" "checksum smithay-client-toolkit 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "93960e8975909fcb14cc755de93af2149d8b8f4eb368315537d40cfd0f324054" "checksum smithay-clipboard 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9667a262ef7a9ff1c55a7e665cd3d36f9bc2809f94167b1fb3fc31423a83f8c0" "checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85" "checksum spsc-buffer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be6c3f39c37a4283ee4b43d1311c828f2e1fb0541e76ea0cb1a2abd9ef2f5b3b" "checksum stb_truetype 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f77b6b07e862c66a9f3e62a07588fee67cd90a9135a2b942409f195507b4fb51" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238" +"checksum syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4ff033220a41d1a57d8125eab57bf5263783dfdcc18688b1dacc6ce9651ef8" "checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" @@ -2664,7 +2675,7 @@ dependencies = [ "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9" -"checksum winit 0.20.0-alpha4 (git+https://github.com/rust-windowing/winit)" = "" +"checksum winit 0.20.0-alpha6 (git+https://github.com/rust-windowing/winit?rev=d1c6506865c7bddbb5fb4d80a613e43ddc1370b5)" = "" "checksum winpty-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dade7ecea144b3578a02925f93900f32370abfb8768630883971f4ef716b568" "checksum winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" diff --git a/Cargo.toml b/Cargo.toml index 2e8fd4db..bb50a3d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,3 +14,4 @@ incremental = false [patch.crates-io] servo-freetype-sys = { path = "servo-freetype-proxy" } +winit = { git = "https://github.com/rust-windowing/winit", rev = "d1c6506865c7bddbb5fb4d80a613e43ddc1370b5" } diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml index b1909f05..45353dad 100644 --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -18,7 +18,7 @@ fnv = "1" serde = { version = "1", features = ["derive"] } serde_yaml = "0.8" serde_json = "1" -glutin = { git = "https://github.com/chrisduerr/glutin" } +glutin = "0.22.0-alpha5" notify = "4" libc = "0.2" unicode-width = "0.1" diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs index b5680439..dbe5d42e 100644 --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -210,10 +210,7 @@ impl RelaxedEq for ModifiersState { // Make sure that modifiers in the config are always present, // but ignore surplus modifiers. fn relaxed_eq(&self, other: Self) -> bool { - (!self.logo || other.logo) - && (!self.alt || other.alt) - && (!self.ctrl || other.ctrl) - && (!self.shift || other.shift) + !*self | other == ModifiersState::all() } } @@ -222,7 +219,7 @@ macro_rules! bindings { $ty:ident; $( $key:path - $(,[$($mod:ident: $enabled:expr),*])* + $(,$mods:expr)* $(,+$mode:expr)* $(,~$notmode:expr)* ;$action:expr @@ -232,10 +229,8 @@ macro_rules! bindings { let mut v = Vec::new(); $( - let mut _mods = ModifiersState { - $($($mod: $enabled),*,)* - ..Default::default() - }; + let mut _mods = ModifiersState::empty(); + $(_mods = $mods;)* let mut _mode = TermMode::empty(); $(_mode = $mode;)* let mut _notmode = TermMode::empty(); @@ -266,25 +261,25 @@ pub fn default_key_bindings() -> Vec { KeyBinding; Key::Paste; Action::Paste; Key::Copy; Action::Copy; - Key::L, [ctrl: true]; Action::ClearLogNotice; - Key::L, [ctrl: true]; Action::Esc("\x0c".into()); - Key::PageUp, [shift: true], ~TermMode::ALT_SCREEN; Action::ScrollPageUp; - Key::PageDown, [shift: true], ~TermMode::ALT_SCREEN; Action::ScrollPageDown; - Key::Home, [shift: true], ~TermMode::ALT_SCREEN; Action::ScrollToTop; - Key::End, [shift: true], ~TermMode::ALT_SCREEN; Action::ScrollToBottom; + Key::L, ModifiersState::CTRL; Action::ClearLogNotice; + Key::L, ModifiersState::CTRL; Action::Esc("\x0c".into()); + Key::PageUp, ModifiersState::SHIFT, ~TermMode::ALT_SCREEN; Action::ScrollPageUp; + Key::PageDown, ModifiersState::SHIFT, ~TermMode::ALT_SCREEN; Action::ScrollPageDown; + Key::Home, ModifiersState::SHIFT, ~TermMode::ALT_SCREEN; Action::ScrollToTop; + Key::End, ModifiersState::SHIFT, ~TermMode::ALT_SCREEN; Action::ScrollToBottom; Key::Home, +TermMode::APP_CURSOR; Action::Esc("\x1bOH".into()); Key::Home, ~TermMode::APP_CURSOR; Action::Esc("\x1b[H".into()); - Key::Home, [shift: true], +TermMode::ALT_SCREEN; Action::Esc("\x1b[1;2H".into()); + Key::Home, ModifiersState::SHIFT, +TermMode::ALT_SCREEN; Action::Esc("\x1b[1;2H".into()); Key::End, +TermMode::APP_CURSOR; Action::Esc("\x1bOF".into()); Key::End, ~TermMode::APP_CURSOR; Action::Esc("\x1b[F".into()); - Key::End, [shift: true], +TermMode::ALT_SCREEN; Action::Esc("\x1b[1;2F".into()); + Key::End, ModifiersState::SHIFT, +TermMode::ALT_SCREEN; Action::Esc("\x1b[1;2F".into()); Key::PageUp; Action::Esc("\x1b[5~".into()); - Key::PageUp, [shift: true], +TermMode::ALT_SCREEN; Action::Esc("\x1b[5;2~".into()); + Key::PageUp, ModifiersState::SHIFT, +TermMode::ALT_SCREEN; Action::Esc("\x1b[5;2~".into()); Key::PageDown; Action::Esc("\x1b[6~".into()); - Key::PageDown, [shift: true], +TermMode::ALT_SCREEN; Action::Esc("\x1b[6;2~".into()); - Key::Tab, [shift: true]; Action::Esc("\x1b[Z".into()); + Key::PageDown, ModifiersState::SHIFT, +TermMode::ALT_SCREEN; Action::Esc("\x1b[6;2~".into()); + Key::Tab, ModifiersState::SHIFT; Action::Esc("\x1b[Z".into()); Key::Back; Action::Esc("\x7f".into()); - Key::Back, [alt: true]; Action::Esc("\x1b\x7f".into()); + Key::Back, ModifiersState::ALT; Action::Esc("\x1b\x7f".into()); Key::Insert; Action::Esc("\x1b[2~".into()); Key::Delete; Action::Esc("\x1b[3~".into()); Key::Up, +TermMode::APP_CURSOR; Action::Esc("\x1bOA".into()); @@ -330,70 +325,45 @@ pub fn default_key_bindings() -> Vec { // ---------+--------------------------- // // from: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-PC-Style-Function-Keys - let modifiers = vec![ - ModifiersState { shift: true, ..ModifiersState::default() }, - ModifiersState { alt: true, ..ModifiersState::default() }, - ModifiersState { shift: true, alt: true, ..ModifiersState::default() }, - ModifiersState { ctrl: true, ..ModifiersState::default() }, - ModifiersState { shift: true, ctrl: true, ..ModifiersState::default() }, - ModifiersState { alt: true, ctrl: true, ..ModifiersState::default() }, - ModifiersState { shift: true, alt: true, ctrl: true, ..ModifiersState::default() }, + let mut modifiers = vec![ + ModifiersState::SHIFT, + ModifiersState::ALT, + ModifiersState::SHIFT | ModifiersState::ALT, + ModifiersState::CTRL, + ModifiersState::SHIFT | ModifiersState::CTRL, + ModifiersState::ALT | ModifiersState::CTRL, + ModifiersState::SHIFT | ModifiersState::ALT | ModifiersState::CTRL, ]; - for (index, mods) in modifiers.iter().enumerate() { + for (index, mods) in modifiers.drain(..).enumerate() { let modifiers_code = index + 2; bindings.extend(bindings!( KeyBinding; - Key::Delete, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[3;{}~", modifiers_code)); - Key::Up, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[1;{}A", modifiers_code)); - Key::Down, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[1;{}B", modifiers_code)); - Key::Right, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[1;{}C", modifiers_code)); - Key::Left, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[1;{}D", modifiers_code)); - Key::F1, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[1;{}P", modifiers_code)); - Key::F2, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[1;{}Q", modifiers_code)); - Key::F3, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[1;{}R", modifiers_code)); - Key::F4, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[1;{}S", modifiers_code)); - Key::F5, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[15;{}~", modifiers_code)); - Key::F6, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[17;{}~", modifiers_code)); - Key::F7, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[18;{}~", modifiers_code)); - Key::F8, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[19;{}~", modifiers_code)); - Key::F9, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[20;{}~", modifiers_code)); - Key::F10, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[21;{}~", modifiers_code)); - Key::F11, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[23;{}~", modifiers_code)); - Key::F12, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[24;{}~", modifiers_code)); - Key::F13, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[25;{}~", modifiers_code)); - Key::F14, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[26;{}~", modifiers_code)); - Key::F15, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[28;{}~", modifiers_code)); - Key::F16, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[29;{}~", modifiers_code)); - Key::F17, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[31;{}~", modifiers_code)); - Key::F18, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[32;{}~", modifiers_code)); - Key::F19, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[33;{}~", modifiers_code)); - Key::F20, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[34;{}~", modifiers_code)); + Key::Delete, mods; Action::Esc(format!("\x1b[3;{}~", modifiers_code)); + Key::Up, mods; Action::Esc(format!("\x1b[1;{}A", modifiers_code)); + Key::Down, mods; Action::Esc(format!("\x1b[1;{}B", modifiers_code)); + Key::Right, mods; Action::Esc(format!("\x1b[1;{}C", modifiers_code)); + Key::Left, mods; Action::Esc(format!("\x1b[1;{}D", modifiers_code)); + Key::F1, mods; Action::Esc(format!("\x1b[1;{}P", modifiers_code)); + Key::F2, mods; Action::Esc(format!("\x1b[1;{}Q", modifiers_code)); + Key::F3, mods; Action::Esc(format!("\x1b[1;{}R", modifiers_code)); + Key::F4, mods; Action::Esc(format!("\x1b[1;{}S", modifiers_code)); + Key::F5, mods; Action::Esc(format!("\x1b[15;{}~", modifiers_code)); + Key::F6, mods; Action::Esc(format!("\x1b[17;{}~", modifiers_code)); + Key::F7, mods; Action::Esc(format!("\x1b[18;{}~", modifiers_code)); + Key::F8, mods; Action::Esc(format!("\x1b[19;{}~", modifiers_code)); + Key::F9, mods; Action::Esc(format!("\x1b[20;{}~", modifiers_code)); + Key::F10, mods; Action::Esc(format!("\x1b[21;{}~", modifiers_code)); + Key::F11, mods; Action::Esc(format!("\x1b[23;{}~", modifiers_code)); + Key::F12, mods; Action::Esc(format!("\x1b[24;{}~", modifiers_code)); + Key::F13, mods; Action::Esc(format!("\x1b[25;{}~", modifiers_code)); + Key::F14, mods; Action::Esc(format!("\x1b[26;{}~", modifiers_code)); + Key::F15, mods; Action::Esc(format!("\x1b[28;{}~", modifiers_code)); + Key::F16, mods; Action::Esc(format!("\x1b[29;{}~", modifiers_code)); + Key::F17, mods; Action::Esc(format!("\x1b[31;{}~", modifiers_code)); + Key::F18, mods; Action::Esc(format!("\x1b[32;{}~", modifiers_code)); + Key::F19, mods; Action::Esc(format!("\x1b[33;{}~", modifiers_code)); + Key::F20, mods; Action::Esc(format!("\x1b[34;{}~", modifiers_code)); )); // We're adding the following bindings with `Shift` manually above, so skipping them here @@ -401,16 +371,11 @@ pub fn default_key_bindings() -> Vec { if modifiers_code != 2 { bindings.extend(bindings!( KeyBinding; - Key::Insert, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[2;{}~", modifiers_code)); - Key::PageUp, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[5;{}~", modifiers_code)); - Key::PageDown, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[6;{}~", modifiers_code)); - Key::End, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[1;{}F", modifiers_code)); - Key::Home, [shift: mods.shift, alt: mods.alt, ctrl: mods.ctrl]; - Action::Esc(format!("\x1b[1;{}H", modifiers_code)); + Key::Insert, mods; Action::Esc(format!("\x1b[2;{}~", modifiers_code)); + Key::PageUp, mods; Action::Esc(format!("\x1b[5;{}~", modifiers_code)); + Key::PageDown, mods; Action::Esc(format!("\x1b[6;{}~", modifiers_code)); + Key::End, mods; Action::Esc(format!("\x1b[1;{}F", modifiers_code)); + Key::Home, mods; Action::Esc(format!("\x1b[1;{}H", modifiers_code)); )); } } @@ -424,14 +389,14 @@ pub fn default_key_bindings() -> Vec { fn common_keybindings() -> Vec { bindings!( KeyBinding; - Key::V, [ctrl: true, shift: true]; Action::Paste; - Key::C, [ctrl: true, shift: true]; Action::Copy; - Key::Insert, [shift: true]; Action::PasteSelection; - Key::Key0, [ctrl: true]; Action::ResetFontSize; - Key::Equals, [ctrl: true]; Action::IncreaseFontSize; - Key::Add, [ctrl: true]; Action::IncreaseFontSize; - Key::Subtract, [ctrl: true]; Action::DecreaseFontSize; - Key::Minus, [ctrl: true]; Action::DecreaseFontSize; + Key::V, ModifiersState::CTRL | ModifiersState::SHIFT; Action::Paste; + Key::C, ModifiersState::CTRL | ModifiersState::SHIFT; Action::Copy; + Key::Insert, ModifiersState::SHIFT; Action::PasteSelection; + Key::Key0, ModifiersState::CTRL; Action::ResetFontSize; + Key::Equals, ModifiersState::CTRL; Action::IncreaseFontSize; + Key::Add, ModifiersState::CTRL; Action::IncreaseFontSize; + Key::Subtract, ModifiersState::CTRL; Action::DecreaseFontSize; + Key::Minus, ModifiersState::CTRL; Action::DecreaseFontSize; ) } @@ -444,7 +409,7 @@ pub fn platform_key_bindings() -> Vec { pub fn platform_key_bindings() -> Vec { let mut bindings = bindings!( KeyBinding; - Key::Return, [alt: true]; Action::ToggleFullscreen; + Key::Return, ModifiersState::ALT; Action::ToggleFullscreen; ); bindings.extend(common_keybindings()); bindings @@ -454,19 +419,19 @@ pub fn platform_key_bindings() -> Vec { pub fn platform_key_bindings() -> Vec { bindings!( KeyBinding; - Key::Key0, [logo: true]; Action::ResetFontSize; - Key::Equals, [logo: true]; Action::IncreaseFontSize; - Key::Add, [logo: true]; Action::IncreaseFontSize; - Key::Minus, [logo: true]; Action::DecreaseFontSize; - Key::Insert, [shift: true]; Action::Esc("\x1b[2;2~".into()); - Key::F, [ctrl: true, logo: true]; Action::ToggleFullscreen; - Key::K, [logo: true]; Action::ClearHistory; - Key::K, [logo: true]; Action::Esc("\x0c".into()); - Key::V, [logo: true]; Action::Paste; - Key::C, [logo: true]; Action::Copy; - Key::H, [logo: true]; Action::Hide; - Key::Q, [logo: true]; Action::Quit; - Key::W, [logo: true]; Action::Quit; + Key::Key0, ModifiersState::LOGO; Action::ResetFontSize; + Key::Equals, ModifiersState::LOGO; Action::IncreaseFontSize; + Key::Add, ModifiersState::LOGO; Action::IncreaseFontSize; + Key::Minus, ModifiersState::LOGO; Action::DecreaseFontSize; + Key::Insert, ModifiersState::SHIFT; Action::Esc("\x1b[2;2~".into()); + Key::F, ModifiersState::CTRL | ModifiersState::LOGO; Action::ToggleFullscreen; + Key::K, ModifiersState::LOGO; Action::ClearHistory; + Key::K, ModifiersState::LOGO; Action::Esc("\x0c".into()); + Key::V, ModifiersState::LOGO; Action::Paste; + Key::C, ModifiersState::LOGO; Action::Copy; + Key::H, ModifiersState::LOGO; Action::Hide; + Key::Q, ModifiersState::LOGO; Action::Quit; + Key::W, ModifiersState::LOGO; Action::Quit; ) } @@ -1201,13 +1166,13 @@ impl<'a> de::Deserialize<'a> for ModsWrapper { where E: de::Error, { - let mut res = ModifiersState::default(); + let mut res = ModifiersState::empty(); for modifier in value.split('|') { match modifier.trim().to_lowercase().as_str() { - "command" | "super" => res.logo = true, - "shift" => res.shift = true, - "alt" | "option" => res.alt = true, - "control" => res.ctrl = true, + "command" | "super" => res.insert(ModifiersState::LOGO), + "shift" => res.insert(ModifiersState::SHIFT), + "alt" | "option" => res.insert(ModifiersState::ALT), + "control" => res.insert(ModifiersState::CTRL), "none" => (), _ => error!(target: LOG_TARGET_CONFIG, "Unknown modifier {:?}", modifier), } @@ -1265,9 +1230,9 @@ mod test { #[test] fn mods_binding_requires_strict_match() { let mut superset_mods = MockBinding::default(); - superset_mods.mods = ModifiersState { alt: true, logo: true, ctrl: true, shift: true }; + superset_mods.mods = ModifiersState::all(); let mut subset_mods = MockBinding::default(); - subset_mods.mods = ModifiersState { alt: true, logo: false, ctrl: false, shift: false }; + subset_mods.mods = ModifiersState::ALT; assert!(!superset_mods.triggers_match(&subset_mods)); assert!(!subset_mods.triggers_match(&superset_mods)); @@ -1368,10 +1333,10 @@ mod test { #[test] fn binding_trigger_mods() { let mut binding = MockBinding::default(); - binding.mods = ModifiersState { alt: true, logo: true, ctrl: false, shift: false }; + binding.mods = ModifiersState::ALT | ModifiersState::LOGO; - let superset_mods = ModifiersState { alt: true, logo: true, ctrl: true, shift: true }; - let subset_mods = ModifiersState { alt: false, logo: false, ctrl: false, shift: false }; + let superset_mods = ModifiersState::all(); + let subset_mods = ModifiersState::empty(); let t = binding.trigger; let mode = binding.mode; diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 4b1fe892..d03c4390 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -356,7 +356,7 @@ impl Processor { return; }, // Process events - GlutinEvent::EventsCleared => { + GlutinEvent::RedrawEventsCleared => { *control_flow = ControlFlow::Wait; if event_queue.is_empty() { @@ -478,6 +478,7 @@ impl Processor { Event::MouseCursorDirty => processor.reset_mouse_cursor(), Event::Exit => (), }, + GlutinEvent::RedrawRequested(_) => processor.ctx.terminal.dirty = true, GlutinEvent::WindowEvent { event, window_id, .. } => { use glutin::event::WindowEvent::*; match event { @@ -508,24 +509,24 @@ impl Processor { } }, ReceivedCharacter(c) => processor.received_char(c), - MouseInput { state, button, modifiers, .. } => { + MouseInput { state, button, .. } => { if !cfg!(target_os = "macos") || processor.ctx.terminal.is_focused { processor.ctx.window.set_mouse_visible(true); - processor.mouse_input(state, button, modifiers); + processor.mouse_input(state, button); processor.ctx.terminal.dirty = true; } }, - CursorMoved { position: lpos, modifiers, .. } => { + CursorMoved { position: lpos, .. } => { let (x, y) = lpos.to_physical(processor.ctx.size_info.dpr).into(); let x: i32 = limit(x, 0, processor.ctx.size_info.width as i32); let y: i32 = limit(y, 0, processor.ctx.size_info.height as i32); processor.ctx.window.set_mouse_visible(true); - processor.mouse_moved(x as usize, y as usize, modifiers); + processor.mouse_moved(x as usize, y as usize); }, - MouseWheel { delta, phase, modifiers, .. } => { + MouseWheel { delta, phase, .. } => { processor.ctx.window.set_mouse_visible(true); - processor.mouse_wheel_input(delta, phase, modifiers); + processor.mouse_wheel_input(delta, phase); }, Focused(is_focused) => { if window_id == processor.ctx.window.window_id() { @@ -565,7 +566,6 @@ impl Processor { processor.ctx.terminal.dirty = true; processor.ctx.size_info.dpr = dpr; }, - RedrawRequested => processor.ctx.terminal.dirty = true, CursorLeft { .. } => { processor.ctx.mouse.inside_grid = false; @@ -578,6 +578,7 @@ impl Processor { | AxisMotion { .. } | HoveredFileCancelled | Destroyed + | ThemeChanged(_) | HoveredFile(_) | Touch(_) | Moved(_) => (), @@ -585,13 +586,14 @@ impl Processor { }, GlutinEvent::DeviceEvent { event, .. } => { use glutin::event::DeviceEvent::*; - if let ModifiersChanged { modifiers } = event { + if let ModifiersChanged(modifiers) = event { processor.modifiers_input(modifiers); } }, GlutinEvent::Suspended { .. } | GlutinEvent::NewEvents { .. } - | GlutinEvent::EventsCleared + | GlutinEvent::MainEventsCleared + | GlutinEvent::RedrawEventsCleared | GlutinEvent::Resumed | GlutinEvent::LoopDestroyed => (), } @@ -624,7 +626,7 @@ impl Processor { }, GlutinEvent::Suspended { .. } | GlutinEvent::NewEvents { .. } - | GlutinEvent::EventsCleared + | GlutinEvent::MainEventsCleared | GlutinEvent::LoopDestroyed => true, _ => false, } diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index 2a98dc12..dff46515 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -196,7 +196,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { } #[inline] - pub fn mouse_moved(&mut self, x: usize, y: usize, modifiers: ModifiersState) { + pub fn mouse_moved(&mut self, x: usize, y: usize) { let size_info = self.ctx.size_info(); self.ctx.mouse_mut().x = x; @@ -226,13 +226,14 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { self.ctx.mouse_mut().block_url_launcher = true; // Update mouse state and check for URL change - let mouse_state = self.mouse_state(modifiers); + let mouse_state = self.mouse_state(); self.update_url_state(&mouse_state); self.ctx.window_mut().set_mouse_cursor(mouse_state.into()); let last_term_line = self.ctx.terminal().grid().num_lines() - 1; if self.ctx.mouse().left_button_state == ElementState::Pressed - && (modifiers.shift || !self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE)) + && (self.ctx.modifiers().shift() + || !self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE)) { // Treat motion over message bar like motion over the last line let line = min(point.line, last_term_line); @@ -244,13 +245,13 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { && self.ctx.terminal().mode().intersects(TermMode::MOUSE_MOTION | TermMode::MOUSE_DRAG) { if self.ctx.mouse().left_button_state == ElementState::Pressed { - self.mouse_report(32, ElementState::Pressed, modifiers); + self.mouse_report(32, ElementState::Pressed); } else if self.ctx.mouse().middle_button_state == ElementState::Pressed { - self.mouse_report(33, ElementState::Pressed, modifiers); + self.mouse_report(33, ElementState::Pressed); } else if self.ctx.mouse().right_button_state == ElementState::Pressed { - self.mouse_report(34, ElementState::Pressed, modifiers); + self.mouse_report(34, ElementState::Pressed); } else if self.ctx.terminal().mode().contains(TermMode::MOUSE_MOTION) { - self.mouse_report(35, ElementState::Pressed, modifiers); + self.mouse_report(35, ElementState::Pressed); } } } @@ -321,16 +322,17 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { self.ctx.write_to_pty(msg.into_bytes()); } - fn mouse_report(&mut self, button: u8, state: ElementState, modifiers: ModifiersState) { + fn mouse_report(&mut self, button: u8, state: ElementState) { // Calculate modifiers value let mut mods = 0; - if modifiers.shift { + let modifiers = self.ctx.modifiers(); + if modifiers.shift() { mods += 4; } - if modifiers.alt { + if modifiers.alt() { mods += 8; } - if modifiers.ctrl { + if modifiers.ctrl() { mods += 16; } @@ -356,7 +358,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { } } - fn on_mouse_press(&mut self, button: MouseButton, modifiers: ModifiersState) { + fn on_mouse_press(&mut self, button: MouseButton) { let now = Instant::now(); let elapsed = self.ctx.mouse().last_click_timestamp.elapsed(); self.ctx.mouse_mut().last_click_timestamp = now; @@ -393,13 +395,15 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { // Start new empty selection let side = self.ctx.mouse().cell_side; - if modifiers.ctrl { + if self.ctx.modifiers().ctrl() { self.ctx.block_selection(point, side); } else { self.ctx.simple_selection(point, side); } - if !modifiers.shift && self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE) { + if !self.ctx.modifiers().shift() + && self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE) + { let code = match button { MouseButton::Left => 0, MouseButton::Middle => 1, @@ -407,7 +411,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { // Can't properly report more than three buttons. MouseButton::Other(_) => return, }; - self.mouse_report(code, ElementState::Pressed, modifiers); + self.mouse_report(code, ElementState::Pressed); return; } @@ -416,8 +420,10 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { }; } - fn on_mouse_release(&mut self, button: MouseButton, modifiers: ModifiersState) { - if !modifiers.shift && self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE) { + fn on_mouse_release(&mut self, button: MouseButton) { + if !self.ctx.modifiers().shift() + && self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE) + { let code = match button { MouseButton::Left => 0, MouseButton::Middle => 1, @@ -425,11 +431,9 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { // Can't properly report more than three buttons. MouseButton::Other(_) => return, }; - self.mouse_report(code, ElementState::Released, modifiers); + self.mouse_report(code, ElementState::Released); return; - } else if let (MouseButton::Left, MouseState::Url(url)) = - (button, self.mouse_state(modifiers)) - { + } else if let (MouseButton::Left, MouseState::Url(url)) = (button, self.mouse_state()) { self.launch_url(url); } @@ -455,16 +459,11 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { } } - pub fn mouse_wheel_input( - &mut self, - delta: MouseScrollDelta, - phase: TouchPhase, - modifiers: ModifiersState, - ) { + pub fn mouse_wheel_input(&mut self, delta: MouseScrollDelta, phase: TouchPhase) { match delta { MouseScrollDelta::LineDelta(_columns, lines) => { let new_scroll_px = lines * self.ctx.size_info().cell_height; - self.scroll_terminal(modifiers, new_scroll_px as i32); + self.scroll_terminal(new_scroll_px as i32); }, MouseScrollDelta::PixelDelta(lpos) => { match phase { @@ -473,7 +472,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { self.ctx.mouse_mut().scroll_px = 0; }, TouchPhase::Moved => { - self.scroll_terminal(modifiers, lpos.y as i32); + self.scroll_terminal(lpos.y as i32); }, _ => (), } @@ -481,7 +480,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { } } - fn scroll_terminal(&mut self, modifiers: ModifiersState, new_scroll_px: i32) { + fn scroll_terminal(&mut self, new_scroll_px: i32) { let height = self.ctx.size_info().cell_height as i32; if self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE) { @@ -491,14 +490,14 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { let lines = (self.ctx.mouse().scroll_px / height).abs(); for _ in 0..lines { - self.mouse_report(code, ElementState::Pressed, modifiers); + self.mouse_report(code, ElementState::Pressed); } } else if self .ctx .terminal() .mode() .contains(TermMode::ALT_SCREEN | TermMode::ALTERNATE_SCROLL) - && !modifiers.shift + && !self.ctx.modifiers().shift() { let multiplier = i32::from( self.ctx @@ -540,12 +539,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { } } - pub fn mouse_input( - &mut self, - state: ElementState, - button: MouseButton, - modifiers: ModifiersState, - ) { + pub fn mouse_input(&mut self, state: ElementState, button: MouseButton) { match button { MouseButton::Left => self.ctx.mouse_mut().left_button_state = state, MouseButton::Middle => self.ctx.mouse_mut().middle_button_state = state, @@ -580,10 +574,10 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { } else { match state { ElementState::Pressed => { - self.process_mouse_bindings(modifiers, button); - self.on_mouse_press(button, modifiers); + self.process_mouse_bindings(button); + self.on_mouse_press(button); }, - ElementState::Released => self.on_mouse_release(button, modifiers), + ElementState::Released => self.on_mouse_release(button), } } @@ -592,9 +586,6 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { /// Process key input. pub fn key_input(&mut self, input: KeyboardInput) { - // TODO: Implement `ModifiersChanged` event on all platforms: rust-windowing/winit#1151 - self.modifiers_input(input.modifiers); - match input.state { ElementState::Pressed => { *self.ctx.received_count() = 0; @@ -609,7 +600,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { *self.ctx.modifiers() = modifiers; // Update mouse state and check for URL change - let mouse_state = self.mouse_state(modifiers); + let mouse_state = self.mouse_state(); self.update_url_state(&mouse_state); self.ctx.window_mut().set_mouse_cursor(mouse_state.into()); } @@ -632,7 +623,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { if self.ctx.config().alt_send_esc() && *self.ctx.received_count() == 0 - && self.ctx.modifiers().alt + && self.ctx.modifiers().alt() && utf8_len == 1 { bytes.insert(0, b'\x1b'); @@ -647,8 +638,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { /// Reset mouse cursor based on modifier and terminal state. #[inline] pub fn reset_mouse_cursor(&mut self) { - let mods = *self.ctx.modifiers(); - let mouse_state = self.mouse_state(mods); + let mouse_state = self.mouse_state(); self.ctx.window_mut().set_mouse_cursor(mouse_state.into()); } @@ -660,6 +650,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { let mut suppress_chars = None; for i in 0..self.ctx.config().ui_config.key_bindings.len() { + let mods = *self.ctx.modifiers(); let binding = &self.ctx.config().ui_config.key_bindings[i]; let key = match (binding.trigger, input.virtual_keycode) { @@ -668,7 +659,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { _ => continue, }; - if binding.is_triggered_by(*self.ctx.terminal().mode(), input.modifiers, &key, false) { + if binding.is_triggered_by(*self.ctx.terminal().mode(), mods, &key, false) { // Binding was triggered; run the action let binding = binding.clone(); binding.execute(&mut self.ctx, false); @@ -686,14 +677,15 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { /// /// The provided mode, mods, and key must match what is allowed by a binding /// for its action to be executed. - fn process_mouse_bindings(&mut self, mods: ModifiersState, button: MouseButton) { + fn process_mouse_bindings(&mut self, button: MouseButton) { for i in 0..self.ctx.config().ui_config.mouse_bindings.len() { + let mods = *self.ctx.modifiers(); let binding = &self.ctx.config().ui_config.mouse_bindings[i]; if binding.is_triggered_by(*self.ctx.terminal().mode(), mods, &button, true) { // binding was triggered; run the action let mouse_mode_active = - !mods.shift && self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE); + !mods.shift() && self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE); let binding = binding.clone(); binding.execute(&mut self.ctx, mouse_mode_active); @@ -735,7 +727,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { } /// Location of the mouse cursor. - fn mouse_state(&mut self, mods: ModifiersState) -> MouseState { + fn mouse_state(&mut self) -> MouseState { // Check message bar before URL to ignore URLs in the message bar if self.message_close_at_cursor() { return MouseState::MessageBarButton; @@ -744,6 +736,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { } // Check for URL at mouse cursor + let mods = *self.ctx.modifiers(); let selection = !self.ctx.terminal().selection().as_ref().map(Selection::is_empty).unwrap_or(true); let mouse_mode = self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE); @@ -756,7 +749,7 @@ impl<'a, T: EventListener, A: ActionContext> Processor<'a, T, A> { // Check mouse mode if location is not special if self.ctx.terminal().mode().intersects(TermMode::MOUSE_MODE) - && !self.ctx.modifiers().shift + && !self.ctx.modifiers().shift() { MouseState::Mouse } else { @@ -982,13 +975,12 @@ mod tests { event: WindowEvent::MouseInput { state, button, - modifiers, .. }, .. } = $input { - processor.mouse_input(state, button, modifiers); + processor.mouse_input(state, button); }; assert!(match processor.ctx.mouse.click_state { @@ -1005,7 +997,7 @@ mod tests { binding: $binding:expr, triggers: $triggers:expr, mode: $mode:expr, - mods: $mods:expr + mods: $mods:expr, } => { #[test] fn $name() { @@ -1088,65 +1080,65 @@ mod tests { test_process_binding! { name: process_binding_nomode_shiftmod_require_shift, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[1;2D"), mode: TermMode::NONE, notmode: TermMode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState::SHIFT, action: Action::from("\x1b[1;2D"), mode: TermMode::NONE, notmode: TermMode::NONE }, triggers: true, mode: TermMode::NONE, - mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false } + mods: ModifiersState::SHIFT, } test_process_binding! { name: process_binding_nomode_nomod_require_shift, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[1;2D"), mode: TermMode::NONE, notmode: TermMode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState::SHIFT, action: Action::from("\x1b[1;2D"), mode: TermMode::NONE, notmode: TermMode::NONE }, triggers: false, mode: TermMode::NONE, - mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } + mods: ModifiersState::empty(), } test_process_binding! { name: process_binding_nomode_controlmod, - binding: Binding { trigger: KEY, mods: ModifiersState { ctrl: true, shift: false, alt: false, logo: false }, action: Action::from("\x1b[1;5D"), mode: TermMode::NONE, notmode: TermMode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState::CTRL, action: Action::from("\x1b[1;5D"), mode: TermMode::NONE, notmode: TermMode::NONE }, triggers: true, mode: TermMode::NONE, - mods: ModifiersState { ctrl: true, shift: false, alt: false, logo: false } + mods: ModifiersState::CTRL, } test_process_binding! { name: process_binding_nomode_nomod_require_not_appcursor, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[D"), mode: TermMode::NONE, notmode: TermMode::APP_CURSOR }, + binding: Binding { trigger: KEY, mods: ModifiersState::empty(), action: Action::from("\x1b[D"), mode: TermMode::NONE, notmode: TermMode::APP_CURSOR }, triggers: true, mode: TermMode::NONE, - mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } + mods: ModifiersState::empty(), } test_process_binding! { name: process_binding_appcursormode_nomod_require_appcursor, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: TermMode::APP_CURSOR, notmode: TermMode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState::empty(), action: Action::from("\x1bOD"), mode: TermMode::APP_CURSOR, notmode: TermMode::NONE }, triggers: true, mode: TermMode::APP_CURSOR, - mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } + mods: ModifiersState::empty(), } test_process_binding! { name: process_binding_nomode_nomod_require_appcursor, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: TermMode::APP_CURSOR, notmode: TermMode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState::empty(), action: Action::from("\x1bOD"), mode: TermMode::APP_CURSOR, notmode: TermMode::NONE }, triggers: false, mode: TermMode::NONE, - mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } + mods: ModifiersState::empty(), } test_process_binding! { name: process_binding_appcursormode_appkeypadmode_nomod_require_appcursor, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: TermMode::APP_CURSOR, notmode: TermMode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState::empty(), action: Action::from("\x1bOD"), mode: TermMode::APP_CURSOR, notmode: TermMode::NONE }, triggers: true, mode: TermMode::APP_CURSOR | TermMode::APP_KEYPAD, - mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } + mods: ModifiersState::empty(), } test_process_binding! { name: process_binding_fail_with_extra_mods, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: true }, action: Action::from("arst"), mode: TermMode::NONE, notmode: TermMode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState::LOGO, action: Action::from("arst"), mode: TermMode::NONE, notmode: TermMode::NONE }, triggers: false, mode: TermMode::NONE, - mods: ModifiersState { shift: false, ctrl: false, alt: true, logo: true } + mods: ModifiersState::ALT | ModifiersState::LOGO, } } diff --git a/alacritty/src/url.rs b/alacritty/src/url.rs index 09f66886..e510aa2b 100644 --- a/alacritty/src/url.rs +++ b/alacritty/src/url.rs @@ -154,7 +154,7 @@ impl Urls { ) -> Option { // Make sure all prerequisites for highlighting are met if selection - || (mouse_mode && !mods.shift) + || (mouse_mode && !mods.shift()) || !mouse.inside_grid || config.ui_config.mouse.url.launcher.is_none() || !config.ui_config.mouse.url.mods().relaxed_eq(mods)