From 80d4daccc307622f8e604af4f36ac89ecccf5db7 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Sat, 21 Oct 2023 22:56:20 +0400 Subject: [PATCH] Update winit to 0.29.2 and copypasta to 0.10.0 Fixes #7236. Fixes #7201. Fixes #7146. Fixes #6848. Fixes #3601. Fixes #3108. Fixes #2453. --- CHANGELOG.md | 6 + Cargo.lock | 482 +++++++++-------------------- alacritty/Cargo.toml | 11 +- alacritty/src/cli.rs | 5 +- alacritty/src/clipboard.rs | 2 +- alacritty/src/config/bindings.rs | 31 +- alacritty/src/config/window.rs | 3 +- alacritty/src/display/mod.rs | 7 +- alacritty/src/display/window.rs | 70 +---- alacritty/src/event.rs | 55 +++- alacritty/src/renderer/platform.rs | 2 +- alacritty/src/window_context.rs | 18 +- extra/man/alacritty.5.scd | 6 +- 13 files changed, 250 insertions(+), 448 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d15626fb..4c51fa35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Double clicking on CSD titlebar not always maximizing a window on Wayland - Excessive memory usage when using regexes with a large number of possible states - `window.decorations_theme_variant` not live reloading +- Copy/Paste being truncated to 64KiB on Wayland +- X11 clipboard lagging behind sometimes +- High wakeup count on Wayland due to clipboard polling +- Blocking paste freezing alacritty on Wayland +- `Command` modifier persisting after `Cmd + Tab` on macOS +- Crash on exit when using NVIDIA binary drivers on Wayland ### Removed diff --git a/Cargo.lock b/Cargo.lock index c392400c..a0d4ec42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,6 +55,7 @@ dependencies = [ "once_cell", "parking_lot", "png", + "raw-window-handle 0.5.2", "serde", "serde_json", "serde_yaml", @@ -62,7 +63,6 @@ dependencies = [ "unicode-width", "windows-sys 0.48.0", "winit", - "x11-dl", "xdg", ] @@ -117,9 +117,9 @@ dependencies = [ [[package]] name = "android-activity" -version = "0.5.0-beta.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934936a9ad4dc79563cd6644fcef68dc328f105d927679454de39ad03ca1cfe8" +checksum = "052ad56e336bcc615a214bffbeca6c181ee9550acec193f0327e0b103b033a4d" dependencies = [ "android-properties", "bitflags 2.4.0", @@ -247,32 +247,13 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" -[[package]] -name = "block-sys" -version = "0.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" -dependencies = [ - "objc-sys 0.2.0-beta.2", -] - [[package]] name = "block-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dd7cf50912cddc06dc5ea7c08c5e81c1b2c842a70d19def1848d54c586fed92" dependencies = [ - "objc-sys 0.3.1", -] - -[[package]] -name = "block2" -version = "0.2.0-alpha.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" -dependencies = [ - "block-sys 0.1.0-beta.1", - "objc2-encode 2.0.0-pre.2", + "objc-sys", ] [[package]] @@ -281,8 +262,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" dependencies = [ - "block-sys 0.2.0", - "objc2 0.4.1", + "block-sys", + "objc2", ] [[package]] @@ -305,16 +286,28 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "calloop" -version = "0.10.6" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" +checksum = "7b50b5a44d59a98c55a9eeb518f39bf7499ba19fd98ee7d22618687f3f10adbf" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "log", - "nix 0.25.1", - "slotmap", + "polling", + "rustix", + "slab", "thiserror", - "vec_map", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" +dependencies = [ + "calloop", + "rustix", + "wayland-backend", + "wayland-client", ] [[package]] @@ -495,9 +488,9 @@ dependencies = [ [[package]] name = "copypasta" -version = "0.8.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "133fc8675ee3a4ec9aa513584deda9aa0faeda3586b87f7f0f2ba082c66fb172" +checksum = "6d35364349bf9e9e1c3a035ddcb00d188d23a3c40c50244c03c27a99fc6a65ae" dependencies = [ "clipboard-win", "objc", @@ -775,12 +768,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - [[package]] name = "foreign-types" version = "0.3.2" @@ -860,16 +847,6 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" -[[package]] -name = "gethostname" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "gethostname" version = "0.3.0" @@ -904,11 +881,11 @@ dependencies = [ [[package]] name = "glutin" -version = "0.30.10" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc93b03242719b8ad39fb26ed2b01737144ce7bd4bfc7adadcef806596760fe" +checksum = "04c03bcbdb3c865ac10196deaddbcea719e601d2d3eef7541872b8dee3492a36" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "cfg_aliases", "cgl", "core-foundation", @@ -916,30 +893,31 @@ dependencies = [ "glutin_egl_sys", "glutin_glx_sys", "glutin_wgl_sys", - "libloading 0.7.4", - "objc2 0.3.0-beta.3.patch-leaks.3", + "icrate", + "libloading 0.8.1", + "objc2", "once_cell", - "raw-window-handle", - "wayland-sys 0.30.1", - "windows-sys 0.45.0", + "raw-window-handle 0.5.2", + "wayland-sys", + "windows-sys 0.48.0", "x11-dl", ] [[package]] name = "glutin_egl_sys" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af784eb26c5a68ec85391268e074f0aa618c096eadb5d6330b0911cf34fe57c5" +checksum = "77cc5623f5309ef433c3dd4ca1223195347fe62c413da8e2fdd0eb76db2d9bcd" dependencies = [ "gl_generator", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "glutin_glx_sys" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b53cb5fe568964aa066a3ba91eac5ecbac869fb0842cd0dc9e412434f1a1494" +checksum = "a165fd686c10dcc2d45380b35796e577eacfd43d4660ee741ec8ebe2201b3b4f" dependencies = [ "gl_generator", "x11-dl", @@ -947,9 +925,9 @@ dependencies = [ [[package]] name = "glutin_wgl_sys" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef89398e90033fc6bc65e9bd42fd29bbbfd483bda5b56dc5562f455550618165" +checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead" dependencies = [ "gl_generator", ] @@ -966,12 +944,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" - [[package]] name = "home" version = "0.5.5" @@ -987,9 +959,9 @@ version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319" dependencies = [ - "block2 0.3.0", + "block2", "dispatch", - "objc2 0.4.1", + "objc2", ] [[package]] @@ -1022,17 +994,6 @@ dependencies = [ "libc", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "itoa" version = "1.0.9" @@ -1185,22 +1146,13 @@ checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memmap2" -version = "0.5.10" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +checksum = "deaba38d7abf1d4cca21cc89e932e542ba2b9258664d2a9ef0e61512039c9375" dependencies = [ "libc", ] -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.7.1" @@ -1249,16 +1201,17 @@ dependencies = [ [[package]] name = "ndk" -version = "0.8.0-beta.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f58741784b0f6ac12311c3f6fbdb3c766a992f8914d035c77a07b5fd2940dc" +checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" dependencies = [ "bitflags 2.4.0", "jni-sys", "log", "ndk-sys", "num_enum", - "raw-window-handle", + "raw-window-handle 0.5.2", + "raw-window-handle 0.6.0", "thiserror", ] @@ -1270,38 +1223,13 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "ndk-sys" -version = "0.5.0-beta.0+25.2.9519653" +version = "0.5.0+25.2.9519653" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff38603775cba10d0f1141fab1b167df73662a0636a4b631c187fe11fb624042" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" dependencies = [ "jni-sys", ] -[[package]] -name = "nix" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.6.5", -] - -[[package]] -name = "nix" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" -dependencies = [ - "autocfg", - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.6.5", -] - [[package]] name = "nix" version = "0.26.4" @@ -1311,7 +1239,7 @@ dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", - "memoffset 0.7.1", + "memoffset", ] [[package]] @@ -1384,46 +1312,20 @@ dependencies = [ "objc_id", ] -[[package]] -name = "objc-sys" -version = "0.2.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" - [[package]] name = "objc-sys" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845" -[[package]] -name = "objc2" -version = "0.3.0-beta.3.patch-leaks.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" -dependencies = [ - "block2 0.2.0-alpha.6", - "objc-sys 0.2.0-beta.2", - "objc2-encode 2.0.0-pre.2", -] - [[package]] name = "objc2" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" dependencies = [ - "objc-sys 0.3.1", - "objc2-encode 3.0.0", -] - -[[package]] -name = "objc2-encode" -version = "2.0.0-pre.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" -dependencies = [ - "objc-sys 0.2.0-beta.2", + "objc-sys", + "objc2-encode", ] [[package]] @@ -1562,9 +1464,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.28.2" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" dependencies = [ "memchr", ] @@ -1584,6 +1486,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" +[[package]] +name = "raw-window-handle" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" + [[package]] name = "redox_syscall" version = "0.2.16" @@ -1693,13 +1601,13 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sctk-adwaita" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b1ea0ce9e629064237c642f344cc2d9d8028e9b8367d894d2aa7f9243872176" +checksum = "1729a30a469de249c6effc17ec8d039b0aa29b3af79b819b7f51cb6ab8046a90" dependencies = [ "crossfont", "log", - "smithay-client-toolkit 0.17.0", + "smithay-client-toolkit", "tiny-skia", ] @@ -1809,12 +1717,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] -name = "slotmap" -version = "1.0.6" +name = "slab" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ - "version_check", + "autocfg", ] [[package]] @@ -1825,52 +1733,38 @@ checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "smithay-client-toolkit" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870427e30b8f2cbe64bf43ec4b86e88fe39b0a84b3f15efd9c9c2d020bc86eb9" +checksum = "60e3d9941fa3bacf7c2bf4b065304faa14164151254cd16ce1b1bc8fc381600f" dependencies = [ - "bitflags 1.3.2", - "dlib", - "lazy_static", - "log", - "memmap2", - "nix 0.24.3", - "pkg-config", - "wayland-client 0.29.5", - "wayland-cursor 0.29.5", - "wayland-protocols 0.29.5", -] - -[[package]] -name = "smithay-client-toolkit" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1476c3d89bb67079264b88aaf4f14358353318397e083b7c4e8c14517f55de7" -dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "calloop", - "dlib", - "lazy_static", + "calloop-wayland-source", + "cursor-icon", + "libc", "log", "memmap2", - "nix 0.26.4", + "rustix", "thiserror", "wayland-backend", - "wayland-client 0.30.2", - "wayland-cursor 0.30.0", - "wayland-protocols 0.30.1", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", "wayland-protocols-wlr", - "wayland-scanner 0.30.1", + "wayland-scanner", + "xkeysym", ] [[package]] name = "smithay-clipboard" -version = "0.6.6" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" +checksum = "0bb62b280ce5a5cba847669933a0948d00904cf83845c944eae96a4738cea1a6" dependencies = [ - "smithay-client-toolkit 0.16.1", - "wayland-client 0.29.5", + "libc", + "smithay-client-toolkit", + "wayland-backend", ] [[package]] @@ -2056,12 +1950,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[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" @@ -2196,135 +2084,95 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wayland-backend" -version = "0.1.2" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b48e27457e8da3b2260ac60d0a94512f5cba36448679f3747c0865b7893ed8" +checksum = "19152ddd73f45f024ed4534d9ca2594e0ef252c1847695255dae47f34df9fbe4" dependencies = [ "cc", "downcast-rs", - "io-lifetimes", - "nix 0.26.4", + "nix", "scoped-tls", "smallvec", - "wayland-sys 0.30.1", + "wayland-sys", ] [[package]] name = "wayland-client" -version = "0.29.5" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" +checksum = "1ca7d52347346f5473bf2f56705f360e8440873052e575e55890c4fa57843ed3" dependencies = [ - "bitflags 1.3.2", - "downcast-rs", - "libc", - "nix 0.24.3", - "scoped-tls", - "wayland-commons", - "wayland-scanner 0.29.5", - "wayland-sys 0.29.5", -] - -[[package]] -name = "wayland-client" -version = "0.30.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489c9654770f674fc7e266b3c579f4053d7551df0ceb392f153adb1f9ed06ac8" -dependencies = [ - "bitflags 1.3.2", - "calloop", - "nix 0.26.4", + "bitflags 2.4.0", + "nix", "wayland-backend", - "wayland-scanner 0.30.1", + "wayland-scanner", ] [[package]] -name = "wayland-commons" -version = "0.29.5" +name = "wayland-csd-frame" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" dependencies = [ - "nix 0.24.3", - "once_cell", - "smallvec", - "wayland-sys 0.29.5", + "bitflags 2.4.0", + "cursor-icon", + "wayland-backend", ] [[package]] name = "wayland-cursor" -version = "0.29.5" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" +checksum = "a44aa20ae986659d6c77d64d808a046996a932aa763913864dc40c359ef7ad5b" dependencies = [ - "nix 0.24.3", - "wayland-client 0.29.5", - "xcursor", -] - -[[package]] -name = "wayland-cursor" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0c3a0d5b4b688b07b0442362d3ed6bf04724fcc16cd69ab6285b90dbc487aa" -dependencies = [ - "nix 0.26.4", - "wayland-client 0.30.2", + "nix", + "wayland-client", "xcursor", ] [[package]] name = "wayland-protocols" -version = "0.29.5" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" +checksum = "e253d7107ba913923dc253967f35e8561a3c65f914543e46843c88ddd729e21c" dependencies = [ - "bitflags 1.3.2", - "wayland-client 0.29.5", - "wayland-commons", - "wayland-scanner 0.29.5", + "bitflags 2.4.0", + "wayland-backend", + "wayland-client", + "wayland-scanner", ] [[package]] -name = "wayland-protocols" -version = "0.30.1" +name = "wayland-protocols-plasma" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b28101e5ca94f70461a6c2d610f76d85ad223d042dd76585ab23d3422dd9b4d" +checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "wayland-backend", - "wayland-client 0.30.2", - "wayland-scanner 0.30.1", + "wayland-client", + "wayland-protocols", + "wayland-scanner", ] [[package]] name = "wayland-protocols-wlr" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce991093320e4a6a525876e6b629ab24da25f9baef0c2e0080ad173ec89588a" +checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "wayland-backend", - "wayland-client 0.30.2", - "wayland-protocols 0.30.1", - "wayland-scanner 0.30.1", + "wayland-client", + "wayland-protocols", + "wayland-scanner", ] [[package]] name = "wayland-scanner" -version = "0.29.5" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" -dependencies = [ - "proc-macro2", - "quote", - "xml-rs", -] - -[[package]] -name = "wayland-scanner" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9b873b257fbc32ec909c0eb80dea312076a67014e65e245f5eb69a6b8ab330e" +checksum = "fb8e28403665c9f9513202b7e1ed71ec56fde5c107816843fb14057910b2c09c" dependencies = [ "proc-macro2", "quick-xml", @@ -2333,24 +2181,13 @@ dependencies = [ [[package]] name = "wayland-sys" -version = "0.29.5" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" +checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" dependencies = [ "dlib", - "lazy_static", - "pkg-config", -] - -[[package]] -name = "wayland-sys" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b2a02ac608e07132978689a6f9bf4214949c85998c247abadd4f4129b1aa06" -dependencies = [ - "dlib", - "lazy_static", "log", + "once_cell", "pkg-config", ] @@ -2549,10 +2386,11 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winit" -version = "0.29.1-beta" +version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab977231134a3123c5382f0358b728118e70c216ec99017aa24e9eed35d5e3e1" +checksum = "b829f75d02fe1e225b97c91a04c326900147a50234d1141a1cbe215ce8798c11" dependencies = [ + "ahash", "android-activity", "atomic-waker", "bitflags 2.4.0", @@ -2560,9 +2398,8 @@ dependencies = [ "calloop", "cfg_aliases", "core-foundation", - "core-graphics 0.22.3", + "core-graphics 0.23.1", "cursor-icon", - "fnv", "icrate", "js-sys", "libc", @@ -2570,28 +2407,29 @@ dependencies = [ "memmap2", "ndk", "ndk-sys", - "objc2 0.4.1", + "objc2", "once_cell", "orbclient", "percent-encoding", - "raw-window-handle", + "raw-window-handle 0.5.2", "redox_syscall 0.3.5", "rustix", "sctk-adwaita", "serde", - "smithay-client-toolkit 0.17.0", + "smithay-client-toolkit", "smol_str", "unicode-segmentation", "wasm-bindgen", "wasm-bindgen-futures", "wayland-backend", - "wayland-client 0.30.2", - "wayland-protocols 0.30.1", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", "web-sys", "web-time", "windows-sys 0.48.0", "x11-dl", - "x11rb 0.12.0", + "x11rb", "xkbcommon-dl", ] @@ -2625,11 +2463,11 @@ dependencies = [ [[package]] name = "x11-clipboard" -version = "0.7.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "980b9aa9226c3b7de8e2adb11bf20124327c054e0e5812d2aac0b5b5a87e7464" +checksum = "b41aca1115b1f195f21c541c5efb423470848d48143127d0f07f8b90c27440df" dependencies = [ - "x11rb 0.10.1", + "x11rb", ] [[package]] @@ -2643,19 +2481,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "x11rb" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507" -dependencies = [ - "gethostname 0.2.3", - "nix 0.24.3", - "winapi", - "winapi-wsapoll", - "x11rb-protocol 0.10.0", -] - [[package]] name = "x11rb" version = "0.12.0" @@ -2663,23 +2488,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a" dependencies = [ "as-raw-xcb-connection", - "gethostname 0.3.0", + "gethostname", "libc", "libloading 0.7.4", - "nix 0.26.4", + "nix", "once_cell", "winapi", "winapi-wsapoll", - "x11rb-protocol 0.12.0", -] - -[[package]] -name = "x11rb-protocol" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67" -dependencies = [ - "nix 0.24.3", + "x11rb-protocol", ] [[package]] @@ -2688,7 +2504,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82d6c3f9a0fb6701fab8f6cea9b0c0bd5d6876f1f89f7fada07e558077c344bc" dependencies = [ - "nix 0.26.4", + "nix", ] [[package]] diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml index 44a8bc2f..0752b2d2 100644 --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -26,21 +26,22 @@ version = "0.1.2-dev" ahash = { version = "0.8.3", features = ["no-rng"] } bitflags = "2.2.1" clap = { version = "4.2.7", features = ["derive", "env"] } -copypasta = { version = "0.8.1", default-features = false } +copypasta = { version = "0.10.0", default-features = false } crossfont = { version = "0.5.0", features = ["force_system_fontconfig"] } -glutin = { version = "0.30.4", default-features = false, features = ["egl", "wgl"] } +glutin = { version = "0.31.0", default-features = false, features = ["egl", "wgl"] } home = "0.5.5" libc = "0.2" log = { version = "0.4", features = ["std", "serde"] } notify = "6.1.1" once_cell = "1.12" parking_lot = "0.12.0" +raw-window-handle = "0.5" serde = { version = "1", features = ["derive"] } serde_json = "1" serde_yaml = "0.9.25" toml = "0.8.2" unicode-width = "0.1" -winit = { version = "0.29.1-beta", default-features = false, features = ["serde"] } +winit = { version = "0.29.2", default-features = false, features = ["rwh_05", "serde"] } [build-dependencies] gl_generator = "0.14.0" @@ -58,9 +59,6 @@ png = { version = "0.17.5", default-features = false, optional = true } cocoa = "0.25.0" objc = "0.2.2" -[target.'cfg(not(any(target_os="windows", target_os="macos")))'.dependencies] -x11-dl = { version = "2", optional = true } - [target.'cfg(windows)'.dependencies] dirs = "5.0.1" windows-sys = { version = "0.48", features = [ @@ -80,7 +78,6 @@ x11 = [ "winit/x11", "glutin/x11", "glutin/glx", - "x11-dl", "png", ] wayland = [ diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs index d2982bde..c9890b9b 100644 --- a/alacritty/src/cli.rs +++ b/alacritty/src/cli.rs @@ -1,5 +1,4 @@ use std::cmp::max; -use std::os::raw::c_ulong; use std::path::PathBuf; use clap::{ArgAction, Args, Parser, Subcommand, ValueHint}; @@ -149,10 +148,10 @@ fn parse_class(input: &str) -> Result { } /// Convert to hex if possible, else decimal -fn parse_hex_or_decimal(input: &str) -> Option { +fn parse_hex_or_decimal(input: &str) -> Option { input .strip_prefix("0x") - .and_then(|value| c_ulong::from_str_radix(value, 16).ok()) + .and_then(|value| u32::from_str_radix(value, 16).ok()) .or_else(|| input.parse().ok()) } diff --git a/alacritty/src/clipboard.rs b/alacritty/src/clipboard.rs index 35982cf5..b3818c75 100644 --- a/alacritty/src/clipboard.rs +++ b/alacritty/src/clipboard.rs @@ -1,5 +1,5 @@ use log::{debug, warn}; -use winit::window::raw_window_handle::RawDisplayHandle; +use raw_window_handle::RawDisplayHandle; use alacritty_terminal::term::ClipboardType; diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs index 71278fd7..914d25ff 100644 --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -8,8 +8,9 @@ use serde::{Deserialize, Deserializer}; use toml::Value as SerdeValue; use winit::event::MouseButton; use winit::keyboard::Key::*; -use winit::keyboard::{Key, KeyCode, KeyLocation, ModifiersState}; -use winit::platform::scancode::KeyCodeExtScancode; +use winit::keyboard::NamedKey::*; +use winit::keyboard::{Key, KeyCode, KeyLocation, ModifiersState, NamedKey, PhysicalKey}; +use winit::platform::scancode::PhysicalKeyExtScancode; use alacritty_config_derive::{ConfigDeserialize, SerdeReplace}; @@ -418,7 +419,7 @@ macro_rules! trigger { BindingKey::Keycode { key: Character($key.into()), location: KeyLocation::Standard } }}; (KeyBinding, $key:expr,) => {{ - BindingKey::Keycode { key: $key, location: KeyLocation::Standard } + BindingKey::Keycode { key: Named($key), location: KeyLocation::Standard } }}; ($ty:ident, $key:expr,) => {{ $key @@ -716,7 +717,7 @@ pub fn platform_key_bindings() -> Vec { #[derive(Clone, Debug, Eq, PartialEq, Hash)] pub enum BindingKey { - Scancode(KeyCode), + Scancode(PhysicalKey), Keycode { key: Key, location: KeyLocation }, } @@ -727,7 +728,7 @@ impl<'a> Deserialize<'a> for BindingKey { { let value = SerdeValue::deserialize(deserializer)?; match u32::deserialize(value.clone()) { - Ok(scancode) => Ok(BindingKey::Scancode(KeyCode::from_scancode(scancode))), + Ok(scancode) => Ok(BindingKey::Scancode(PhysicalKey::from_scancode(scancode))), Err(_) => { let keycode = String::deserialize(value.clone()).map_err(D::Error::custom)?; let (key, location) = if keycode.chars().count() == 1 { @@ -735,15 +736,15 @@ impl<'a> Deserialize<'a> for BindingKey { } else { // Translate legacy winit codes into their modern counterparts. match keycode.as_str() { - "Up" => (Key::ArrowUp, KeyLocation::Standard), - "Back" => (Key::Backspace, KeyLocation::Standard), - "Down" => (Key::ArrowDown, KeyLocation::Standard), - "Left" => (Key::ArrowLeft, KeyLocation::Standard), - "Right" => (Key::ArrowRight, KeyLocation::Standard), + "Up" => (Key::Named(ArrowUp), KeyLocation::Standard), + "Back" => (Key::Named(Backspace), KeyLocation::Standard), + "Down" => (Key::Named(ArrowDown), KeyLocation::Standard), + "Left" => (Key::Named(ArrowLeft), KeyLocation::Standard), + "Right" => (Key::Named(ArrowRight), KeyLocation::Standard), "At" => (Key::Character("@".into()), KeyLocation::Standard), "Colon" => (Key::Character(":".into()), KeyLocation::Standard), "Period" => (Key::Character(".".into()), KeyLocation::Standard), - "Return" => (Key::Enter, KeyLocation::Standard), + "Return" => (Key::Named(Enter), KeyLocation::Standard), "LBracket" => (Key::Character("[".into()), KeyLocation::Standard), "RBracket" => (Key::Character("]".into()), KeyLocation::Standard), "Semicolon" => (Key::Character(";".into()), KeyLocation::Standard), @@ -766,7 +767,7 @@ impl<'a> Deserialize<'a> for BindingKey { "Key0" => (Key::Character("0".into()), KeyLocation::Standard), // Special case numpad. - "NumpadEnter" => (Key::Enter, KeyLocation::Numpad), + "NumpadEnter" => (Key::Named(Enter), KeyLocation::Numpad), "NumpadAdd" => (Key::Character("+".into()), KeyLocation::Numpad), "NumpadComma" => (Key::Character(",".into()), KeyLocation::Numpad), "NumpadDivide" => (Key::Character("/".into()), KeyLocation::Numpad), @@ -783,10 +784,14 @@ impl<'a> Deserialize<'a> for BindingKey { "Numpad8" => (Key::Character("8".into()), KeyLocation::Numpad), "Numpad9" => (Key::Character("9".into()), KeyLocation::Numpad), "Numpad0" => (Key::Character("0".into()), KeyLocation::Numpad), - _ => ( + _ if keycode.starts_with("Dead") => ( Key::deserialize(value).map_err(D::Error::custom)?, KeyLocation::Standard, ), + _ => ( + Key::Named(NamedKey::deserialize(value).map_err(D::Error::custom)?), + KeyLocation::Standard, + ), } }; diff --git a/alacritty/src/config/window.rs b/alacritty/src/config/window.rs index 4b63c3e9..9d40b5ad 100644 --- a/alacritty/src/config/window.rs +++ b/alacritty/src/config/window.rs @@ -1,5 +1,4 @@ use std::fmt::{self, Formatter}; -use std::os::raw::c_ulong; use log::{error, warn}; use serde::de::{self, MapAccess, Visitor}; @@ -31,7 +30,7 @@ pub struct WindowConfig { /// XEmbed parent. #[config(skip)] - pub embed: Option, + pub embed: Option, /// System decorations theme variant. pub decorations_theme_variant: Option, diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs index 255b587a..2b5cc348 100644 --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -14,10 +14,10 @@ use glutin::surface::{Rect as DamageRect, Surface, SwapInterval, WindowSurface}; use log::{debug, info}; use parking_lot::MutexGuard; +use raw_window_handle::RawWindowHandle; use serde::{Deserialize, Serialize}; use winit::dpi::PhysicalSize; use winit::keyboard::ModifiersState; -use winit::window::raw_window_handle::RawWindowHandle; use winit::window::CursorIcon; use crossfont::{self, Rasterize, Rasterizer}; @@ -987,10 +987,7 @@ impl Display { // XXX: Request the new frame after swapping buffers, so the // time to finish OpenGL operations is accounted for in the timeout. - if matches!( - self.raw_window_handle, - RawWindowHandle::AppKit(_) | RawWindowHandle::Xlib(_) | RawWindowHandle::Xcb(_) - ) { + if !matches!(self.raw_window_handle, RawWindowHandle::Wayland(_)) { self.request_frame(scheduler); } diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs index afa5a181..5606ca4f 100644 --- a/alacritty/src/display/window.rs +++ b/alacritty/src/display/window.rs @@ -11,9 +11,7 @@ use winit::platform::wayland::WindowBuilderExtWayland; use { std::io::Cursor, winit::platform::x11::{WindowBuilderExtX11, EventLoopWindowTargetExtX11}, - winit::window::raw_window_handle::{HasRawDisplayHandle, RawDisplayHandle}, glutin::platform::x11::X11VisualInfo, - x11_dl::xlib::{Display as XDisplay, PropModeReplace, XErrorEvent, Xlib}, winit::window::Icon, png::Decoder, }; @@ -28,12 +26,12 @@ use { winit::platform::macos::{OptionAsAlt, WindowBuilderExtMacOS, WindowExtMacOS}, }; +use raw_window_handle::{HasRawWindowHandle, RawWindowHandle}; use winit::dpi::{PhysicalPosition, PhysicalSize}; use winit::event_loop::EventLoopWindowTarget; use winit::monitor::MonitorHandle; #[cfg(windows)] use winit::platform::windows::IconExtWindows; -use winit::window::raw_window_handle::{HasRawWindowHandle, RawWindowHandle}; use winit::window::{ CursorIcon, Fullscreen, ImePurpose, Theme, UserAttentionType, Window as WinitWindow, WindowBuilder, WindowId, @@ -154,9 +152,14 @@ impl Window { window_builder = window_builder.with_activation_token(token); // Remove the token from the env. - unsafe { - startup_notify::reset_activation_token_env(); - } + startup_notify::reset_activation_token_env(); + } + + // On X11, embed the window inside another if the parent ID has been set. + #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] + if let Some(parent_window_id) = event_loop.is_x11().then_some(config.window.embed).flatten() + { + window_builder = window_builder.with_embed_parent_window(parent_window_id); } let window = window_builder @@ -182,13 +185,6 @@ impl Window { #[cfg(target_os = "macos")] use_srgb_color_space(&window); - // On X11, embed the window inside another if the parent ID has been set. - #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] - if let Some(parent_window_id) = event_loop.is_x11().then_some(config.window.embed).flatten() - { - x_embed_window(&window, parent_window_id); - } - let scale_factor = window.scale_factor(); log::info!("Window scale factor: {}", scale_factor); @@ -238,7 +234,9 @@ impl Window { #[inline] pub fn request_redraw(&mut self) { - if !self.requested_redraw { + // No need to request a frame when we don't have one. The next `Frame` event will check the + // `dirty` flag on the display and submit a redraw request. + if self.has_frame && !self.requested_redraw { self.requested_redraw = true; self.window.request_redraw(); } @@ -470,44 +468,6 @@ impl Window { } } -#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] -fn x_embed_window(window: &WinitWindow, parent_id: std::os::raw::c_ulong) { - let xlib_display = window.raw_display_handle(); - let xlib_window = window.raw_window_handle(); - let (xlib_display, xlib_window) = match (xlib_display, xlib_window) { - (RawDisplayHandle::Xlib(display), RawWindowHandle::Xlib(window)) => { - (display.display, window.window) - }, - _ => return, - }; - - let xlib = Xlib::open().expect("get xlib"); - - unsafe { - let atom = (xlib.XInternAtom)(xlib_display as *mut _, "_XEMBED".as_ptr() as *const _, 0); - (xlib.XChangeProperty)( - xlib_display as _, - xlib_window, - atom, - atom, - 32, - PropModeReplace, - [0, 1].as_ptr(), - 2, - ); - - // Register new error handler. - let old_handler = (xlib.XSetErrorHandler)(Some(xembed_error_handler)); - - // Check for the existence of the target before attempting reparenting. - (xlib.XReparentWindow)(xlib_display as _, xlib_window as _, parent_id, 0, 0); - - // Drain errors and restore original error handler. - (xlib.XSync)(xlib_display as _, 0); - (xlib.XSetErrorHandler)(old_handler); - } -} - #[cfg(target_os = "macos")] fn use_srgb_color_space(window: &WinitWindow) { let raw_window = match window.raw_window_handle() { @@ -519,9 +479,3 @@ fn use_srgb_color_space(window: &WinitWindow) { let _: () = msg_send![raw_window, setColorSpace: NSColorSpace::sRGBColorSpace(nil)]; } } - -#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] -unsafe extern "C" fn xembed_error_handler(_: *mut XDisplay, _: *mut XErrorEvent) -> i32 { - log::error!("Could not embed into specified window."); - std::process::exit(1); -} diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 7bb3a83e..b7a87855 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -15,7 +15,9 @@ use std::{env, f32, mem}; use ahash::RandomState; use crossfont::{self, Size}; +use glutin::display::{Display as GlutinDisplay, GetGlDisplay}; use log::{debug, error, info, warn}; +use raw_window_handle::HasRawDisplayHandle; use winit::event::{ ElementState, Event as WinitEvent, Ime, Modifiers, MouseButton, StartCause, Touch as TouchEvent, WindowEvent, @@ -23,7 +25,6 @@ use winit::event::{ use winit::event_loop::{ ControlFlow, DeviceEvents, EventLoop, EventLoopProxy, EventLoopWindowTarget, }; -use winit::window::raw_window_handle::HasRawDisplayHandle; use winit::window::WindowId; use alacritty_terminal::config::LOG_TARGET_CONFIG; @@ -1447,6 +1448,7 @@ impl input::Processor> { | WindowEvent::Destroyed | WindowEvent::ThemeChanged(_) | WindowEvent::HoveredFile(_) + | WindowEvent::RedrawRequested | WindowEvent::Moved(_) => (), } }, @@ -1455,8 +1457,8 @@ impl input::Processor> { | WinitEvent::DeviceEvent { .. } | WinitEvent::LoopExiting | WinitEvent::Resumed - | WinitEvent::AboutToWait - | WinitEvent::RedrawRequested(_) => (), + | WinitEvent::MemoryWarning + | WinitEvent::AboutToWait => (), } } } @@ -1467,6 +1469,7 @@ impl input::Processor> { /// triggered. pub struct Processor { windows: HashMap, + gl_display: Option, #[cfg(unix)] global_ipc_options: Vec, cli_options: CliOptions, @@ -1484,6 +1487,7 @@ impl Processor { ) -> Processor { Processor { cli_options, + gl_display: None, config: Rc::new(config), windows: Default::default(), #[cfg(unix)] @@ -1504,6 +1508,7 @@ impl Processor { let window_context = WindowContext::initial(event_loop, proxy, self.config.clone(), options)?; + self.gl_display = Some(window_context.display.gl_context().display()); self.windows.insert(window_context.id(), window_context); Ok(()) @@ -1552,7 +1557,8 @@ impl Processor { // Disable all device events, since we don't care about them. event_loop.listen_device_events(DeviceEvents::Never); - let result = event_loop.run(move |event, event_loop, control_flow| { + let mut initial_window_error = Ok(()); + let result = event_loop.run(|event, event_loop| { if self.config.debug.print_events { info!("winit event: {:?}", event); } @@ -1578,14 +1584,30 @@ impl Processor { proxy.clone(), initial_window_options, ) { - // Log the error right away since we can't return it. - eprintln!("Error: {}", err); - *control_flow = ControlFlow::ExitWithCode(1); + initial_window_error = Err(err); + event_loop.exit(); return; } info!("Initialisation complete"); }, + WinitEvent::LoopExiting => { + match self.gl_display.take() { + #[cfg(not(target_os = "macos"))] + Some(glutin::display::Display::Egl(display)) => { + // Ensure that all the windows are dropped, so the destructors for + // Renderer and contexts ran. + self.windows.clear(); + + // SAFETY: the display is being destroyed after destroying all the + // windows, thus no attempt to access the EGL state will be made. + unsafe { + display.terminate(); + } + }, + _ => (), + } + }, // NOTE: This event bypasses batching to minimize input latency. WinitEvent::UserEvent(Event { window_id: Some(window_id), @@ -1631,10 +1653,10 @@ impl Processor { window_context.write_ref_test_results(); } - *control_flow = ControlFlow::Exit; + event_loop.exit(); } }, - WinitEvent::RedrawRequested(window_id) => { + WinitEvent::WindowEvent { window_id, event: WindowEvent::RedrawRequested } => { let window_context = match self.windows.get_mut(&window_id) { Some(window_context) => window_context, None => return, @@ -1645,7 +1667,7 @@ impl Processor { &proxy, &mut clipboard, &mut scheduler, - WinitEvent::RedrawRequested(window_id), + event, ); window_context.draw(&mut scheduler); @@ -1665,10 +1687,11 @@ impl Processor { // Update the scheduler after event processing to ensure // the event loop deadline is as accurate as possible. - *control_flow = match scheduler.update() { + let control_flow = match scheduler.update() { Some(instant) => ControlFlow::WaitUntil(instant), None => ControlFlow::Wait, }; + event_loop.set_control_flow(control_flow); }, // Process config update. WinitEvent::UserEvent(Event { payload: EventType::ConfigReload(path), .. }) => { @@ -1757,7 +1780,11 @@ impl Processor { } }); - result.map_err(Into::into) + if initial_window_error.is_err() { + initial_window_error + } else { + result.map_err(Into::into) + } } /// Check if an event is irrelevant and can be skipped. @@ -1775,9 +1802,7 @@ impl Processor { | WindowEvent::HoveredFile(_) | WindowEvent::Moved(_) ), - WinitEvent::Suspended { .. } - | WinitEvent::NewEvents { .. } - | WinitEvent::LoopExiting => true, + WinitEvent::Suspended { .. } | WinitEvent::NewEvents { .. } => true, _ => false, } } diff --git a/alacritty/src/renderer/platform.rs b/alacritty/src/renderer/platform.rs index b31e6974..3568bd20 100644 --- a/alacritty/src/renderer/platform.rs +++ b/alacritty/src/renderer/platform.rs @@ -12,10 +12,10 @@ use glutin::prelude::*; use glutin::surface::{Surface, SurfaceAttributesBuilder, WindowSurface}; use log::{debug, LevelFilter}; +use raw_window_handle::{RawDisplayHandle, RawWindowHandle}; use winit::dpi::PhysicalSize; #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] use winit::platform::x11; -use winit::window::raw_window_handle::{RawDisplayHandle, RawWindowHandle}; /// Create the GL display. pub fn create_gl_display( diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs index 301d30ad..f76faf7a 100644 --- a/alacritty/src/window_context.rs +++ b/alacritty/src/window_context.rs @@ -16,10 +16,10 @@ use glutin::display::GetGlDisplay; #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] use glutin::platform::x11::X11GlConfigExt; use log::{error, info}; +use raw_window_handle::HasRawDisplayHandle; use serde_json as json; -use winit::event::{Event as WinitEvent, Modifiers}; +use winit::event::{Event as WinitEvent, Modifiers, WindowEvent}; use winit::event_loop::{EventLoopProxy, EventLoopWindowTarget}; -use winit::window::raw_window_handle::HasRawDisplayHandle; use winit::window::WindowId; use alacritty_config::SerdeReplace; @@ -419,7 +419,8 @@ impl WindowContext { event: WinitEvent, ) { match event { - WinitEvent::AboutToWait | WinitEvent::RedrawRequested(_) => { + WinitEvent::AboutToWait + | WinitEvent::WindowEvent { event: WindowEvent::RedrawRequested, .. } => { // Skip further event handling with no staged updates. if self.event_queue.is_empty() { return; @@ -492,11 +493,12 @@ impl WindowContext { self.mouse.hint_highlight_dirty = false; } - // Request a redraw. - // - // Even though redraw requests are squashed in winit, we try not to - // request more if we haven't received a new frame request yet. - if self.dirty && !self.occluded && !matches!(event, WinitEvent::RedrawRequested(_)) { + // Don't call `request_redraw` when event is `RedrawRequested` since the `dirty` flag + // represents the current frame, but redraw is for the next frame. + if self.dirty + && !self.occluded + && !matches!(event, WinitEvent::WindowEvent { event: WindowEvent::RedrawRequested, .. }) + { self.display.window.request_redraw(); } } diff --git a/extra/man/alacritty.5.scd b/extra/man/alacritty.5.scd index 685f5e97..f4c2537c 100644 --- a/extra/man/alacritty.5.scd +++ b/extra/man/alacritty.5.scd @@ -698,8 +698,10 @@ This section documents the *[keyboard]* table of the configuration file. The regular keys like _"A"_, _"0"_, and _"Я"_ can be mapped directly without any special syntax. Full list of named keys like _"F1"_ and the - syntax for dead keys can be found here:++ -https://docs.rs/winit/\*/winit/keyboard/enum.Key.html + syntax for dead keys can be found here: + + https://docs.rs/winit/latest/winit/keyboard/enum.NamedKey.html++ +https://docs.rs/winit/latest/winit/keyboard/enum.Key.html#variant.Dead Numpad keys are prefixed by _Numpad_: "NumpadEnter" | "NumpadAdd" | "NumpadComma" | "NumpadDivide" | "NumpadEquals" | "NumpadSubtract" |