From 7d708d53f7ecb4c64db10ae44e7f4fca47c29a85 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Wed, 10 Aug 2022 16:48:46 +0400 Subject: [PATCH] Bump glutin to 0.29.1 Fixes #6239. Fixes #5975. Fixes #5876. Fixes #5767. Fixes #4484. Fixes #3139. --- CHANGELOG.md | 10 + Cargo.lock | 312 +++++++++++------- alacritty.yml | 9 +- alacritty/Cargo.toml | 19 +- alacritty/build.rs | 2 +- alacritty/src/config/window.rs | 18 +- alacritty/src/display/window.rs | 31 +- alacritty/src/event.rs | 58 +++- alacritty/src/main.rs | 41 +-- alacritty/src/renderer/text/builtin_font.rs | 4 +- .../windows/{windows.rc => alacritty.rc} | 0 alacritty_config_derive/src/lib.rs | 3 + alacritty_config_derive/tests/config.rs | 2 +- alacritty_terminal/Cargo.toml | 4 +- 14 files changed, 331 insertions(+), 182 deletions(-) rename alacritty/windows/{windows.rc => alacritty.rc} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cd92c33..c40e8b14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Config option `cursor.blink_timeout` to timeout cursor blinking after inactivity - Escape sequence to set hyperlinks (`OSC 8 ; params ; URI ST`) - Config `hints.enabled.hyperlinks` for hyperlink escape sequence hint highlight +- `window.decorations_theme_variant` to control both Wayland CSD and GTK theme variant on X11 ### Changed @@ -36,6 +37,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Deprecated `colors.search.bar`, use `colors.footer_bar` instead - On macOS, Alacritty now reads `AppleFontSmoothing` from user defaults to control font smoothing - Warn when either `columns` or `lines` is non-zero, but not both +- Client side decorations should have proper text rendering now on Wayland +- Config option `window.gtk_theme_variant`, you should use `window.decorations_theme_variant` instead ### Fixed @@ -55,6 +58,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - On macOS, `font.use_thin_strokes` did not work since Big Sur - On macOS, trying to load a disabled font would crash - On macOS, Alacritty sessions did not appear in the list of tty sessions for `w` and `who` +- Cursor not hiding on GNOME Wayland +- Font having different scale factor after monitor powering off/on on X11 +- Viewport not updating after opening a new tabbed window on macOS +- Terminal not exiting sometimes after closing all windows on macOS +- CPU usage spikes due to mouse movements for unfocused windows on X11 +- First window on macOS not tabbed with system prefer tabs setting +- Window being treaten as focused by default on Wayland ### Removed diff --git a/Cargo.lock b/Cargo.lock index a25d5129..dd4abae4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "adler32" version = "1.2.0" @@ -30,7 +36,7 @@ dependencies = [ "notify", "objc", "once_cell", - "parking_lot", + "parking_lot 0.12.1", "png", "raw-window-handle", "serde", @@ -69,8 +75,8 @@ dependencies = [ "mio-anonymous-pipes", "mio-extras", "miow 0.3.7", - "nix", - "parking_lot", + "nix 0.24.1", + "parking_lot 0.12.1", "regex-automata", "serde", "serde_json", @@ -83,10 +89,16 @@ dependencies = [ ] [[package]] -name = "android_glue" -version = "0.2.3" +name = "arrayref" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "atty" @@ -130,13 +142,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" [[package]] -name = "calloop" -version = "0.9.3" +name = "bytemuck" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf2eec61efe56aa1e813f5126959296933cf0700030e4314786c48779a66ab82" +checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" + +[[package]] +name = "calloop" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22a6a8f622f797120d452c630b0ab12e1331a1a753e2039ce7868d4ac77b4ee" dependencies = [ "log", - "nix", + "nix 0.24.1", + "slotmap", + "thiserror", + "vec_map", ] [[package]] @@ -242,8 +263,8 @@ dependencies = [ "bitflags", "block", "cocoa-foundation", - "core-foundation 0.9.3", - "core-graphics 0.22.3", + "core-foundation", + "core-graphics", "foreign-types 0.3.2", "libc", "objc", @@ -257,7 +278,7 @@ checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" dependencies = [ "bitflags", "block", - "core-foundation 0.9.3", + "core-foundation", "core-graphics-types", "foreign-types 0.3.2", "libc", @@ -278,50 +299,22 @@ dependencies = [ "x11-clipboard", ] -[[package]] -name = "core-foundation" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" -dependencies = [ - "core-foundation-sys 0.7.0", - "libc", -] - [[package]] name = "core-foundation" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys 0.8.3", + "core-foundation-sys", "libc", ] -[[package]] -name = "core-foundation-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" - [[package]] name = "core-foundation-sys" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" -[[package]] -name = "core-graphics" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" -dependencies = [ - "bitflags", - "core-foundation 0.7.0", - "foreign-types 0.3.2", - "libc", -] - [[package]] name = "core-graphics" version = "0.22.3" @@ -329,7 +322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ "bitflags", - "core-foundation 0.9.3", + "core-foundation", "core-graphics-types", "foreign-types 0.3.2", "libc", @@ -342,7 +335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ "bitflags", - "core-foundation 0.9.3", + "core-foundation", "foreign-types 0.3.2", "libc", ] @@ -353,25 +346,12 @@ version = "19.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" dependencies = [ - "core-foundation 0.9.3", - "core-graphics 0.22.3", + "core-foundation", + "core-graphics", "foreign-types 0.3.2", "libc", ] -[[package]] -name = "core-video-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" -dependencies = [ - "cfg-if 0.1.10", - "core-foundation-sys 0.7.0", - "core-graphics 0.19.2", - "libc", - "objc", -] - [[package]] name = "crc32fast" version = "1.3.2" @@ -388,9 +368,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f66b1c1979c4362323f03ab6bf7fb522902bfc418e0c37319ab347f9561d980f" dependencies = [ "cocoa", - "core-foundation 0.9.3", - "core-foundation-sys 0.8.3", - "core-graphics 0.22.3", + "core-foundation", + "core-foundation-sys", + "core-graphics", "core-text", "dwrote", "foreign-types 0.5.0", @@ -445,6 +425,15 @@ dependencies = [ "syn", ] +[[package]] +name = "deflate" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c86f7e25f518f4b81808a2cf1c50996a61f5c2eb394b2393bd87f2a4780a432f" +dependencies = [ + "adler32", +] + [[package]] name = "dirs" version = "4.0.0" @@ -664,25 +653,24 @@ dependencies = [ [[package]] name = "glutin" -version = "0.28.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00ea9dbe544bc8a657c4c4a798c2d16cd01b549820e47657297549d28371f6d2" +checksum = "444c9ad294fdcaf20ccf6726b78f380b5450275540c9b68ab62f49726ad1c713" dependencies = [ - "android_glue", "cgl", "cocoa", - "core-foundation 0.9.3", + "core-foundation", "glutin_egl_sys", - "glutin_emscripten_sys", "glutin_gles2_sys", "glutin_glx_sys", "glutin_wgl_sys", - "lazy_static", "libloading", "log", "objc", + "once_cell", "osmesa-sys", - "parking_lot", + "parking_lot 0.12.1", + "raw-window-handle", "wayland-client", "wayland-egl", "winapi 0.3.9", @@ -691,20 +679,14 @@ dependencies = [ [[package]] name = "glutin_egl_sys" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2abb6aa55523480c4adc5a56bbaa249992e2dddb2fc63dc96e04a3355364c211" +checksum = "68900f84b471f31ea1d1355567eb865a2cf446294f06cef8d653ed7bcf5f013d" dependencies = [ "gl_generator", "winapi 0.3.9", ] -[[package]] -name = "glutin_emscripten_sys" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80de4146df76e8a6c32b03007bc764ff3249dcaeb4f675d68a06caf1bac363f1" - [[package]] name = "glutin_gles2_sys" version = "0.1.5" @@ -717,9 +699,9 @@ dependencies = [ [[package]] name = "glutin_glx_sys" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e393c8fc02b807459410429150e9c4faffdb312d59b8c038566173c81991351" +checksum = "d93d0575865098580c5b3a423188cd959419912ea60b1e48e8b3b526f6d02468" dependencies = [ "gl_generator", "x11-dl", @@ -736,9 +718,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "heck" @@ -763,9 +745,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "indexmap" -version = "1.9.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6392766afd7964e2531940894cffe4bd8d7d17dbc3c1c4857040fd4b33bdb3" +checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" dependencies = [ "autocfg", "hashbrown", @@ -926,9 +908,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" -version = "0.3.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b6c2ebff6180198788f5db08d7ce3bc1d0b617176678831a7510825973e357" +checksum = "d5172b50c23043ff43dd53e51392f36519d9b35a8f3a410d30ece5d1aedd58ae" dependencies = [ "libc", ] @@ -950,11 +932,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.3.7" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" dependencies = [ - "adler32", + "adler", ] [[package]] @@ -996,7 +978,7 @@ checksum = "6bc513025fe5005a3aa561b50fdb2cda5a150b84800ae02acd8aa9ed62ca1a6b" dependencies = [ "mio 0.6.23", "miow 0.3.7", - "parking_lot", + "parking_lot 0.11.2", "spsc-buffer", "winapi 0.3.9", ] @@ -1047,14 +1029,15 @@ dependencies = [ [[package]] name = "ndk" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d868f654c72e75f8687572699cdabe755f03effbb62542768e995d5b8d699d" +checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ "bitflags", "jni-sys", "ndk-sys", "num_enum", + "raw-window-handle", "thiserror", ] @@ -1066,17 +1049,18 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "ndk-glue" -version = "0.5.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71bee8ea72d685477e28bd004cfe1bf99c754d688cd78cad139eae4089484d4" +checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" dependencies = [ - "lazy_static", "libc", "log", "ndk", "ndk-context", "ndk-macro", "ndk-sys", + "once_cell", + "parking_lot 0.12.1", ] [[package]] @@ -1094,9 +1078,12 @@ dependencies = [ [[package]] name = "ndk-sys" -version = "0.2.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" +checksum = "21d83ec9c63ec5bf950200a8e508bdad6659972187b625469f58ef8c08e29046" +dependencies = [ + "jni-sys", +] [[package]] name = "net2" @@ -1122,6 +1109,18 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nix" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "libc", + "memoffset", +] + [[package]] name = "nom" version = "7.1.1" @@ -1202,9 +1201,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" [[package]] name = "os_str_bytes" @@ -1229,7 +1228,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core", + "parking_lot_core 0.8.5", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.3", ] [[package]] @@ -1246,6 +1255,19 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "parking_lot_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + [[package]] name = "percent-encoding" version = "2.1.0" @@ -1260,12 +1282,13 @@ checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "png" -version = "0.16.8" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" +checksum = "dc38c0ad57efb786dd57b9864e5b18bae478c00c824dc55a38bbc9da95dde3ba" dependencies = [ "bitflags", "crc32fast", + "deflate", "miniz_oxide", ] @@ -1332,9 +1355,9 @@ dependencies = [ [[package]] name = "raw-window-handle" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" +checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a" dependencies = [ "cty", ] @@ -1389,6 +1412,15 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +[[package]] +name = "safe_arch" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ff3d6d9696af502cc3110dacce942840fb06ff4514cad92236ecc455f2ce05" +dependencies = [ + "bytemuck", +] + [[package]] name = "same-file" version = "1.0.6" @@ -1410,6 +1442,18 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "sctk-adwaita" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8cdeb3fbbd384de045d5683bfc3cadfc4c6ed1e6471f201ede801f31571581a" +dependencies = [ + "crossfont", + "log", + "smithay-client-toolkit", + "tiny-skia", +] + [[package]] name = "semver" version = "1.0.10" @@ -1527,6 +1571,15 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" +[[package]] +name = "slotmap" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +dependencies = [ + "version_check", +] + [[package]] name = "smallvec" version = "1.8.0" @@ -1535,9 +1588,9 @@ checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "smithay-client-toolkit" -version = "0.15.4" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a28f16a97fa0e8ce563b2774d1e732dd5d4025d2772c5dba0a41a0f90a29da3" +checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" dependencies = [ "bitflags", "calloop", @@ -1545,7 +1598,7 @@ dependencies = [ "lazy_static", "log", "memmap2", - "nix", + "nix 0.24.1", "pkg-config", "wayland-client", "wayland-cursor", @@ -1554,9 +1607,9 @@ dependencies = [ [[package]] name = "smithay-clipboard" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "610b551bd25378bfd2b8e7a0fcbd83d427e8f2f6a40c47ae0f70688e9949dd55" +checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" dependencies = [ "smithay-client-toolkit", "wayland-client", @@ -1620,6 +1673,20 @@ dependencies = [ "syn", ] +[[package]] +name = "tiny-skia" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3e1db967020dd509b49cecc024025beba2b1b6cf204618610ba266269d6b9" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if 1.0.0", + "png", + "safe_arch", +] + [[package]] name = "toml" version = "0.5.9" @@ -1647,6 +1714,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version_check" version = "0.9.4" @@ -1773,7 +1846,7 @@ dependencies = [ "bitflags", "downcast-rs", "libc", - "nix", + "nix 0.22.3", "scoped-tls", "wayland-commons", "wayland-scanner", @@ -1786,7 +1859,7 @@ version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94f6e5e340d7c13490eca867898c4cec5af56c27a5ffe5c80c6fc4708e22d33e" dependencies = [ - "nix", + "nix 0.22.3", "once_cell", "smallvec", "wayland-sys", @@ -1798,7 +1871,7 @@ version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c52758f13d5e7861fc83d942d3d99bf270c83269575e52ac29e5b73cb956a6bd" dependencies = [ - "nix", + "nix 0.22.3", "wayland-client", "xcursor", ] @@ -1945,35 +2018,34 @@ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "winit" -version = "0.26.1" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" +checksum = "b9b91360f15eb89d0bfee05d3c5981408320fe709f84953d3d90b276fc5962c7" dependencies = [ "bitflags", "cocoa", - "core-foundation 0.9.3", - "core-graphics 0.22.3", - "core-video-sys", + "core-foundation", + "core-graphics", "dispatch", "instant", - "lazy_static", "libc", "log", "mio 0.8.3", "ndk", "ndk-glue", - "ndk-sys", "objc", - "parking_lot", + "once_cell", + "parking_lot 0.12.1", "percent-encoding", "raw-window-handle", + "sctk-adwaita", "serde", "smithay-client-toolkit", "wasm-bindgen", "wayland-client", "wayland-protocols", "web-sys", - "winapi 0.3.9", + "windows-sys", "x11-dl", ] diff --git a/alacritty.yml b/alacritty.yml index 0f7bb884..4e9de637 100644 --- a/alacritty.yml +++ b/alacritty.yml @@ -94,11 +94,12 @@ # General application class #general: Alacritty - # GTK theme variant (Linux/BSD only) + # Decorations theme variant (Linux/BSD only) # - # Override the variant of the GTK theme. Commonly supported values are `dark` - # and `light`. Set this to `None` to use the default theme variant. - #gtk_theme_variant: None + # Override the variant of the GTK theme/Wayland client side decorations. + # Commonly supported values are `dark` and `light`. Set this to `None` to use + # the default theme variant. + #decorations_theme_variant: None #scrolling: # Maximum number of lines in the scrollback buffer. diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml index 9b610d86..989f0a83 100644 --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -25,11 +25,11 @@ fnv = "1" serde = { version = "1", features = ["derive"] } serde_yaml = "0.8" serde_json = "1" -glutin = { version = "0.28.0", default-features = false, features = ["serde"] } +glutin = { version = "0.29.1", default-features = false, features = ["serde"] } notify = "4" -parking_lot = "0.11.0" +parking_lot = "0.12.0" crossfont = { version = "0.5.0", features = ["force_system_fontconfig"] } -copypasta = { version = "0.8.0", default-features = false } +copypasta = { version = "0.8.1", default-features = false } libc = "0.2" unicode-width = "0.1" bitflags = "1" @@ -46,10 +46,10 @@ clap_complete = "3.0.0" xdg = "2.4.0" [target.'cfg(not(target_os = "macos"))'.dependencies] -png = { version = "0.16.8", default-features = false, optional = true } +png = { version = "0.17.5", default-features = false, optional = true } [target.'cfg(target_os = "macos")'.dependencies] -raw-window-handle = "0.4.0" +raw-window-handle = "0.5.0" cocoa = "0.24.0" objc = "0.2.2" @@ -61,10 +61,15 @@ wayland-client = { version = "0.29.0", features = ["dlopen"], optional = true } winapi = { version = "0.3.7", features = ["impl-default", "wincon"]} [target.'cfg(windows)'.build-dependencies] -embed-resource = "1.3" +embed-resource = "1.7.2" [features] default = ["wayland", "x11"] x11 = ["copypasta/x11", "glutin/x11", "x11-dl", "png"] -wayland = ["copypasta/wayland", "glutin/wayland", "glutin/wayland-dlopen", "wayland-client"] +wayland = [ + "copypasta/wayland", + "glutin/wayland", + "glutin/wayland-dlopen", + "glutin/wayland-csd-adwaita", + "wayland-client"] nightly = [] diff --git a/alacritty/build.rs b/alacritty/build.rs index 0874f88c..991c7fc7 100644 --- a/alacritty/build.rs +++ b/alacritty/build.rs @@ -20,7 +20,7 @@ fn main() { .unwrap(); #[cfg(windows)] - embed_resource::compile("./windows/windows.rc"); + embed_resource::compile("./windows/alacritty.rc"); } fn commit_hash() -> Option { diff --git a/alacritty/src/config/window.rs b/alacritty/src/config/window.rs index 08f38b57..8a59a007 100644 --- a/alacritty/src/config/window.rs +++ b/alacritty/src/config/window.rs @@ -31,7 +31,13 @@ pub struct WindowConfig { pub embed: Option, /// GTK theme variant. - pub gtk_theme_variant: Option, + #[config(deprecated = "use window.decorations_theme_variant instead")] + gtk_theme_variant: Option, + + /// System decorations theme variant. + /// + /// Controls GTK theme variant on X11 and winit client side decorations on Wayland. + decorations_theme_variant: Option, /// Spread out additional padding evenly. pub dynamic_padding: bool, @@ -61,6 +67,7 @@ impl Default for WindowConfig { decorations: Default::default(), startup_mode: Default::default(), embed: Default::default(), + decorations_theme_variant: Default::default(), gtk_theme_variant: Default::default(), dynamic_padding: Default::default(), identity: Identity::default(), @@ -104,6 +111,15 @@ impl WindowConfig { } } + #[cfg(not(any(target_os = "macos", windows)))] + #[inline] + pub fn decorations_theme_variant(&self) -> Option<&str> { + self.gtk_theme_variant + .as_ref() + .or_else(|| self.decorations_theme_variant.as_ref()) + .map(|theme| theme.as_str()) + } + #[inline] pub fn padding(&self, scale_factor: f64) -> (f32, f32) { let padding_x = (f32::from(self.padding.x) * scale_factor as f32).floor(); diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs index 480654cf..0e754ed4 100644 --- a/alacritty/src/display/window.rs +++ b/alacritty/src/display/window.rs @@ -13,6 +13,7 @@ use { wayland_client::protocol::wl_surface::WlSurface, wayland_client::{Attached, EventQueue, Proxy}, glutin::platform::unix::EventLoopWindowTargetExtUnix, + glutin::window::Theme, }; #[rustfmt::skip] @@ -60,7 +61,7 @@ use crate::gl; #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] static WINDOW_ICON: &[u8] = include_bytes!("../../alacritty.png"); -/// This should match the definition of IDI_ICON from `windows.rc`. +/// This should match the definition of IDI_ICON from `alacritty.rc`. #[cfg(windows)] const IDI_ICON: WORD = 0x101; @@ -233,6 +234,9 @@ impl Window { let current_mouse_cursor = CursorIcon::Text; windowed_context.window().set_cursor_icon(current_mouse_cursor); + // Enable IME. + windowed_context.window().set_ime_allowed(true); + // Set OpenGL symbol loader. This call MUST be after window.make_current on windows. gl::load_with(|symbol| windowed_context.get_proc_address(symbol) as *const _); @@ -323,14 +327,15 @@ impl Window { #[cfg(feature = "x11")] let icon = { let decoder = Decoder::new(Cursor::new(WINDOW_ICON)); - let (info, mut reader) = decoder.read_info().expect("invalid embedded icon"); - let mut buf = vec![0; info.buffer_size()]; + let mut reader = decoder.read_info().expect("invalid embedded icon"); + let mut buf = vec![0; reader.output_buffer_size()]; let _ = reader.next_frame(&mut buf); - Icon::from_rgba(buf, info.width, info.height) + Icon::from_rgba(buf, reader.info().width, reader.info().height) }; let builder = WindowBuilder::new() .with_title(&identity.title) + .with_name(&identity.class.instance, &identity.class.general) .with_visible(false) .with_transparent(true) .with_decorations(window_config.decorations != Decorations::None) @@ -340,19 +345,19 @@ impl Window { #[cfg(feature = "x11")] let builder = builder.with_window_icon(icon.ok()); - #[cfg(feature = "wayland")] - let builder = builder.with_app_id(identity.class.instance.to_owned()); - #[cfg(feature = "x11")] - let builder = builder - .with_class(identity.class.instance.to_owned(), identity.class.general.to_owned()); - - #[cfg(feature = "x11")] - let builder = match &window_config.gtk_theme_variant { - Some(val) => builder.with_gtk_theme_variant(val.clone()), + let builder = match window_config.decorations_theme_variant() { + Some(val) => builder.with_gtk_theme_variant(val.to_string()), None => builder, }; + #[cfg(feature = "wayland")] + let builder = match window_config.decorations_theme_variant() { + Some("light") => builder.with_wayland_csd_theme(Theme::Light), + // Prefer dark theme by default, since default alacritty theme is dark. + _ => builder.with_wayland_csd_theme(Theme::Dark), + }; + builder } diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index cfa1c25c..54bb239e 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -13,8 +13,12 @@ use std::time::{Duration, Instant}; use std::{env, f32, mem}; use glutin::dpi::PhysicalSize; -use glutin::event::{ElementState, Event as GlutinEvent, ModifiersState, MouseButton, WindowEvent}; -use glutin::event_loop::{ControlFlow, EventLoop, EventLoopProxy, EventLoopWindowTarget}; +use glutin::event::{ + ElementState, Event as GlutinEvent, Ime, ModifiersState, MouseButton, StartCause, WindowEvent, +}; +use glutin::event_loop::{ + ControlFlow, DeviceEventFilter, EventLoop, EventLoopProxy, EventLoopWindowTarget, +}; use glutin::platform::run_return::EventLoopExtRunReturn; #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] use glutin::platform::unix::EventLoopWindowTargetExtUnix; @@ -1208,6 +1212,13 @@ impl input::Processor> { *self.ctx.dirty = true; } }, + WindowEvent::Ime(ime) => { + if let Ime::Commit(text) = ime { + for ch in text.chars() { + self.received_char(ch) + } + } + }, WindowEvent::KeyboardInput { is_synthetic: true, .. } | WindowEvent::TouchpadPressure { .. } | WindowEvent::ScaleFactorChanged { .. } @@ -1218,6 +1229,7 @@ impl input::Processor> { | WindowEvent::ThemeChanged(_) | WindowEvent::HoveredFile(_) | WindowEvent::Touch(_) + | WindowEvent::Occluded(_) | WindowEvent::Moved(_) => (), } }, @@ -1289,9 +1301,16 @@ impl Processor { } /// Run the event loop. - pub fn run(&mut self, mut event_loop: EventLoop) { + /// + /// The result is exit code generate from the loop. + pub fn run( + &mut self, + mut event_loop: EventLoop, + initial_window_options: WindowOptions, + ) -> Result<(), Box> { let proxy = event_loop.create_proxy(); let mut scheduler = Scheduler::new(proxy.clone()); + let mut initial_window_options = Some(initial_window_options); // NOTE: Since this takes a pointer to the winit event loop, it MUST be dropped first. #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] @@ -1299,7 +1318,10 @@ impl Processor { #[cfg(any(not(feature = "wayland"), target_os = "macos", windows))] let mut clipboard = Clipboard::new(); - event_loop.run_return(|event, event_loop, control_flow| { + // Disable all device events, since we don't care about them. + event_loop.set_device_event_filter(DeviceEventFilter::Always); + + let exit_code = event_loop.run_return(move |event, event_loop, control_flow| { if self.config.debug.print_events { info!("glutin event: {:?}", event); } @@ -1310,6 +1332,27 @@ impl Processor { } match event { + // The event loop just got initialized. Create a window. + GlutinEvent::Resumed => { + // Creating window inside event loop is required for platforms like macOS to + // properly initialize state, like tab management. Othwerwise the first window + // won't handle tabs. + let initial_window_options = match initial_window_options.take() { + Some(initial_window_options) => initial_window_options, + None => return, + }; + + if let Err(err) = + self.create_window(event_loop, proxy.clone(), initial_window_options) + { + // Log the error right away since we can't return it. + eprintln!("Error: {}", err); + *control_flow = ControlFlow::ExitWithCode(1); + return; + } + + info!("Initialisation complete"); + }, // Check for shutdown. GlutinEvent::UserEvent(Event { window_id: Some(window_id), @@ -1428,11 +1471,18 @@ impl Processor { _ => (), } }); + + if exit_code == 0 { + Ok(()) + } else { + Err(format!("Event loop terminated with code: {}", exit_code).into()) + } } /// Check if an event is irrelevant and can be skipped. fn skip_event(event: &GlutinEvent<'_, Event>) -> bool { match event { + GlutinEvent::NewEvents(StartCause::Init) => false, GlutinEvent::WindowEvent { event, .. } => matches!( event, WindowEvent::KeyboardInput { is_synthetic: true, .. } diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs index a0a98efe..2e7c30a9 100644 --- a/alacritty/src/main.rs +++ b/alacritty/src/main.rs @@ -14,13 +14,13 @@ compile_error!(r#"at least one of the "x11"/"wayland" features must be enabled"# #[cfg(target_os = "macos")] use std::env; +use std::error::Error; use std::fmt::Write as _; +use std::fs; use std::io::{self, Write}; use std::path::PathBuf; -use std::string::ToString; -use std::{fs, process}; -use glutin::event_loop::EventLoop as GlutinEventLoop; +use glutin::event_loop::EventLoopBuilder as GlutinEventLoopBuilder; #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] use glutin::platform::unix::EventLoopWindowTargetExtUnix; use log::info; @@ -62,7 +62,7 @@ use crate::event::{Event, Processor}; #[cfg(target_os = "macos")] use crate::macos::locale; -fn main() { +fn main() -> Result<(), Box> { #[cfg(windows)] panic::attach_handler(); @@ -78,25 +78,19 @@ fn main() { let options = Options::new(); #[cfg(unix)] - let result = match options.subcommands { + match options.subcommands { Some(Subcommands::Msg(options)) => msg(options), None => alacritty(options), - }; + } #[cfg(not(unix))] - let result = alacritty(options); - - // Handle command failure. - if let Err(err) = result { - eprintln!("Error: {}", err); - process::exit(1); - } + alacritty(options) } /// `msg` subcommand entrypoint. #[cfg(unix)] -fn msg(options: MessageOptions) -> Result<(), String> { - ipc::send_message(options.socket, options.message).map_err(|err| err.to_string()) +fn msg(options: MessageOptions) -> Result<(), Box> { + ipc::send_message(options.socket, options.message).map_err(|err| err.into()) } /// Temporary files stored for Alacritty. @@ -129,9 +123,9 @@ impl Drop for TemporaryFiles { /// /// Creates a window, the terminal state, PTY, I/O event loop, input processor, /// config change monitor, and runs the main display loop. -fn alacritty(options: Options) -> Result<(), String> { +fn alacritty(options: Options) -> Result<(), Box> { // Setup glutin event loop. - let window_event_loop = GlutinEventLoop::::with_user_event(); + let window_event_loop = GlutinEventLoopBuilder::::with_user_event().build(); // Initialize the logger as soon as possible as to capture output from other subsystems. let log_file = logging::initialize(&options, window_event_loop.create_proxy()) @@ -191,16 +185,8 @@ fn alacritty(options: Options) -> Result<(), String> { let window_options = options.window_options.clone(); let mut processor = Processor::new(config, options, &window_event_loop); - // Create the first Alacritty window. - let proxy = window_event_loop.create_proxy(); - processor - .create_window(&window_event_loop, proxy, window_options) - .map_err(|err| err.to_string())?; - - info!("Initialisation complete"); - // Start event loop and block until shutdown. - processor.run(window_event_loop); + let result = processor.run(window_event_loop, window_options); // This explicit drop is needed for Windows, ConPTY backend. Otherwise a deadlock can occur. // The cause: @@ -225,7 +211,8 @@ fn alacritty(options: Options) -> Result<(), String> { } info!("Goodbye"); - Ok(()) + + result } fn log_config_path(config: &UiConfig) { diff --git a/alacritty/src/renderer/text/builtin_font.rs b/alacritty/src/renderer/text/builtin_font.rs index a4bf65e3..66c5db0f 100644 --- a/alacritty/src/renderer/text/builtin_font.rs +++ b/alacritty/src/renderer/text/builtin_font.rs @@ -90,8 +90,8 @@ fn box_drawing(character: char, metrics: &Metrics, offset: &Delta) -> Raster left: 0, height: height as i32, width: width as i32, - advance: (0, 0), buffer, + advance: (width as i32, height as i32), }; }, _ => Canvas::new(width, height), @@ -486,8 +486,8 @@ fn box_drawing(character: char, metrics: &Metrics, offset: &Delta) -> Raster left: 0, height: height as i32, width: width as i32, - advance: (0, 0), buffer, + advance: (width as i32, height as i32), } } diff --git a/alacritty/windows/windows.rc b/alacritty/windows/alacritty.rc similarity index 100% rename from alacritty/windows/windows.rc rename to alacritty/windows/alacritty.rc diff --git a/alacritty_config_derive/src/lib.rs b/alacritty_config_derive/src/lib.rs index 8601d5cb..af8f2e7f 100644 --- a/alacritty_config_derive/src/lib.rs +++ b/alacritty_config_derive/src/lib.rs @@ -1,3 +1,6 @@ +#![deny(clippy::all, clippy::if_not_else, clippy::enum_glob_use)] +#![cfg_attr(feature = "cargo-clippy", deny(warnings))] + use proc_macro::TokenStream; use syn::{parse_macro_input, Data, DataStruct, DeriveInput, Error, Fields, Path}; diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs index 2cdae613..4828b822 100644 --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -105,7 +105,7 @@ fn config_deserialize() { assert_eq!(test.enom_small, TestEnum::One); assert_eq!(test.enom_big, TestEnum::Three); assert_eq!(test.enom_error, Test::default().enom_error); - assert_eq!(test.gone, false); + assert!(!test.gone); assert_eq!(test.nesting.field1, Test::default().nesting.field1); assert_eq!(test.nesting.field2, None); assert_eq!(test.nesting.field3, Test::default().nesting.field3); diff --git a/alacritty_terminal/Cargo.toml b/alacritty_terminal/Cargo.toml index e758009c..fb5d2d22 100644 --- a/alacritty_terminal/Cargo.toml +++ b/alacritty_terminal/Cargo.toml @@ -16,7 +16,7 @@ version = "0.1.0" [dependencies] libc = "0.2" bitflags = "1" -parking_lot = "0.11.0" +parking_lot = "0.12.0" serde = { version = "1", features = ["derive", "rc"] } serde_yaml = "0.8" vte = { version = "0.10.0", default-features = false } @@ -29,7 +29,7 @@ regex-automata = "0.1.9" dirs = "4.0.0" [target.'cfg(unix)'.dependencies] -nix = "0.22.0" +nix = "0.24.1" signal-hook = "0.3.10" signal-hook-mio = { version = "0.2.1", features = ["support-v0_6"] }