Commit Graph

2547 Commits

Author SHA1 Message Date
Emil Ernerfeldt 03c1a05e49 Rename `sh/` folder to `scripts/` 2023-04-18 17:10:52 +02:00
Sven Niederberger 69b568aeb4
Improved plot groups and bounds handling (#2410)
* 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>
2023-04-18 16:27:00 +02:00
Dixeran 8a2cfbd131
Apply 'with_active' option to winit (#2813)
* feat: apply 'with_active' option to winit

* fix: remove platform specification

- winit accept this option for all platforms

* build fix

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-04-18 16:13:25 +02:00
Emil Ernerfeldt af4d737c92 Fix typo. Closes https://github.com/emilk/egui/pull/2876 2023-04-18 16:11:53 +02:00
xacer 4267fc079b
bug: hide triple_clicked in documentation (#2867)
If `Response.clicked` and `Response.double_clicked` are hidden in the documentation, why isn't `Response.triple_clicked`
2023-04-18 16:11:05 +02:00
Emil Ernerfeldt 93ee554af5
Check more target triples with cargo deny (#2919) 2023-04-18 16:10:53 +02:00
Emil Ernerfeldt 4809747952
Check for typos on CI (#2918)
* Check for typos on CI

* Fix all typos
2023-04-18 16:10:20 +02:00
hats-np 77df9cb982
Menu State rect now uses menu frame rect instead of contents rect, as their position goes out of bounds. (#2886) 2023-04-18 16:07:24 +02:00
Jozef Číž 33aa4d698f
Fix typos (#2866)
* Fix typos in comments

* Fix typos in demo texts

* Fix typos in code names

* Fix typos in cargos

* Fix typos in changelogs
2023-04-18 15:52:45 +02:00
YgorSouza 8326fffdb0
Add raw mouse wheel event (#2782)
* 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>
2023-04-18 15:44:26 +02:00
Robert Bragg 89e42884fc
Remove android-activity dependency + add activity features (#2863)
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: #2829
Fixes: #2720
Closes: #2834
2023-04-18 15:40:30 +02:00
Emil Ernerfeldt b604b6200c
Update yanked deps (#2917)
* Update crossbeam-channel 0.56 to 0.58

* Update enumflags2

* CI: cargo check epaint --no-default-features
2023-04-18 15:27:31 +02:00
Luke Jones 7c12bb692b
eframe: add call to save_and_destroy in Exit event of run_return (#2895)
`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>
2023-04-18 15:08:17 +02:00
TicClick 6f1e66731e
eframe: read the state of native window's input focus and request it (#2900)
* 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
2023-04-18 15:03:06 +02:00
Barugon b80c0e6ff6
Add option to show icon (#2910) 2023-04-18 14:55:09 +02:00
Ryan Hileman 116d1547be
fix epaint bytemuck dependency (#2913) 2023-04-18 14:51:38 +02:00
Pēteris Pakalns c86bfb6e67
egui-wgpu: Support multisampling (#2878)
* Minimal implementation for egui wgpu multisampling support

* Update crates/egui-wgpu/CHANGELOG.md

Added pull request url

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

* Fixed cargo cranky error

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-04-13 22:29:15 +02:00
Emil Ernerfeldt eb0812a953
eframe web: ensure modifiers keys won't stick in a down state on alt-tab (#2857)
* eframe web: ensure modifiers keys won't stick in a down state on alt-tab

* Update changelog

* Properly set the has_focus input flag on web
2023-03-31 10:11:41 +02:00
Emil Ernerfeldt 5cdbce04a8
Update to accesskit 0.10.1 (#2855)
* Update to accesskit 0.10.1

* Add helper script to run cargo deny
2023-03-30 10:23:54 +02:00
cameron 5fc5f087ff
Add character limit to TextEdit (#2816)
* 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
2023-03-30 10:23:22 +02:00
Diggory Hardy fb726aaabb
egui-winit: fix unsafe API of Clipboard::new (#2765)
* 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>
2023-03-30 10:21:07 +02:00
Andrew Scott 9ddf7abeee
feat: simple grid row color picker (#2519)
* 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>
2023-03-30 10:01:22 +02:00
Emil Ernerfeldt 92c4e23aac
eframe: add a simplified native-only API for simple native apps (#2453)
* eframe: add a simplified native-only API for simple native apps

* build-fix

* Fix doc-test
2023-03-30 10:00:47 +02:00
XyLyXyRR 4b1c0d90c0
demo app: use `enum` instead of strings for demo-selector anchor (#2781)
* improve(code): use enum instead of string

* update(code): optimize code

* fix(code): lints
2023-03-30 09:20:07 +02:00
Emil Ernerfeldt b8816d6988
Run cargo-deny on a matrix of targets (#2852)
* Run cargo-deny on a matrix of targets

* Try rust-cache

* Restrict the number of OSes
2023-03-30 09:12:11 +02:00
Andreas Reich b1f837ca2f
[egui-wgpu] Do vertex & index buffer in a single copy each (#2820)
* [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>
2023-03-29 19:30:18 +02:00
Brian Janssen 5ccc71415e
Replace show_index String with Into<TextWidget> (#2790) 2023-03-29 17:00:31 +02:00
Ruben 977749b0e0
eframe: Automatically change theme when system dark/light mode changes (#2750)
* 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>
2023-03-29 16:39:30 +02:00
amfaber 870264b005
eframe: capture a screenshot using `Frame::request_screenshot`
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-03-29 16:34:22 +02:00
Ivan Sotnikov 74d43bfa17
Fix UI `data()` read mutability (#2742)
* 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`
2023-03-29 15:59:24 +02:00
c-git 2946ed74e3
Update serial window example (#2756)
* Update to make it more clear what will happen

* Provide an overview in readme of expectations

* Update screenshot to match new code
2023-03-29 15:55:45 +02:00
Boris-Chengbiao Zhou 8eeb3e0d28
Fix resizable columns option in the table demo (#2780) 2023-03-29 15:53:56 +02:00
Samit Basu f38904336b
Prefer the client width/height for the canvas parent (#2804) 2023-03-29 15:04:04 +02:00
Gabriel Féron 24eccca8e6
Only enable instant/wasm-bindgen when building for wasm32 architecture (#2808) 2023-03-29 14:59:45 +02:00
Ryan Hileman 73a011f83a
fix scroll bars not appearing (#2826) (#2827) 2023-03-29 14:53:24 +02:00
YgorSouza 8ec9233e28
Add #![forbid(unsafe_code)] where unsafe isn't needed (#2773)
To be consistent with the use of the safety badge in the README.
2023-03-29 14:39:51 +02:00
ItsEthra c5caed5b35
Enabled wayland feature for winit when running native (#2751)
* Enabled wayland feature for winit when native

* Enable egui-winit/wayland through eframe instead by on by default
2023-03-29 14:38:27 +02:00
lictex_ 94f8b02286
improve fallback fonts alignment (#2724)
* 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
2023-03-29 14:36:09 +02:00
Jeremy Leibs 089c7b46f3
Fix the OS check for windows (#2832) 2023-03-23 15:15:00 +01:00
Emil Ernerfeldt 59c2c4c70d
Update tempfile to fix CVE (#2809)
> cargo update -p tempfile
    Updating crates.io index
      Adding errno v0.2.8
      Adding errno-dragonfly v0.1.2
      Adding io-lifetimes v1.0.6
      Adding linux-raw-sys v0.1.4
    Removing remove_dir_all v0.5.3
      Adding rustix v0.36.9
    Updating tempfile v3.3.0 -> v3.4.0
2023-03-14 08:50:06 +01:00
Emil Ernerfeldt f94187ab71 Remove misleading safety-badges
See https://github.com/emilk/egui/issues/2723
2023-02-28 22:35:08 +01:00
谢克 8345847853
fix window position display error (physical pixels converted to logic… (#2763) 2023-02-28 21:35:09 +01:00
Ivan e9d869c4c5
hsva color_slider_2d orientation change (#2727)
* hsva color_slider_2d orientation change

* color_slider_2d doc fix

---------

Co-authored-by: IVANMK-7 <68190772+IVANMK-7@users.noreply.github.com>
2023-02-28 21:21:01 +01:00
Ivan 5910144112
Scroll bar visibility options (#2729)
* add scroll bar visibility options

* ScrollBarVisibility derive Eq

---------

Co-authored-by: IVANMK-7 <68190772+IVANMK-7@users.noreply.github.com>
2023-02-28 21:20:10 +01:00
YgorSouza f85a25307d
Fix deadlock when using show_blocking_widget (#2753)
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
2023-02-28 20:52:37 +01:00
Emil Ernerfeldt 7215fdfb7c Release eframe 0.21.3 - fix web input of the the letter P 2023-02-15 08:26:45 +01:00
Emil Ernerfeldt e2778d9d6a
eframe: Fix inputting of the letter P on web (#2740)
* eframe: Fix inputting of the letter P on web

* Update changelog

* silence clippy
2023-02-15 08:24:52 +01:00
Emil Ernerfeldt 38849fe381 Release eframe 0.21.2 - support --no-default-features 2023-02-12 19:34:37 +01:00
Emil Ernerfeldt df7e5bd57a
Allow compiling eframe with `--no-default-features` (#2728)
* 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.
2023-02-12 19:29:42 +01:00
Emil Ernerfeldt e3e781ced8 fix puffin_profiler example 2023-02-12 19:27:10 +01:00