diff options
author | Hugal31 <hugo.laloge@gmail.com> | 2022-10-05 15:14:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-05 13:14:23 +0000 |
commit | 2aedee1c2956099c1ab0574d6c2bfb89186a7bf6 (patch) | |
tree | e1771095ab3675ad33f0a1dfc6b0d5f4f27720d5 | |
parent | e9ee8dcd9f53096a0096c01b5027d7584376cbd2 (diff) | |
download | alacritty-2aedee1c2956099c1ab0574d6c2bfb89186a7bf6.tar.gz alacritty-2aedee1c2956099c1ab0574d6c2bfb89186a7bf6.zip |
Fix icon decoding on X11
Glutin is waiting for an RGBA buffer with 8-bit depth, but our icon is
16-bit depth. So we need to normalize the color data when decoding the
icon.
-rw-r--r-- | alacritty/src/display/window.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs index 6c88f56f..f558a654 100644 --- a/alacritty/src/display/window.rs +++ b/alacritty/src/display/window.rs @@ -324,11 +324,13 @@ impl Window { pub fn get_platform_window(identity: &Identity, window_config: &WindowConfig) -> WindowBuilder { #[cfg(feature = "x11")] let icon = { - let decoder = Decoder::new(Cursor::new(WINDOW_ICON)); + let mut decoder = Decoder::new(Cursor::new(WINDOW_ICON)); + decoder.set_transformations(png::Transformations::normalize_to_color8()); let mut reader = decoder.read_info().expect("invalid embedded icon"); let mut buf = vec![0; reader.output_buffer_size()]; let _ = reader.next_frame(&mut buf); Icon::from_rgba(buf, reader.info().width, reader.info().height) + .expect("invalid embedded icon format") }; let builder = WindowBuilder::new() @@ -341,7 +343,7 @@ impl Window { .with_fullscreen(window_config.fullscreen()); #[cfg(feature = "x11")] - let builder = builder.with_window_icon(icon.ok()); + let builder = builder.with_window_icon(Some(icon)); #[cfg(feature = "x11")] let builder = match window_config.decorations_theme_variant() { |