Commit Graph

2537 Commits

Author SHA1 Message Date
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
Emil Ernerfeldt 97756bc246 Add badges to all crates' README.md 2023-02-12 18:08:13 +01:00
Emil Ernerfeldt f71d79a0ff Release egui-winit, eframe 0.21.1 - fix crash on monitor size/dpi change
https://github.com/emilk/egui/pull/2722

The crash could happen if the monitor size or DPI changes between runs
2023-02-12 15:29:47 +01:00
Aevyrie 95247daa17
Fix window position assertion caused by negative window size (#2722) 2023-02-12 15:14:38 +01:00
Emil Ernerfeldt 530e9f667c format: add some blank lines where it was needed 2023-02-10 18:03:46 +01:00
Emil Ernerfeldt 409fb968d3 add cargo config file that sets --cfg=web_sys_unstable_apis on wasm32 2023-02-10 17:56:10 +01:00
Emil Ernerfeldt 1581f0229e examples/README.md: explain that the examples are for master
and add a link to the latest release
2023-02-08 20:34:43 +01:00
Emil Ernerfeldt ae722ab0cf Release 0.21.0 - Deadlock fix and winit update 2023-02-08 20:11:21 +01:00
Emil Ernerfeldt 1384fa3287 Publish new web demo 2023-02-08 20:10:12 +01:00
Emil Ernerfeldt 83b5b81227 Update changelogs with recent additions 2023-02-08 19:36:33 +01:00
Emil Ernerfeldt 63fa3aec10 Update example screenshots 2023-02-08 19:04:04 +01:00