mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
* Closes https://github.com/emilk/egui/issues/1918 * Closes https://github.com/emilk/egui/issues/4437 * Closes https://github.com/emilk/egui/issues/4709 * [x] I have followed the instructions in the PR template Hiya, I need new winit for a specific fix for a android_native_actvity. There are already two PRs, but both don't seem to have a lot of movement, or are entirely complete: https://github.com/emilk/egui/pull/4466 Seems to have gone stale & is missing some bits. https://github.com/emilk/egui/pull/4702 Also seems stale (if less so), and is missing a refactor to run_on_demand. I also *think* the accesskit integration has a mistake and can't be enabled. I've marked them as a co-author on this as I started from this branch. (I think! Haven't done that on git before...). Sorry for the wall of text but just dumping some details / thoughts here: - There's an issue with creating child windows in winit 0.30.1 and up on macOS. The multiple_viewports, "create immediate viewport" example crashes on anything later 0.30.1, with a stack overflow in unsafe code. I've create [a winit issue](https://github.com/rust-windowing/winit/issues/3800), it *might* already be fixed in 0.31.0 but I can't test as 0.31 will likely require another refactoring. For now I have just pinned things to 0.30.0 exatly. - Winit has deprecated run_on_demand, instead requiring the ApplicationHandler interface. In 0.31.0 run_on_demand is removed. I've refactored both the integration and the WinitApp trait to follow this pattern. I've left user_events a bit more opaque, as it seems 0.31.0 is doing a rework of UserEvents too. - I've used the new lazy init approach for access kit from this branch https://github.com/mwcampbell/egui/tree/accesskit-new-lazy-init and marked Matt as co-author, thanks Matt! - There was very similair but not quite the same code for run_and_return and run_and_exit. I've merged them, but looking at the github issues graveyard it seems vey finnicky. I *hope* this is more robust than before but it's a bit scary. - when receiving new_events this also used to check the redraw timing dictionary. That doesn't seem necesarry so left this out, but that is a slight behaviour change? - I have reeneabled serial_windows on macOS. I wondered whether it was fixed after this PR and does seem to be! However, even before this PR it seems to work, so maybe winit has sorted things out before that... Windows also works fine now without the extra hack. - I've done a very basic test of AccessKit on Windows and screen reader seems ok but I'm really not knowleadgable enough to say whether it's all good or not. - I've tested cargo tests & all examples on Windows & macOS, and ran a basic Android app. Still, testing native platforms is wel... hard so if anyone can test linux / iOs / older mac versions / windows 10 would probably be a good idea! - For consistencys sake I've made all event like functions in WinitApp return a `Result<EventResult>`. There's quite a bit of Ok-wrapping now, maybe too annoying? Not sure. Thank you for having a look! # Tested on * [x] macOS * [x] Windows * [x] Wayland (thanks [SiebenCorgie](https://github.com/SiebenCorgie)) * [x] X11 (thanks [crumblingstatue](https://github.com/crumblingstatue)!, [SiebenCorgie](https://github.com/SiebenCorgie)) # TODO * [x] Fix "follow system theme" not working on initial startup (winit issue, pinning to 0.30.2 for now). * [x] Fix `request_repaint_after` --------- Co-authored-by: mwcampbell <mattcampbell@pobox.com> Co-authored-by: j-axa <josef.axa@gmail.com> Co-authored-by: DataTriny <datatriny@gmail.com> Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
92 lines
3.6 KiB
TOML
92 lines
3.6 KiB
TOML
[package]
|
|
name = "egui-winit"
|
|
version.workspace = true
|
|
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
|
description = "Bindings for using egui with winit"
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
homepage = "https://github.com/emilk/egui/tree/master/crates/egui-winit"
|
|
license.workspace = true
|
|
readme = "README.md"
|
|
repository = "https://github.com/emilk/egui/tree/master/crates/egui-winit"
|
|
categories = ["gui", "game-development"]
|
|
keywords = ["winit", "egui", "gui", "gamedev"]
|
|
include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[package.metadata.docs.rs]
|
|
all-features = true
|
|
|
|
|
|
[features]
|
|
default = ["clipboard", "links", "wayland", "winit/default", "x11"]
|
|
|
|
## Enable platform accessibility API implementations through [AccessKit](https://accesskit.dev/).
|
|
accesskit = ["accesskit_winit", "egui/accesskit"]
|
|
|
|
# Allow crates to choose an android-activity backend via Winit
|
|
# - It's important that most applications should not have to depend on android-activity directly, and can
|
|
# rely on Winit to pull in a suitable version (unlike most Rust crates, any version conflicts won't link)
|
|
# - It's also important that we don't impose an android-activity backend by taking this choice away from applications.
|
|
## Enable the `game-activity` backend via Winit on Android
|
|
android-game-activity = ["winit/android-game-activity"]
|
|
## Enable the `native-activity` backend via Winit on Android
|
|
android-native-activity = ["winit/android-native-activity"]
|
|
|
|
## [`bytemuck`](https://docs.rs/bytemuck) enables you to cast [`egui::epaint::Vertex`], [`egui::Vec2`] etc to `&[u8]`.
|
|
bytemuck = ["egui/bytemuck"]
|
|
|
|
## Enable cut/copy/paste to OS clipboard.
|
|
## If disabled a clipboard will be simulated so you can still copy/paste within the egui app.
|
|
clipboard = ["arboard", "smithay-clipboard"]
|
|
|
|
## Enable opening links in a browser when an egui hyperlink is clicked.
|
|
links = ["webbrowser"]
|
|
|
|
## Enable profiling with the [`puffin`](https://docs.rs/puffin) crate.
|
|
puffin = ["dep:puffin", "egui/puffin"]
|
|
|
|
## Allow serialization of [`WindowSettings`] using [`serde`](https://docs.rs/serde).
|
|
serde = ["egui/serde", "dep:serde"]
|
|
|
|
## Enables Wayland support.
|
|
wayland = ["winit/wayland", "bytemuck"]
|
|
|
|
## Enables compiling for x11.
|
|
x11 = ["winit/x11", "bytemuck"]
|
|
|
|
[dependencies]
|
|
egui = { workspace = true, default-features = false, features = ["log"] }
|
|
|
|
ahash.workspace = true
|
|
log.workspace = true
|
|
nix = { version = "0.26.4", default-features = false, optional = true }
|
|
raw-window-handle.workspace = true
|
|
web-time.workspace = true
|
|
winit = { workspace = true, default-features = false }
|
|
|
|
#! ### Optional dependencies
|
|
|
|
# feature accesskit
|
|
accesskit_winit = { version = "0.22", optional = true }
|
|
|
|
## Enable this when generating docs.
|
|
document-features = { workspace = true, optional = true }
|
|
|
|
puffin = { workspace = true, optional = true }
|
|
serde = { workspace = true, optional = true }
|
|
webbrowser = { version = "1.0.0", optional = true }
|
|
|
|
[target.'cfg(any(target_os="linux", target_os="dragonfly", target_os="freebsd", target_os="netbsd", target_os="openbsd"))'.dependencies]
|
|
smithay-clipboard = { version = "0.7.0", optional = true }
|
|
|
|
# The wayland-cursor normally selected doesn't properly enable all the features it uses
|
|
# and thus doesn't compile as it is used in egui-winit. This is fixed upstream, so force
|
|
# a slightly newer version. Remove this when winit upgrades past this version.
|
|
wayland-cursor = { version = "0.31.1", default-features = false, optional = true }
|
|
|
|
[target.'cfg(not(target_os = "android"))'.dependencies]
|
|
arboard = { version = "3.3", optional = true, default-features = false }
|