Add basic ico support (#40822)

Closes https://github.com/zed-industries/zed/discussions/40763

<img width="867" height="1088" alt="Screenshot 2025-10-21 at 23 14 47"
src="https://github.com/user-attachments/assets/d691fb2a-afc6-4445-a335-054ef164e0d3"
/>

Also improves error handling on image open failure:

<img width="864" height="1083" alt="Screenshot 2025-10-21 at 23 14 30"
src="https://github.com/user-attachments/assets/d5388b61-995f-441b-b375-ad5136d1533b"
/>


Release Notes:

- Added basic ico support, improved unsupported image handling
This commit is contained in:
Kirill Bulatov
2025-10-22 12:07:32 +03:00
committed by GitHub
parent 8ceb2f2c61
commit bc0bace81f
13 changed files with 166 additions and 17 deletions
@@ -86,6 +86,7 @@ x11rb::atom_manager! {
SVG__MIME: ImageFormat::mime_type(ImageFormat::Svg ).as_bytes(),
BMP__MIME: ImageFormat::mime_type(ImageFormat::Bmp ).as_bytes(),
TIFF_MIME: ImageFormat::mime_type(ImageFormat::Tiff).as_bytes(),
ICO__MIME: ImageFormat::mime_type(ImageFormat::Ico ).as_bytes(),
// This is just some random name for the property on our window, into which
// the clipboard owner writes the data we requested.
@@ -1003,6 +1004,7 @@ impl Clipboard {
ImageFormat::Svg => self.inner.atoms.SVG__MIME,
ImageFormat::Bmp => self.inner.atoms.BMP__MIME,
ImageFormat::Tiff => self.inner.atoms.TIFF_MIME,
ImageFormat::Ico => self.inner.atoms.ICO__MIME,
};
let data = vec![ClipboardData {
bytes: image.bytes,