diff options
-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_decora |