Instead of depending on android-activity directly, this exposes the
android-native-activity and android-game-activity features from Winit.
This ensures that applications can choose what android-backend they use
while also relying on Winit to decide what version of android-activity to
use - without increasing the risk of a version conflict by having a direct
dependency.
_(NB: Egui doesn't currently use the android-activity API itself)_
Since android-activity provides the `android_main()` entry point for
Android applications it's not possible to link in multiple version of
the android-activity crate and so it's particularly important to
avoid unnecessary direct dependencies that could cause a version
conflict in the future.
To help avoid the need for applications to directly depend on
android-activity the Winit crate re-exports the android-activity API
and exposes features to configure the backend so that application crates
can instead rely on Winit to pull in a compatible version of
android-activity. (This way version bumps for android-activity only
need to be synchronized with the Winit crate).
CI now enables the `android-native-activity` feature for testing.
Fixes: #2829Fixes: #2720Closes: #2834
`EventResult::Exit` is hit before `Event::LoopDestroyed` is, and due to
possibly some order of operations or drops the window is never destroyed
on Linux. Adding a call to `winit_app.save_and_destroy();` where
`EventResult::Exit` is checked solves this.
Closes#2892
Signed-off-by: Luke D. Jones <luke@ljones.dev>
* Add ability to read the native window's focus state
* Add `eframe::Frame::focus()` for requesting the native window's focus
* rename the output field `active` → `focused` for consistency
* Add char_limit to TextEdit
* Use match statement instead
* Update CHANGELOG.md
* Fixed panics
Updated to fix panics for UTF-8 characters and subtract overflow
* Inline code in insert_text
* egui-winit: fix unsafe API of Clipboard::new
The old API allowed passing an arbitrary pointer. The new
API still breaks safety by allowing the object to outlive
the input, but is at least safer.
* Update crates/egui-winit/src/clipboard.rs
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* Fix typo
* Update crates/egui-winit/src/clipboard.rs
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* cargo fmt
* egui-winit: fix init_smithay_clipboard
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* feat: simple grid row color picker
* feat: allow painting initial grid row
* avoid coloring callback for striped when not needed
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* fix: switch from rgba to color32 for row grid color assignment
* fix warning
* make `paint_row` private
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* [egui-wgpu] Do vertex & index buffer in a single copy each
Also, copy uniform buffer only if necessary.
Previously, we did hundreds of small copies via queue.write_buffer which would create a new buffer for each of these copies. Now, there are only two gpu sided copy operations and the memory goes directly to the staging buffer.
In a quick debug test on Rerun this decreased time for the `update_buffer` method from about 0.87ms to 0.37ms!
* fix comparing padding on UniformBuffer in wgpu renderer
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* React to ThemeChanged event from winit
* React to theme change using media query change event in WASM
* Share conversion from bool -> Theme
* Suppress too_many_arguments warning
* Document limitations of automatically following the dark vs light mode preference
* Simplify expression
* Conditionally compile code to prevent unused item warnings
* Remove needless borrow
* Remove another needless borrow
* Make associated functions to standalone
* Request repaint after theme has changed
* Only install event listener when `follow_system_theme` is enabled
* Remove dark-light feature gate
* Detect system theme using winit
* Update documentation
* Fix typos
* fix warning about unused argument
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* Make `IdTypeMap::get_temp` use immutable `self`
* Add note to `IdTypeMap::get_persisted` about mutability
* Add mention of `ArcSwap` in `IdTypeMap` docs
* Fix formatting with `cargo fmt`
* use font metrics in layout
* properly center scaled fonts
* adjust docs
* fix raised text
* fix easymark viewer small text alignment
caused by variable row heights
Calling the layer painter from inside a write() call causes a deadlock
on the Context. This change stores the necessary data (the two
overlapping Rects) in the write() call but uses them outside.
Closes#2752
* Check that we can compile eframe with --no-default-features
* Allow compiling eframe with `--no-default-features`
This is useful for libraries that depend on `eframe::Frame`
but don't care what renderer eframe is using.