egui/crates/egui-winit
Gaelan McMillan 3a02963c33
Add macOS-specific `has_shadow` and `with_has_shadow` to ViewportBuilder (#6850)
* [X] I have followed the instructions in the PR template

This PR fixes a ghosting issue I encountered while making a native macOS
transparent overlay app using egui and eframe by exposing the [existing
macOS window attribute
`has_shadow`](https://docs.rs/winit/latest/winit/platform/macos/trait.WindowExtMacOS.html#tymethod.has_shadow)
to the `ViewportBuilder` via a new `with_has_shadow` option.

## Example of Ghosting Issue

### Before `ViewportBuilder::with_has_shadow`
By default, the underlying `winit` window's `.has_shadow()` defaults to
`true`.


https://github.com/user-attachments/assets/c3dcc2bd-535a-4960-918e-3ae5df503b12

### After `ViewportBuilder::with_has_shadow`


https://github.com/user-attachments/assets/484462a1-ea88-43e6-85b4-0bb9724e5f14

Source code for the above example can be found here:

https://github.com/gaelanmcmillan/egui-overlay-app-with-shadow-artifacts-example/blob/main/src/main.rs


### Further background
By default on macOS, `winit` windows have a drop-shadow effect. When
creating a fully transparent overlay GUI, this drop-shadow can create a
ghosting effect, as the window content has a drop shadow which is not
cleared by the app itself. This issue has been experienced by users of
`bevy`, another Rust project that has an upstream dependency on `winit`:
https://github.com/bevyengine/bevy/issues/18673
2025-04-29 12:02:42 +02:00
..
src Add macOS-specific `has_shadow` and `with_has_shadow` to ViewportBuilder (#6850) 2025-04-29 12:02:42 +02:00
CHANGELOG.md Release 0.31.1 - text_edit and kittest fixes 2025-03-05 08:37:34 +01:00
Cargo.toml Bump accesskit to 0.18 and make it a workspace dependency (#5783) 2025-03-20 11:00:12 +01:00
README.md Remove misleading safety-badges 2023-02-28 22:35:08 +01:00

README.md

egui-winit

Latest version Documentation MIT Apache

This crates provides bindings between egui and winit.

The library translates winit events to egui, handled copy/paste, updates the cursor, open links clicked in egui, etc.