diff --git a/Cargo.lock b/Cargo.lock index da881a72..68d0782b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,12 +35,12 @@ dependencies = [ "fnv", "gl_generator", "glutin", - "image", "libc", "log", "notify", "objc", "parking_lot", + "png", "serde", "serde_json", "serde_yaml", @@ -196,12 +196,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" -[[package]] -name = "bytemuck" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac" - [[package]] name = "byteorder" version = "1.3.4" @@ -564,16 +558,6 @@ dependencies = [ "syn", ] -[[package]] -name = "deflate" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" -dependencies = [ - "adler32", - "byteorder", -] - [[package]] name = "derivative" version = "2.1.1" @@ -952,20 +936,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "image" -version = "0.23.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985fc06b1304d19c28d5c562ed78ef5316183f2b0053b46763a0b94862373c34" -dependencies = [ - "bytemuck", - "byteorder", - "num-iter", - "num-rational", - "num-traits", - "png", -] - [[package]] name = "inotify" version = "0.7.1" @@ -1340,38 +1310,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "num-integer" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b4d7360f362cfb50dde8143501e6940b22f644be75a4cc90b2d81968908138" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.12" @@ -1573,13 +1511,12 @@ checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "png" -version = "0.16.7" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfe7f9f1c730833200b134370e1d5098964231af8450bce9b78ee3ab5278b970" +checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" dependencies = [ "bitflags", "crc32fast", - "deflate", "miniz_oxide", ] diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml index a4f774b1..b5ebefe2 100644 --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -39,7 +39,7 @@ gl_generator = "0.14.0" xdg = "2" [target.'cfg(not(target_os = "macos"))'.dependencies] -image = { version = "0.23.3", default-features = false, features = ["ico"], optional = true } +png = { version = "0.16.8", default-features = false, optional = true } [target.'cfg(target_os = "macos")'.dependencies] objc = "0.2.2" @@ -56,7 +56,7 @@ embed-resource = "1.3" [features] default = ["wayland", "x11"] -x11 = ["copypasta/x11", "glutin/x11", "x11-dl", "image"] +x11 = ["copypasta/x11", "glutin/x11", "x11-dl", "png"] wayland = ["copypasta/wayland", "glutin/wayland", "wayland-client"] winpty = ["alacritty_terminal/winpty"] nightly = [] diff --git a/alacritty/alacritty.ico b/alacritty/alacritty.ico deleted file mode 120000 index 55cd1859..00000000 --- a/alacritty/alacritty.ico +++ /dev/null @@ -1 +0,0 @@ -../extra/windows/alacritty.ico \ No newline at end of file diff --git a/alacritty/alacritty.png b/alacritty/alacritty.png new file mode 120000 index 00000000..3865403a --- /dev/null +++ b/alacritty/alacritty.png @@ -0,0 +1 @@ +../extra/logo/compat/alacritty-term.png \ No newline at end of file diff --git a/alacritty/src/window.rs b/alacritty/src/window.rs index e43e5c95..1b9e7731 100644 --- a/alacritty/src/window.rs +++ b/alacritty/src/window.rs @@ -19,8 +19,15 @@ use { crate::wayland_theme::AlacrittyWaylandTheme, }; +#[rustfmt::skip] #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] -use x11_dl::xlib::{Display as XDisplay, PropModeReplace, XErrorEvent, Xlib}; +use { + std::io::Cursor, + + x11_dl::xlib::{Display as XDisplay, PropModeReplace, XErrorEvent, Xlib}, + glutin::window::Icon, + png::Decoder, +}; use std::fmt::{self, Display, Formatter}; @@ -44,11 +51,11 @@ use crate::config::window::{Decorations, WindowConfig}; use crate::config::Config; use crate::gl; -// It's required to be in this directory due to the `windows.rc` file. +/// Window icon for `_NET_WM_ICON` property. #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] -static WINDOW_ICON: &[u8] = include_bytes!("../alacritty.ico"); +static WINDOW_ICON: &[u8] = include_bytes!("../alacritty.png"); -// This should match the definition of IDI_ICON from `windows.rc`. +/// This should match the definition of IDI_ICON from `windows.rc`. #[cfg(windows)] const IDI_ICON: WORD = 0x101; @@ -257,11 +264,11 @@ impl Window { pub fn get_platform_window(title: &str, window_config: &WindowConfig) -> WindowBuilder { #[cfg(feature = "x11")] let icon = { - let image = image::load_from_memory_with_format(WINDOW_ICON, image::ImageFormat::Ico) - .expect("loading icon") - .to_rgba(); - let (width, height) = image.dimensions(); - glutin::window::Icon::from_rgba(image.into_raw(), width, height) + let decoder = Decoder::new(Cursor::new(WINDOW_ICON)); + let (info, mut reader) = decoder.read_info().expect("invalid embedded icon"); + let mut buf = vec![0; info.buffer_size()]; + let _ = reader.next_frame(&mut buf); + Icon::from_rgba(buf, info.width, info.height) }; let class = &window_config.class; diff --git a/extra/logo/compat/alacritty-term.png b/extra/logo/compat/alacritty-term.png new file mode 100644 index 00000000..b8117882 Binary files /dev/null and b/extra/logo/compat/alacritty-term.png differ