* improve plot groups and bounds handling
* changelog entry
* fix potential deadlock
* fix two more potential deadlocks
* syntax fix
* move changelog entry
* move category
* Update crates/egui/src/widgets/plot/mod.rs
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* Update crates/egui_demo_lib/src/demo/plot_demo.rs
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* clean up suggestions
* address comments
* use the new methods
* fix locked bounds
* Sync bounds_modified along with the bounds themselves
* move changelog entry
* Remove set_bounds_auto - not necessary any more
* add a comment about bounds modifications
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Jackson Kruger <jackson@farprobe.com>
* Add raw mouse wheel event
The event is sent as it comes from the backend, so it will follow
different conventions depending on the target, and it is up to the user
code to deal with that. The goal is to allow advanced users to implement
alternative UI controls, e.g., using Ctrl to scroll the plot
horizontally instead of zooming, or use Shift to scroll faster instead
of changing direction.
* Change Pixel to Point for consistency
Apply suggestions from code review by emilk
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* Inline mouse wheel raw event closure
It was meant only to be able to use the same variable names without
shadowing the rest of the code, but a simple block accomplishes the same
thing.
* Use wildcard on wheel event match
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* Flip mouse wheel delta sign on web to match native
* Use wheel event data to generate scroll event
To avoid doing the same match and sign conversion twice.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
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.