diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-02-02 11:30:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-02 11:30:23 +0300 |
commit | 1c878a0476257d328113efcd7088f1aa53f42e56 (patch) | |
tree | b4ba30e6b9549965387330f9eb7111c95795de69 | |
parent | 246ec8945d84f658fc88d02a33c3590ef4a92e0f (diff) | |
download | alacritty-1c878a0476257d328113efcd7088f1aa53f42e56.tar.gz alacritty-1c878a0476257d328113efcd7088f1aa53f42e56.zip |
Update winit to 0.28
Fixes #6644.
Fixes #6615.
Fixes #6558.
Fixes #6515.
Fixes #3187.
Fixes #62.
-rw-r--r-- | CHANGELOG.md | 11 | ||||
-rw-r--r-- | Cargo.lock | 308 | ||||
-rw-r--r-- | alacritty.yml | 18 | ||||
-rw-r--r-- | alacritty/Cargo.toml | 4 | ||||
-rw-r--r-- | alacritty/build.rs | 4 | ||||
-rw-r--r-- | alacritty/src/config/ui_config.rs | 6 | ||||
-rw-r--r-- | alacritty/src/config/window.rs | 29 | ||||
-rw-r--r-- | alacritty/src/display/window.rs | 73 | ||||
-rw-r--r-- | alacritty/src/event.rs | 5 | ||||
-rw-r--r-- | alacritty/src/input.rs | 6 | ||||
-rw-r--r-- | alacritty/src/main.rs | 2 | ||||
-rw-r--r-- | alacritty/src/renderer/platform.rs | 4 | ||||
-rw-r--r-- | alacritty/src/window_context.rs | 10 | ||||
-rw-r--r-- | alacritty_config/Cargo.toml | 3 | ||||
-rw-r--r-- | alacritty_config/src/lib.rs | 5 | ||||
-rw-r--r-- | alacritty_config_derive/src/config_deserialize/de_enum.rs | 2 | ||||
-rw-r--r-- | alacritty_terminal/src/ansi.rs | 2 | ||||
-rw-r--r-- | alacritty_terminal/src/config/scrolling.rs | 3 | ||||
-rw-r--r-- | alacritty_terminal/src/event.rs | 10 | ||||
-rw-r--r-- | alacritty_terminal/src/event_loop.rs | 2 | ||||
-rw-r--r-- | alacritty_terminal/src/term/color.rs | 5 | ||||
-rw-r--r-- | alacritty_terminal/src/term/mod.rs | 6 | ||||
-rw-r--r-- | alacritty_terminal/tests/ref.rs | 8 |
23 files changed, 313 insertions, 213 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9281f20c..df8c61d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Uppercase `-T` short form for `--title` - Support for horizontal scrolling in mouse mode and alternative scrolling modes +- Support for fractional scaling on Wayland with wp-fractional-scale protocol ### Changed @@ -18,6 +19,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Always use sRGB color space on macOS - Erase in line after the last column will no longer clear the last column - Open new windows by default with macOS `Cmd`+`N` binding +- The hint about window transparency is now properly issued on Wayland and macOS +- `window.decorations_theme_variant` could now control theme on macOS and Windows +- The IME purpose is now set to `Terminal` which could help with OSK +- `window.decorations_theme_variant` is now using `Dark`, `Light`, and `None` values ### Fixed @@ -37,6 +42,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Reduced GPU memory usage - Low frame rate when multiple windows render at the same time - Redraw hanging until a keypress on X11 in rare cases +- Window clipping when maximizing a window without decorations on Windows + +### Removed + +- `window.gtk_theme_variant` config field; use `window.decorations_theme_variant` instead +- `alt_send_esc` is now always set to `true` ## 0.11.0 @@ -33,13 +33,13 @@ dependencies = [ "once_cell", "parking_lot 0.12.1", "png", - "raw-window-handle 0.5.0", + "raw-window-handle", "serde", "serde_json", "serde_yaml", "unicode-width", "wayland-client", - "windows-sys", + "windows-sys 0.36.1", "winit", "x11-dl", "xdg", @@ -52,6 +52,7 @@ dependencies = [ "log", "serde", "serde_yaml", + "winit", ] [[package]] @@ -92,10 +93,34 @@ dependencies = [ "signal-hook-mio", "unicode-width", "vte", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] +name = "android-activity" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4165a1aef703232031b40a6e8908c2f9e314d495f11aa7f98db75d39a497cc6a" +dependencies = [ + "android-properties", + "bitflags", + "cc", + "jni-sys", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] name = "arrayref" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -143,6 +168,25 @@ 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", +] + +[[package]] +name = "block2" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" +dependencies = [ + "block-sys", + "objc2-encode", +] + +[[package]] name = "bumpalo" version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -172,6 +216,9 @@ name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +dependencies = [ + "jobserver", +] [[package]] name = "cfg-if" @@ -423,41 +470,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" [[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] name = "dirs" version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -543,8 +555,8 @@ checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall", - "windows-sys", + "redox_syscall 0.2.16", + "windows-sys 0.36.1", ] [[package]] @@ -691,9 +703,9 @@ dependencies = [ "libloading", "objc", "once_cell", - "raw-window-handle 0.5.0", + "raw-window-handle", "wayland-sys 0.30.0", - "windows-sys", + "windows-sys 0.36.1", "x11-dl", ] @@ -704,7 +716,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3adbb8fec0e18e340f990c78f79f5f0e142d0d83f46b10909aaa7d251c00afdf" dependencies = [ "gl_generator", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -748,12 +760,6 @@ dependencies = [ ] [[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] name = "indexmap" version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -817,6 +823,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] +name = "jobserver" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +dependencies = [ + "libc", +] + +[[package]] name = "js-sys" version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -997,7 +1012,7 @@ dependencies = [ "libc", "log", "wasi", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -1067,7 +1082,7 @@ dependencies = [ "jni-sys", "ndk-sys", "num_enum", - "raw-window-handle 0.5.0", + "raw-window-handle", "thiserror", ] @@ -1078,35 +1093,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] -name = "ndk-glue" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" -dependencies = [ - "libc", - "log", - "ndk", - "ndk-context", - "ndk-macro", - "ndk-sys", - "once_cell", - "parking_lot 0.12.1", -] - -[[package]] -name = "ndk-macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" -dependencies = [ - "darling", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] name = "ndk-sys" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1230,6 +1216,32 @@ dependencies = [ ] [[package]] +name = "objc-sys" +version = "0.2.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" + +[[package]] +name = "objc2" +version = "0.3.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe31e5425d3d0b89a15982c024392815da40689aceb34bad364d58732bcfd649" +dependencies = [ + "block2", + "objc-sys", + "objc2-encode", +] + +[[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", +] + +[[package]] name = "objc_id" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1245,6 +1257,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" [[package]] +name = "orbclient" +version = "0.3.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba683f1641c11041c59d5d93689187abcab3c1349dc6d9d70c550c9f9360802f" +dependencies = [ + "cfg-if 1.0.0", + "redox_syscall 0.2.16", + "wasm-bindgen", + "web-sys", +] + +[[package]] name = "os_str_bytes" version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1280,7 +1304,7 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "winapi 0.3.9", ] @@ -1293,9 +1317,9 @@ checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -1386,27 +1410,27 @@ 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", ] [[package]] -name = "raw-window-handle" -version = "0.5.0" +name = "redox_syscall" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "cty", + "bitflags", ] [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "fb02a9aee8e8c7ad8d86890f1e16b49e0bbbffc9961ff3788c31d57c98bcbf03" dependencies = [ "bitflags", ] @@ -1418,7 +1442,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom", - "redox_syscall", + "redox_syscall 0.2.16", "thiserror", ] @@ -1484,9 +1508,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "sctk-adwaita" -version = "0.4.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61270629cc6b4d77ec1907db1033d5c2e1a404c412743621981a871dc9c12339" +checksum = "6be6d8911b40c5f91332ce27d2458d57fffc0b061816bf847df23a16f9d3615f" dependencies = [ "crossfont", "log", @@ -2025,51 +2049,118 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", ] [[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] name = "windows_aarch64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] name = "windows_i686_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] name = "windows_i686_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] name = "windows_x86_64_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] name = "windows_x86_64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] name = "winit" -version = "0.27.5" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb796d6fbd86b2fd896c9471e6f04d39d750076ebe5680a3958f00f5ab97657c" +checksum = "089b2f049a47946f11ea91838a832b303f65d6875d491df2952859eb18287ce8" dependencies = [ + "android-activity", "bitflags", - "cocoa", + "cfg_aliases", "core-foundation", "core-graphics", "dispatch", @@ -2078,21 +2169,22 @@ dependencies = [ "log", "mio 0.8.4", "ndk", - "ndk-glue", - "objc", + "objc2", "once_cell", - "parking_lot 0.12.1", + "orbclient", "percent-encoding", - "raw-window-handle 0.4.3", - "raw-window-handle 0.5.0", + "raw-window-handle", + "redox_syscall 0.3.4", "sctk-adwaita", "serde", "smithay-client-toolkit", "wasm-bindgen", "wayland-client", + "wayland-commons", "wayland-protocols", + "wayland-scanner", "web-sys", - "windows-sys", + "windows-sys 0.45.0", "x11-dl", ] diff --git a/alacritty.yml b/alacritty.yml index 07f718b6..ba0e4ab5 100644 --- a/alacritty.yml +++ b/alacritty.yml @@ -94,13 +94,20 @@ # General application class #general: Alacritty - # Decorations theme variant (Linux/BSD only) + # Decorations theme variant # - # 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. + # Override the variant of the System theme/GTK theme/Wayland client side + # decorations. Commonly supported values are `Dark`, `Light`, and `None` for + # auto pick-up. Set this to `None` to use the default theme variant. #decorations_theme_variant: None + # Make `Option` key behave as `Alt` (macOS only): + # - OnlyLeft + # - OnlyRight + # - Both + # - None (default) + #option_as_alt: None + #scrolling: # Maximum number of lines in the scrollback buffer. # Specifying '0' will disable scrolling. @@ -449,9 +456,6 @@ # directory of the parent process will be used. #working_directory: None -# Send ESC (\x1b) before characters when alt is pressed. -#alt_send_esc: true - # Offer IPC using `alacritty msg` (unix only) #ipc_socket: true diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml index 28529bd1..63edd5c0 100644 --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -30,7 +30,7 @@ serde = { version = "1", features = ["derive"] } serde_yaml = "0.8" serde_json = "1" glutin = { version = "0.30.3", default-features = false, features = ["egl", "wgl"] } -winit = { version = "0.27.4", default-features = false, features = ["serde"] } +winit = { version = "0.28.0", default-features = false, features = ["serde"] } notify-debouncer-mini = { version = "0.2.1", default-features = false } parking_lot = "0.12.0" crossfont = { version = "0.5.0", features = ["force_system_fontconfig"] } @@ -88,6 +88,6 @@ wayland = [ "glutin/wayland", "winit/wayland", "winit/wayland-dlopen", - "winit/wayland-csd-adwaita", + "winit/wayland-csd-adwaita-crossfont", "wayland-client"] nightly = [] diff --git a/alacritty/build.rs b/alacritty/build.rs index b1f0537b..de2e6195 100644 --- a/alacritty/build.rs +++ b/alacritty/build.rs @@ -8,9 +8,9 @@ use gl_generator::{Api, Fallbacks, GlobalGenerator, Profile, Registry}; fn main() { let mut version = String::from(env!("CARGO_PKG_VERSION")); if let Some(commit_hash) = commit_hash() { - version = format!("{} ({})", version, commit_hash); + version = format!("{version} ({commit_hash})"); } - println!("cargo:rustc-env=VERSION={}", version); + println!("cargo:rustc-env=VERSION={version}"); let dest = env::var("OUT_DIR").unwrap(); let mut file = File::create(Path::new(&dest).join("gl_bindings.rs")).unwrap(); diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs index f58097cf..29ff2c4c 100644 --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -44,7 +44,9 @@ pub struct UiConfig { pub debug: Debug, /// Send escape sequences using the alt key. - pub alt_send_esc: bool, + #[config(removed = "It's now always set to 'true'. If you're on macOS use \ + 'window.option_as_alt' to alter behavior of Option")] + pub alt_send_esc: Option<bool>, /// Live config reload. pub live_config_reload: bool, @@ -88,7 +90,7 @@ impl Default for UiConfig { fn default() -> Self { Self { live_config_reload: true, - alt_send_esc: true, + alt_send_esc: Default::default(), #[cfg(unix)] ipc_socket: true, font: Default::default(), diff --git a/alacritty/src/config/window.rs b/alacritty/src/config/window.rs index f1a74232..476172d1 100644 --- a/alacritty/src/config/window.rs +++ b/alacritty/src/config/window.rs @@ -4,7 +4,10 @@ use std::os::raw::c_ulong; use log::{error, warn}; use serde::de::{self, MapAccess, Visitor}; use serde::{Deserialize, Deserializer, Serialize}; -use winit::window::Fullscreen; +use winit::window::{Fullscreen, Theme}; + +#[cfg(target_os = "macos")] +use winit::platform::macos::OptionAsAlt; use alacritty_config_derive::{ConfigDeserialize, SerdeReplace}; use alacritty_terminal::config::{Percentage, LOG_TARGET_CONFIG}; @@ -30,14 +33,8 @@ pub struct WindowConfig { #[config(skip)] pub embed: Option<c_ulong>, - /// GTK theme variant. - #[config(deprecated = "use window.decorations_theme_variant instead")] - gtk_theme_variant: Option<String>, - /// System decorations theme variant. - /// - /// Controls GTK theme variant on X11 and winit client side decorations on Wayland. - decorations_theme_variant: Option<String>, + pub decorations_theme_variant: Option<Theme>, /// Spread out additional padding evenly. pub dynamic_padding: bool, @@ -52,6 +49,10 @@ pub struct WindowConfig { /// Background opacity from 0.0 to 1.0. pub opacity: Percentage, + /// Controls which `Option` key should be treated as `Alt`. + #[cfg(target_os = "macos")] + pub option_as_alt: OptionAsAlt, + /// Pixel padding. padding: Delta<u8>, @@ -68,12 +69,13 @@ impl Default for WindowConfig { startup_mode: Default::default(), embed: Default::default(), decorations_theme_variant: Default::default(), - gtk_theme_variant: Default::default(), dynamic_padding: Default::default(), identity: Identity::default(), opacity: Default::default(), padding: Default::default(), dimensions: Default::default(), + #[cfg(target_os = "macos")] + option_as_alt: Default::default(), } } } @@ -111,15 +113,6 @@ 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(self.decorations_theme_variant.as_ref()) - .map(|theme| theme.as_str()) - } - #[inline] pub fn padding(&self, scale_factor: f32) -> (f32, f32) { let padding_x = (f32::from(self.padding.x) * scale_factor).floor(); diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs index 6f9e908a..1aee00e4 100644 --- a/alacritty/src/display/window.rs +++ b/alacritty/src/display/window.rs @@ -1,20 +1,20 @@ -#[cfg(not(any(target_os = "macos", windows)))] -use winit::platform::unix::{WindowBuilderExtUnix, WindowExtUnix}; - #[rustfmt::skip] #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] use { wayland_client::protocol::wl_surface::WlSurface, wayland_client::{Attached, EventQueue, Proxy}, - winit::platform::unix::EventLoopWindowTargetExtUnix, - winit::window::Theme, + winit::platform::wayland::{EventLoopWindowTargetExtWayland, WindowExtWayland}, }; +#[cfg(all(not(feature = "x11"), not(any(target_os = "macos", windows))))] +use winit::platform::wayland::WindowBuilderExtWayland; + #[rustfmt::skip] #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] use { std::io::Cursor, + winit::platform::x11::{WindowExtX11, WindowBuilderExtX11}, glutin::platform::x11::X11VisualInfo, x11_dl::xlib::{Display as XDisplay, PropModeReplace, XErrorEvent, Xlib}, winit::window::Icon, @@ -30,7 +30,7 @@ use { cocoa::appkit::NSColorSpace, cocoa::base::{id, nil, NO, YES}, objc::{msg_send, sel, sel_impl}, - winit::platform::macos::{WindowBuilderExtMacOS, WindowExtMacOS}, + winit::platform::macos::{OptionAsAlt, WindowBuilderExtMacOS, WindowExtMacOS}, }; use raw_window_handle::{HasRawWindowHandle, RawWindowHandle}; @@ -41,7 +41,8 @@ use winit::monitor::MonitorHandle; #[cfg(windows)] use winit::platform::windows::IconExtWindows; use winit::window::{ - CursorIcon, Fullscreen, UserAttentionType, Window as WinitWindow, WindowBuilder, WindowId, + CursorIcon, Fullscreen, ImePurpose, UserAttentionType, Window as WinitWindow, WindowBuilder, + WindowId, }; use alacritty_terminal::index::Point; @@ -151,7 +152,14 @@ impl Window { .with_position(PhysicalPosition::<i32>::from((position.x, position.y))); } - let window = window_builder.build(event_loop)?; + let window = window_builder + .with_title(&identity.title) + .with_theme(config.window.decorations_theme_variant) + .with_visible(false) + .with_transparent(true) + .with_maximized(config.window.maximized()) + .with_fullscreen(config.window.fullscreen()) + .build(event_loop)?; // Check if we're running Wayland to disable vsync. #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] @@ -165,6 +173,10 @@ impl Window { // Enable IME. window.set_ime_allowed(true); + window.set_ime_purpose(ImePurpose::Terminal); + + // Set initial transparency hint. + window.set_transparent(config.window_opacity() < 1.); #[cfg(target_os = "macos")] use_srgb_color_space(&window); @@ -276,61 +288,33 @@ impl Window { }; let builder = WindowBuilder::new() - .with_title(&identity.title) .with_name(&identity.class.general, &identity.class.instance) - .with_visible(false) - .with_transparent(true) - .with_decorations(window_config.decorations != Decorations::None) - .with_maximized(window_config.maximized()) - .with_fullscreen(window_config.fullscreen()); + .with_decorations(window_config.decorations != Decorations::None); #[cfg(feature = "x11")] let builder = builder.with_window_icon(Some(icon)); #[cfg(feature = "x11")] - let builder = match window_config.decorations_theme_variant() { - Some(val) => builder.with_gtk_theme_variant(val.to_string()), - None => builder, - }; - - #[cfg(feature = "x11")] let builder = match x11_visual { Some(visual) => builder.with_x11_visual(visual.into_raw()), 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 } #[cfg(windows)] - pub fn get_platform_window(identity: &Identity, window_config: &WindowConfig) -> WindowBuilder { + pub fn get_platform_window(_: &Identity, window_config: &WindowConfig) -> WindowBuilder { let icon = winit::window::Icon::from_resource(IDI_ICON, None); WindowBuilder::new() - .with_title(&identity.title) - .with_visible(false) .with_decorations(window_config.decorations != Decorations::None) - .with_transparent(true) - .with_maximized(window_config.maximized()) - .with_fullscreen(window_config.fullscreen()) .with_window_icon(icon.ok()) } #[cfg(target_os = "macos")] - pub fn get_platform_window(identity: &Identity, window_config: &WindowConfig) -> WindowBuilder { - let window = WindowBuilder::new() - .with_title(&identity.title) - .with_visible(false) - .with_transparent(true) - .with_maximized(window_config.maximized()) - .with_fullscreen(window_config.fullscreen()); + pub fn get_platform_window(_: &Identity, window_config: &WindowConfig) -> WindowBuilder { + let window = WindowBuilder::new().with_option_as_alt(window_config.option_as_alt); match window_config.decorations { Decorations::Full => window, @@ -357,6 +341,10 @@ impl Window { self.window.id() } + pub fn set_transparent(&self, transparent: bool) { + self.window.set_transparent(transparent); + } + pub fn set_maximized(&self, maximized: bool) { self.window.set_maximized(maximized); } @@ -380,6 +368,11 @@ impl Window { self.set_simple_fullscreen(!self.window.simple_fullscreen()); } + #[cfg(target_os = "macos")] + pub fn set_option_as_alt(&self, option_as_alt: OptionAsAlt) { + self.window.set_option_as_alt(option_as_alt); + } + pub fn set_fullscreen(&self, fullscreen: bool) { if fullscreen { self.window.set_fullscreen(Some(Fullscreen::Borderless(None))); diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 9388b8a9..768b7a47 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -26,7 +26,7 @@ use winit::event_loop::{ }; use winit::platform::run_return::EventLoopExtRunReturn; #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] -use winit::platform::unix::EventLoopWindowTargetExtUnix; +use winit::platform::wayland::EventLoopWindowTargetExtWayland; use winit::window::WindowId; use crossfont::{self, Size}; @@ -1280,6 +1280,9 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> { }, WindowEvent::KeyboardInput { is_synthetic: true, .. } | WindowEvent::TouchpadPressure { .. } + | WindowEvent::TouchpadMagnify { .. } + | WindowEvent::TouchpadRotate { .. } + | WindowEvent::SmartMagnify { .. } | WindowEvent::ScaleFactorChanged { .. } | WindowEvent::CursorEntered { .. } | WindowEvent::AxisMotion { .. } diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index 33be1bf3..d27a8ca7 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -868,11 +868,7 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> { let mut bytes = vec![0; utf8_len]; c.encode_utf8(&mut bytes[..]); - if self.ctx.config().alt_send_esc - && *self.ctx.received_count() == 0 - && self.ctx.modifiers().alt() - && utf8_len == 1 - { + if *self.ctx.received_count() == 0 && self.ctx.modifiers().alt() && utf8_len == 1 { bytes.insert(0, b'\x1b'); } diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs index 3514b84e..d9d26022 100644 --- a/alacritty/src/main.rs +++ b/alacritty/src/main.rs @@ -25,7 +25,7 @@ use log::info; use windows_sys::Win32::System::Console::{AttachConsole, FreeConsole, ATTACH_PARENT_PROCESS}; use winit::event_loop::EventLoopBuilder as WinitEventLoopBuilder; #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] -use winit::platform::unix::EventLoopWindowTargetExtUnix; +use winit::platform::x11::EventLoopWindowTargetExtX11; use alacritty_terminal::tty; diff --git a/alacritty/src/renderer/platform.rs b/alacritty/src/renderer/platform.rs index 0a8263c1..77826100 100644 --- a/alacritty/src/renderer/platform.rs +++ b/alacritty/src/renderer/platform.rs @@ -14,7 +14,7 @@ use glutin::surface::{Surface, SurfaceAttributesBuilder, WindowSurface}; use raw_window_handle::{RawDisplayHandle, RawWindowHandle}; use winit::dpi::PhysicalSize; #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] -use winit::platform::unix; +use winit::platform::x11; /// Create the GL display. pub fn create_gl_display( @@ -28,7 +28,7 @@ pub fn create_gl_display( let preference = DisplayApiPreference::Wgl(Some(_raw_window_handle.unwrap())); #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] - let preference = DisplayApiPreference::GlxThenEgl(Box::new(unix::register_xlib_error_hook)); + let preference = DisplayApiPreference::GlxThenEgl(Box::new(x11::register_xlib_error_hook)); #[cfg(all(not(feature = "x11"), not(any(target_os = "macos", windows))))] let preference = DisplayApiPreference::Egl; diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs index 79bc918b..6680f583 100644 --- a/alacritty/src/window_context.rs +++ b/alacritty/src/window_context.rs @@ -332,9 +332,17 @@ impl WindowContext { self.display.window.set_title(self.config.window.identity.title.clone()); } + let opaque = self.config.window_opacity() >= 1.; + // Disable shadows for transparent windows on macOS. #[cfg(target_os = "macos")] - self.display.window.set_has_shadow(self.config.window_opacity() >= 1.0); + self.display.window.set_has_shadow(opaque); + + #[cfg(target_os = "macos")] + self.display.window.set_option_as_alt(self.config.window.option_as_alt); + + // Change opacity state. + self.display.window.set_transparent(!opaque); // Update hint keys. self.display.hint_state.update_alphabet(self.config.hints.alphabet()); diff --git a/alacritty_config/Cargo.toml b/alacritty_config/Cargo.toml index c2e25f4f..ce057869 100644 --- a/alacritty_config/Cargo.toml +++ b/alacritty_config/Cargo.toml @@ -12,3 +12,6 @@ rust-version = "1.60.0" log = { version = "0.4.17", features = ["serde"] } serde_yaml = "0.8.24" serde = "1.0.137" + +[target.'cfg(target_os = "macos")'.dependencies] +winit = { version = "0.28.0", default-features = false, features = ["serde"] } diff --git a/alacritty_config/src/lib.rs b/alacritty_config/src/lib.rs index 7a467650..5ed9e1a5 100644 --- a/alacritty_config/src/lib.rs +++ b/alacritty_config/src/lib.rs @@ -32,12 +32,15 @@ impl_replace!( LevelFilter, ); +#[cfg(target_os = "macos")] +impl_replace!(winit::platform::macos::OptionAsAlt,); + fn replace_simple<'de, D>(data: &mut D, key: &str, value: Value) -> Result<(), Box<dyn Error>> where D: Deserialize<'de>, { if !key.is_empty() { - let error = format!("Fields \"{}\" do not exist", key); + let error = format!("Fields \"{key}\" do not exist"); return Err(error.into()); } *data = D::deserialize(value)?; diff --git a/alacritty_config_derive/src/config_deserialize/de_enum.rs b/alacritty_config_derive/src/config_deserialize/de_enum.rs index 73634e73..56a2f7ba 100644 --- a/alacritty_config_derive/src/config_deserialize/de_enum.rs +++ b/alacritty_config_derive/src/config_deserialize/de_enum.rs @@ -19,7 +19,7 @@ pub fn derive_deserialize(ident: Ident, generics: Generics, data_enum: DataEnum) }) { let variant_ident = &variant.ident; let variant_str = variant_ident.to_string(); - available_values = format!("{}`{}`, ", available_values, variant_str); + available_values = format!("{available_values}`{variant_str}`, "); let literal = variant_str.to_lowercase(); diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs index ff468ffc..53495995 100644 --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1003,7 +1003,7 @@ where if let Some(c) = xparse_color(chunk[1]) { self.handler.set_color(index as usize, c); } else if chunk[1] == b"?" { - let prefix = format!("4;{}", index); + let prefix = format!("4;{index}"); self.handler.dynamic_color_sequence(prefix, index as usize, terminator); } else { unhandled(params); diff --git a/alacritty_terminal/src/config/scrolling.rs b/alacritty_terminal/src/config/scrolling.rs index f4e55787..7ff306a9 100644 --- a/alacritty_terminal/src/config/scrolling.rs +++ b/alacritty_terminal/src/config/scrolling.rs @@ -49,8 +49,7 @@ impl<'de> Deserialize<'de> for ScrollingHistory { if lines > MAX_SCROLLBACK_LINES { Err(SerdeError::custom(format!( - "exceeded maximum scrolling history ({}/{})", - lines, MAX_SCROLLBACK_LINES + "exceeded maximum scrolling history ({lines}/{MAX_SCROLLBACK_LINES})" ))) } else { Ok(Self(lines)) diff --git a/alacritty_terminal/src/event.rs b/alacritty_terminal/src/event.rs index b592ce1b..4e1d9ec4 100644 --- a/alacritty_terminal/src/event.rs +++ b/alacritty_terminal/src/event.rs @@ -57,12 +57,12 @@ pub enum Event { impl Debug for Event { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { - Event::ClipboardStore(ty, text) => write!(f, "ClipboardStore({:?}, {})", ty, text), - Event::ClipboardLoad(ty, _) => write!(f, "ClipboardLoad({:?})", ty), + Event::ClipboardStore(ty, text) => write!(f, "ClipboardStore({ty:?}, {text})"), + Event::ClipboardLoad(ty, _) => write!(f, "ClipboardLoad({ty:?})"), Event::TextAreaSizeRequest(_) => write!(f, "TextAreaSizeRequest"), - Event::ColorRequest(index, _) => write!(f, "ColorRequest({})", index), - Event::PtyWrite(text) => write!(f, "PtyWrite({})", text), - Event::Title(title) => write!(f, "Title({})", title), + Event::ColorRequest(index, _) => write!(f, "ColorRequest({index})"), + Event::PtyWrite(text) => write!(f, "PtyWrite({text})"), + Event::Title(title) => write!(f, "Title({title})"), Event::CursorBlinkingChange => write!(f, "CursorBlinkingChange"), Event::MouseCursorDirty => write!(f, "MouseCursorDirty"), Event::ResetTitle => write!(f, "ResetTitle"), diff --git a/alacritty_terminal/src/event_loop.rs b/alacritty_terminal/src/event_loop.rs index b0877224..34169801 100644 --- a/alacritty_terminal/src/event_loop.rs +++ b/alacritty_terminal/src/event_loop.rs @@ -339,7 +339,7 @@ where if let Err(err) = self.poll.poll(&mut events, timeout) { match err.kind() { ErrorKind::Interrupted => continue, - _ => panic!("EventLoop polling error: {:?}", err), + _ => panic!("EventLoop polling error: {err:?}"), } } diff --git a/alacritty_terminal/src/term/color.rs b/alacritty_terminal/src/term/color.rs index 22b30828..8f193b39 100644 --- a/alacritty_terminal/src/term/color.rs +++ b/alacritty_terminal/src/term/color.rs @@ -119,8 +119,7 @@ impl<'de> Deserialize<'de> for Rgb { { Rgb::from_str(value).map_err(|_| { E::custom(format!( - "failed to parse rgb color {}; expected hex color like #ff00ff", - value + "failed to parse rgb color {value}; expected hex color like #ff00ff" )) }) } @@ -222,7 +221,7 @@ impl<'de> Deserialize<'de> for CellRgb { } Rgb::from_str(value).map(CellRgb::Rgb).map_err(|_| { - E::custom(format!("failed to parse color {}; expected {}", value, EXPECTING)) + E::custom(format!("failed to parse color {value}; expected {EXPECTING}")) }) } } diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index e41120da..fe9c7794 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -1169,7 +1169,7 @@ impl<T: EventListener> Handler for Term<T> { Some('>') => { trace!("Reporting secondary device attributes"); let version = version_number(env!("CARGO_PKG_VERSION")); - let text = format!("\x1b[>0;{};1c", version); + let text = format!("\x1b[>0;{version};1c"); self.event_proxy.send_event(Event::PtyWrite(text)); }, _ => debug!("Unsupported device attributes intermediate"), @@ -1944,7 +1944,7 @@ impl<T: EventListener> Handler for Term<T> { self.event_proxy.send_event(Event::TextAreaSizeRequest(Arc::new(move |window_size| { let height = window_size.num_lines * window_size.cell_height; let width = window_size.num_cols * window_size.cell_width; - format!("\x1b[4;{};{}t", height, width) + format!("\x1b[4;{height};{width}t") }))); } @@ -2721,7 +2721,7 @@ mod tests { term.reset_damage(); let vi_cursor_point = term.vi_mode_cursor.point; let line = vi_cursor_point.line.0 as usize; - let left = vi_cursor_point.column.0 as usize; + let left = vi_cursor_point.column.0; let right = left; let mut damaged_lines = match term.damage(None) { diff --git a/alacritty_terminal/tests/ref.rs b/alacritty_terminal/tests/ref.rs index a9f64f55..848a0ad1 100644 --- a/alacritty_terminal/tests/ref.rs +++ b/alacritty_terminal/tests/ref.rs @@ -126,13 +126,7 @@ fn ref_test(dir: &Path) { let cell = &term_grid[Line(i as i32)][Column(j)]; let original_cell = &grid[Line(i as i32)][Column(j)]; if original_cell != cell { - println!( - "[{i}][{j}] {original:?} => {now:?}", - i = i, - j = j, - original = original_cell, - now = cell, - ); + println!("[{i}][{j}] {original_cell:?} => {cell:?}",); } } } |