* Update ui.rs docs to clarify available_size and co
Added docs to the available_width() and available_height() methods.
Added a quick note about the wrapping versions of the methods as well.
* fix a couple of typos, and use code-style for doc-links
* fix doclinks
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
In `0.22.0`, `eframe::start_web` has been replaced with `eframe::WebRunner`, which also installs a nice panic hook (no need for `console_error_panic_hook`).
A window may not always be available and may have already been closed by the time an eframe app is closing. An example of this is Android, where the main activity window may have been stopped or discarded because the app is no longer in the foreground, and then the user decides to close your app without resuming it using the multitasking view.
In this case, skip the window persistence step if it does not exist anymore by the time we are saving the persistence data. Currently eframe will panic with `winit window doesn't exist` instead.
* Triage for GL backend
* And cargo-fmt
* Changelog update with PR and issue
* Update crates/eframe/src/epi/mod.rs
Co-authored-by: Andreas Reich <r_andreas2@web.de>
* Update crates/egui-wgpu/src/winit.rs
Co-authored-by: Andreas Reich <r_andreas2@web.de>
* Add "supports_screenshot" to surface state
* Cranky fix
* fmt
---------
Co-authored-by: Andreas Reich <r_andreas2@web.de>
* Expose raw window and display handles in eframe
* Ensure that no one implements `Clone` in the future
* Cleanup
---------
Co-authored-by: Matti Virkkunen <mvirkkunen@gmail.com>
The approach of #1889 may remove observers in a view
twice, which produces the Obj-C Exception:
Cannot remove an observer <...> for the key path
"nextResponder" from <WinitView ...> because
it is not registered as an observer.
The above message can only be seen when attaching the
application to debugger. Users normally see:
[1] *** trace trap cargo run
This commit fixes it by only running `event_loop.run_return()`
twice on Windows. Besides:
* We have set `ControlFlow::Exit` on `Event::LoopDestroyed`,
`EventResult::Exit` and on error; therefore, it is safe
to not calling `set_exit()`.
* This commit also fix the persistence function in macOS.
It can't store the content in Memory due to this exception.
Fixed: #2768 (eframe: "App quit unexpectedly" on macOS)
Signed-off-by: pan93412 <pan93412@gmail.com>
* Add an optional app_id field to eframe's NativeOptions (#1600).
This is used in the window builder to set the application ID, which is e.g. important for a proper configuration in `.desktop` files under Wayland.
When no application ID is explicitly set, it defaults to the title of the window.
* Only enable NativeOptions::app_id under Linux.
The wayland feature is not sufficent as constraint and it won't compile e.g. under Windows.
While Wayland could also be used on other Unix-Systems like FreeBSD, this would probably need some specific testing. Winit uses the following definition as "wayland_platform" and on which the required packages are available:
> wayland_platform: { all(feature = "wayland", free_unix, not(wasm), not(redox)) },
* Do not use title as default application ID under Wayland.
The title might be used to also communicate state (opened file, ...) to the user and this might have unforeseen consequences for the application ID. It seems to be better to use the old behavior of not setting an application ID in this case. Also add an example on how to set the application ID in the documentation.
* Avoid as_deref(), which was a left-over of a previous version
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
TextureId::Epaint was renamed to TextureId::Managed during the
development of #1110. Update the documentation to match.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
* Update accesskit to 0.11
* Add instructions on how to test the web viewer to CONTRIBUTING.md
Also removed dependency on `jq`
Closes https://github.com/emilk/egui/issues/2859
* Detect panics during initialization and show them to the user
* PanicHandler now also logs the panics
* Add example of how to call into your app from JS
* Refactor: break out AppRunner and AppRunnerRef to own files
* Hide AppRunner
* Simplify user code
* AppRunnerRef -> WebRunner
* Better docs
* Don't paint until first animation frame
* Update multiple_apps.html
* Update web demo
* Cleanup and fixes
* left-align panic message in html