rust-windowing/glutin

X11 Window is always transparent with 0.30

Nazariglez opened this issue · 4 comments

Using the window's example, removing or setting to false .with_transparency(true) it will create always a transparent windows.

Issue reported on notan: Nazariglez/notan#218

I was trying to look into this, but I have no idea how GLX works, I guess that one way to fix it is filtering the configurations and get one with supports_transparency() == Some(false), but I am not sure if this is the right approach.

Whatever you pass to winit is irrelevant. What matters whether the visual supports alpha or not. Filtering configs like that will work for sure.

Given that you must pass the visual from the glutin config directly to winit, so the alpha stuff will work correctly, you might not do that at all.

However what I could tell you for sure that right now glutin false for with_transparent in glutin is more like Don't care. Maybe it should be changed into Option or something like that.

Right now what filtering configs based on supports_transparency() will work.

Be aware that on some platforms, like Wayland, you can't even do something like that, at least I'm not sure how you'd request XRGB format, so you should likely don't event request alpha?

Hello @kchibisov, thanks for the reply.

Got it, I guess I can filter the configs looking for one that does not support the transparency when is set to false and fallback to transparency if there is none. Although this is kind of confusing, because the same example works just fine on MacOS (set transparency to false and you get a non-transparent window).

Do you think that this something that we can "add" to glutin-winit to try to emulate the behavior that glutin has < 0.30?

On macOS you have a single config, not multiple of them, because macOS is weird.

I think what we can do is to change to Option<None> and filter, so it'll more or less similar.

I managed to fix this by selecting the correct config, it makes sense now that I see how it works, it was confusing to understand that x11 has several configurations while other OS only one, but once you wrap your head that you need to ask for a config that does not support transparency if you don't want it, it just works, and all systems works the same.

I am closing this, thanks.