zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.54k stars 3.13k forks source link

[Linux]: Window is transparent when viewing image with transparent background #18800

Open yuqiang-yuan opened 1 month ago

yuqiang-yuan commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

When open a image with transparent background, e.g. ico or png, the editor window is transparent. Screenshot from 2024-10-07 16-47-15

Environment

Zed: v0.155.2 (Zed) OS: Linux X11 ubuntu 24.04 Memory: 31.2 GiB Architecture: x86_64 GPU: NVIDIA GeForce RTX 4060 Ti || NVIDIA || 535.183.01

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log


notpeter commented 1 month ago

This appears to be Linux specific. Transparent images display as expected for me on MacOS.

turtle

jansol commented 1 month ago

Can confirm on Wayland as well, the checkerboard background of the image viewer is semi-transparent regardless of whether or not the theme has a transparent background.

bbb651 commented 1 month ago

The checkerboard drawing is also affecting alpha, I don't see a good reason why it should do that on any platform, so I think changing opacity to 1. should fix it?

jansol commented 1 month ago

The bigger question here IMHO is why it overrides/skips the alpha of the window background, which should be 1.0 in non-transparent themes. Blending a semi-transparent checkerboard on top of the window background does still make some sense (it tints the checkerboard), although I'd probably want the checkerboard to be configurable in terms of opacity and brightness/contrast either way.

bbb651 commented 1 month ago

I don't think it overrides the alpha of the window? I cannot reproduce it when setting background to #xxxxxxff. Unlike other platforms, on wayland background.appearance is only used as an hint for the compositor if the background is transparent and doesn't disable transparency, which is probably the real bug (it can also cause broken visuals when it's set to opaque and transparency is less than 1.0 because the compositor is allowed to assume that's impossible). Also, it's a little odd that background blends there's, but not on e.g. the status bar.. image

jansol commented 1 month ago

Hm, that's weird. That would imply that the builtin Ayu Dark theme I checked with does not specify an opaque background color - but it does.