* Refactor: remove extra store of events
* Remove unnecessary extra function
* Refactor: simplify event registering
* Store panic summary
* egui_demo_app: move web-part to own module
* index.html: await
* Properly unsubscribe from events on panic
* Better error handling
* Demo app html: hide the wasm canvas and show an error message on panic
* egui_demo_app: add panic button to test panic response on web
* fix typo
* Use a constructor to create WebHandle
* Refactor: less use of locks in the interfaces
* More consistent naming
* eframe: Set app icon on Mac and Windows
Also: correctly set window title on Mac when launching from
another process, e.g. python.
Co-authored-by: Wumpf <andreas@rerun.io>
* lint fixes
* Fix web build
* fix typo
* Try fix windows build
---------
Co-authored-by: Wumpf <andreas@rerun.io>
* Refactor repaint logic
* request_repaint_after also fires the request_repaint callback
* Bug fixes
* Add test to egui_demo_app
* build_demo_web: build debug unless --release is specified
* Fix the web backend too
* Run special clippy for wasm, forbidding some types/methods
* Remove wasm_bindgen_check.sh
* Fix typos
* Revert "Remove wasm_bindgen_check.sh"
This reverts commit 92dde25344.
* Only run cranky/clippy once
* add method for requesting attention to the main window
* use another enum member for user attention type instead of nested `Option`s
(also, document the enum members now that they don't mirror `winit`)
* update the docstring
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* add an example app for testing window attention requests
* Apply suggestions from code review
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* remove `chrono` dependency and improve the attention example's readability
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
It is very easy for keys to become stuck when we alt-tab,
or a save-dialog opens by Ctrl+S, etc.
Therefore we new clear all the modifiers and down keys to avoid that.
* Remove dark-light dependency
Since https://github.com/emilk/egui/pull/2750 we now get what we need
straight from `winit`.
* fix warning
* Docstring formatting
* fix typo in check.sh
* Replace tracing crate with log
It's just so much simpler to use
* Add `bacon wasm` job
* eframe: add a WebLogger for piping log events to the web console
* Set whether zooming allowed for x and y separately
* Set whether dragging allowed for x and y separately
* Add disclaimers about interaction with data_aspect
* Show zoom & drag behavior in plot demo/charts instead of context menu demo
* Code review suggestions - use AxisBools::any()
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* Simplify allow_drag and allow_zoom APIs to take in Into<AxisBools>
* Remove unnecessary using...
* Remove unrelated change
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* 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`