diff --git a/CHANGELOG.md b/CHANGELOG.md index 402278b..1dcb9b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Block cursor is no longer inverted at the start/end of a selection - Preserve selection on non-LMB or mouse mode clicks - Wayland client side decorations are now based on config colorscheme +- Low resolution window decoration icon on Windows ### Fixed - Tabstops not being reset with `reset` diff --git a/alacritty/src/window.rs b/alacritty/src/window.rs index 4169814..042ec87 100644 --- a/alacritty/src/window.rs +++ b/alacritty/src/window.rs @@ -24,13 +24,18 @@ use glutin::event_loop::EventLoop; use glutin::platform::macos::{RequestUserAttentionType, WindowBuilderExtMacOS, WindowExtMacOS}; #[cfg(not(any(target_os = "macos", windows)))] use glutin::platform::unix::{EventLoopWindowTargetExtUnix, WindowBuilderExtUnix, WindowExtUnix}; +#[cfg(windows)] +use glutin::platform::windows::IconExtWindows; #[cfg(not(target_os = "macos"))] use glutin::window::Icon; use glutin::window::{CursorIcon, Fullscreen, Window as GlutinWindow, WindowBuilder, WindowId}; use glutin::{self, ContextBuilder, PossiblyCurrent, WindowedContext}; -#[cfg(not(target_os = "macos"))] +#[cfg(not(any(target_os = "macos", windows)))] use image::ImageFormat; +#[cfg(not(any(target_os = "macos", windows)))] use log::error; +#[cfg(windows)] +use winapi::shared::minwindef::WORD; #[cfg(not(any(target_os = "macos", windows)))] use x11_dl::xlib::{Display as XDisplay, PropModeReplace, XErrorEvent, Xlib}; @@ -47,9 +52,13 @@ use crate::gl; use crate::wayland_theme::AlacrittyWaylandTheme; // It's required to be in this directory due to the `windows.rc` file -#[cfg(not(target_os = "macos"))] +#[cfg(not(any(target_os = "macos", windows)))] static WINDOW_ICON: &[u8] = include_bytes!("../../extra/windows/alacritty.ico"); +// This should match the definition of IDI_ICON from `windows.rc` +#[cfg(windows)] +const IDI_ICON: WORD = 0x101; + /// Window errors #[derive(Debug)] pub enum Error { @@ -252,11 +261,7 @@ impl Window { _ => true, }; - let image = image::load_from_memory_with_format(WINDOW_ICON, ImageFormat::Ico) - .expect("loading icon") - .to_rgba(); - let (width, height) = image.dimensions(); - let icon = Icon::from_rgba(image.into_raw(), width, height); + let icon = Icon::from_resource(IDI_ICON, None); WindowBuilder::new() .with_title(title)