rust-windowing / winit

Window handling library in pure Rust

Home Page:https://docs.rs/winit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add option to toggle window shadows

alice-i-cecile opened this issue · comments

Users are experimenting with using Bevy to make desk toys (think Bonsai Buddy). To facilitate this, they would like to be able to disable drop shadows for their application. I would like to be able to expose an option to disable these in a cross-platform way, but cannot currently determine if / how to do this using winit. Searching "shadow" in winit's documentation returns no results.

See bevyengine/bevy#12410 for more details.

I'm unfamiliar with MacOS in general (from the original issue I assume this is a MacOS related question), but I believe you are looking for WindowBuilderExtMacOS::with_has_shadow() or WindowExtMacOS::set_has_shadow().

There is no cross-platform API for this because Winit only supports removing shadows on MacOS and Windows, AFAICS.

In the next release it will be easier to search for stuff like this because the documentation includes all platforms, you can already see this in the "master docs".

How do you tend to handle APIs for things that only work on some platforms? Do you cfg flag the options? Have a sometimes no-op operation that always exists? Something else?

cfg for really special. no-op if it's common, but not possible on like 1 platform.

It may change a bit in the future when extension traits will exist.

I believe this was resolved.