All notable changes to the eframe
crate.
NOTE: egui-winit
, egui_glium
, egui_glow
,and egui-wgpu
have their own changelogs!
This file is updated upon each release.
Changes since the last release can be found at https://github.com/emilk/egui/compare/latest...HEAD or by running the scripts/generate_changelog.py
script.
- Web: only capture clicks/touches when actually over canvas #4775 by @lucasmerlin
The eframe web canvas now works properly when its a small part of a larger web page.
Previously this caused a lot of weird bugs, such as the eframe canvas stealing focus, and resizing the canvas in annoying ways.
Now it should all work seamlessly to have an eframe canvas as part of a web page, including having multiple different eframe apps next to each other.
As part of that the eframe canvas can now be focused (or not), just like an <input>
HTML element.
We've also implemented a better method for sizing and positioning the canvas so that it yields pixel-perfect rendering on all known browsers except for Desktop Safari. What this means is that text is much less likely to be blurry on web for users (#4536 by @jprochazk).
- Add
register_native_texture
ineframe::Frame
#4246 by @Chaojimengnan - Add
NativeOptions::persistence_path
#4423 by @lucasmerlin - Make sure to call
raw_input_hook
on web #4646 by @owen-d
- Early-out from context switching the
glow
backend #4284, #4296 by @emilk - Allow users to create viewports larger than monitor on Windows & macOS #4337 by @lopo12123
- Use
objc2
and its framework crates #4395 by @madsmtm - Emit physical key presses when a non-Latin layout is active #4461 by @TicClick
- Clamp window size to monitor size by default on all platforms #4410 by @rustbasic
- Ignore synthetic key presses #4514 by @hut
- Use
ResizeObserver
instead ofresize
event #4536 by @jprochazk - Make pinch-to-zoom more responsive on web #4621 by @emilk
- Move first
request_animation_frame
into resize observer #4628 by @jprochazk - Replace
directories-next
dependency withdirectories
#4661 by @crumblingstatue eframe::Result
is now short foreframe::Result<()>
#4706 by @emilk- Ignore keyboard events unless canvas has focus #4718 by @emilk
- Fix
ViewportCommand::InnerSize
not resizing viewport on Wayland (#4211) #4211 by @rustbasic - Improve IME support with new
Event::Ime
#4358 by @rustbasic - IME for chinese #4436 by @rustbasic
- Fix: Window position creeps between executions on scaled monitors #4443 by @avery-radmacher
- Fix: still track mouse when dragging outside web canvas #4522 by @emilk
- Fix: Don't
.forget()
RAF closure #4551 by @jprochazk - Improve web text agent #4561 by @jprochazk
- Fix broken mouse coordinates when there's padding on the canvas element #4729 by @emilk
- Only repaint on cursor movements of area, or if dragging outside #4730 by @emilk
- Fix drag-and-drop file preview/hover #4732 by @emilk
- Fix stuck keys after pressing ctrl+C, cmd+A, etc #4731 by @emilk
Applications can now return an error during the app creation (#4565 by @emilk), so you now need to wrap your Box<dyn App>
in a Result
like so:
- eframe::run_native("My App", options, Box::new(|cc| Box::new(MyApp::new(cc))));
+ eframe::run_native("My App", options, Box::new(|cc| Ok(Box::new(MyApp::new(cc)))));
To make the eframe canvas fill the entire web browser, set its CSS to:
top: 0;
left: 0;
width: 100%;
height: 100%;
See index.html
and #4536 for details.
If you are using eframe for a fullscreen app, you should call .focus()
on your canvas during startup:
document.getElementById("the_canvas_id").focus();
- Fix continuous repaint on Wayland when TextEdit is focused or IME output is set #4269 (thanks @white-axe!)
- Remove a bunch of
unwrap()
#4285
- Web: repaint if the
#hash
in the URL changes #4261 - Add web support for
zoom_factor
#4260 (thanks @justusdieckmann!)
- Update to document-features 0.2.8 #4003
- Added
App::raw_input_hook
allows for the manipulation or filtering of raw input events #4008 (thanks @varphone!)
- Add with_taskbar to viewport builder #3958 (thanks @AnotherNathan!)
- Add
winuser
feature towinapi
to fix unresolved import #4037 (thanks @varphone!) - Add
get_proc_address
in CreationContext #4145 (thanks @Chaojimengnan!) - Don't clear modifier state on focus change #4157 (thanks @ming08108!)
- Add x11 window type settings to viewport builder #4175 (thanks @psethwick!)
- Add
webgpu
feature by default to wgpu #4124 (thanks @ctaggart!) - Update kb modifiers from web mouse events #4156 (thanks @ming08108!)
- Fix crash on
request_animation_frame
when destroying web runner #4169 (thanks @jprochazk!) - Fix bug parsing url query with escaped & or = #4172
Location::query_map
: support repeated key #4183
- Fix high CPU usage on Windows when app is minimized #3985 (thanks @rustbasic!)
- Update to document-features 0.2.8 #4003
- Update
wgpu
to 0.19 #3824 - Disable the default features of
wgpu
#3875 - Much more accurate
cpu_usage
timing #3913 - Update to puffin 0.19 #3940
- Keep
ViewportInfo::maximized
andminimized
up-to-date on Windows #3831 (thanks @rustbasic!) - Handle
IconData::default()
without crashing #3842 - Fix Android crash on resume #3847 #3867 (thanks @Garoven!)
- Add
WgpuConfiguration::desired_maximum_frame_latency
#3874 - Don't call
App::update
on minimized windows #3877 (thanks @rustbasic!)
- When using
wgpu
on web,eframe
will try to use WebGPU if available, then fall back to WebGL #3824 #3895 (thanks @Wumpf!)
- If both
glow
andwgpu
features are enabled, default towgpu
#3717
- Update to winit 0.29 #3649 (thanks @fornwall!)
- Make glow
Send + Sync
again #3646 (thanks @surban!) - Bug fix: framebuffer clear when using glow with multi-viewports #3713
- Fix: Let
accesskit
process window events #3733 (thanks @DataTriny!)
- Fix building the
wasm32
docs fordocs.rs
#3757
- Fix window flashing white on launch #3631 (thanks @zeozeozeo!)
- Fix windowing problems when using the
x11
feature on Linux #3643 - Fix bugs when there are multiple monitors with different scales #3663
glow
backend: clear framebuffer color before callingApp::update
#3665
- Fix click-to-copy on Safari #3621
- Don't throw away frames on click/copy/cut #3623
- Remove dependency on
tts
#3651
- Multiple viewports/windows #3172 (thanks @konkitoman!)
- Replace
eframe::Frame
commands andWindowInfo
with egui #3564 - Use
egui::ViewportBuilder
ineframe::NativeOptions
#3572 - Remove warm-starting #3574
- Fix copy and cut on Safari #3513 (thanks @lunixbochs!)
- Update puffin to 0.18 #3600
- Update MSRV to Rust 1.72 #3595
Most settings in NativeOptions
have been moved to NativeOptions::viewport
, which uses the new egui::ViewportBuilder
:
let native_options = eframe::nativeOptions {
- initial_window_size: Some(egui::vec2(320.0, 240.0)),
- drag_and_drop_support: true,
+ viewport: egui::ViewportBuilder::default()
+ .with_inner_size([320.0, 240.0])
+ .with_drag_and_drop(true),
..Default::default()
};
NativeOptions::fullsize_content
has been replaced with four settings: ViewportBuilder::with_fullsize_content_view
, with_title_shown
, with_titlebar_shown
, with_titlebar_buttons_shown
frame.info().window_info
is gone, replaced with ctx.input(|i| i.viewport())
.
frame.info().native_pixels_per_point
is replaced with ctx.input(|i| i.raw.native_pixels_per_point)
.
Most commands in eframe::Frame
has been replaced with egui::ViewportCommand
, so So frame.close()
becomes ctx.send_viewport_cmd(ViewportCommand::Close)
, etc.
App::on_close_event
has been replaced with ctx.input(|i| i.viewport().close_requested())
and ctx.send_viewport_cmd(ViewportCommand::CancelClose)
.
eframe::IconData
is now egui::IconData
.
eframe::IconData::try_from_png_bytes
is now eframe::icon_data::from_png_bytes
.
App::post_rendering
is gone. Screenshots are taken with ctx.send_viewport_cmd(ViewportCommand::Screenshots)
and are returned in egui::Event
which you can check with:
ui.input(|i| {
for event in &i.raw.events {
if let egui::Event::Screenshot { viewport_id, image } = event {
// handle it here
}
}
});
- Update MSRV to Rust 1.70.0 #3310
- Update to puffin 0.16 #3144
- Update to
wgpu
0.17.0 #3170 (thanks @Aaron1011!) - Improved wgpu callbacks #3253 (thanks @Wumpf!)
- Improve documentation of
eframe
, especially for wasm32 #3295 eframe::Frame::info
returns a reference #3301 (thanks @Barugon!)- Move
App::persist_window
toNativeOptions
andApp::max_size_points
toWebOptions
#3397
- Only show on-screen-keyboard and IME when editing text #3362 (thanks @Barugon!)
- Add
eframe::storage_dir
#3286 - Add
NativeOptions::window_builder
for more customization #3390 (thanks @twop!) - Better restore Window position on Mac when on secondary monitor #3239
- Fix iOS support in
eframe
#3241 (thanks @lucasmerlin!) - Speed up
eframe
state storage #3353 (thanks @sebbert!) - Allow users to opt-out of default
winit
features #3228 - Expose Raw Window and Display Handles #3073 (thanks @bash!)
- Use window title as fallback when app_id is not set #3107 (thanks @jacekpoz!)
- Sleep a bit only when minimized #3139 (thanks @icedrocket!)
- Prevent text from being cleared when selected due to winit IME #3376 (thanks @YgorSouza!)
- Fix android app quit on resume with glow backend #3080 (thanks @tkkcc!)
- Fix panic with persistence without window #3167 (thanks @sagebind!)
- Only call
run_return
twice on Windows #3053 (thanks @pan93412!) - Gracefully catch error saving state to disk #3230
- Recognize numpad enter/plus/minus #3285
- Add more puffin profile scopes to
eframe
#3330 #3332
- Update to wasm-bindgen 0.2.87 #3237
- Remove
Function()
invocation from eframe text_agent to bypass "unsafe-eval" restrictions in Chrome browser extensions. #3349 (thanks @aspect!) - Fix docs about web #3026 (thanks @kerryeon!)
- Fix:
request_repaint_after
works even when called from background thread #2939 - Clear all keys and modifies on focus change #2857 #2933
- Remove dark-light dependency #2929
- Replace
tracing
withlog
#2928 - Update accesskit to 0.11 #3012
- Automatically change theme when system dark/light mode changes #2750 (thanks @bash!)
- Enabled wayland feature for winit when running native #2751 (thanks @ItsEthra!)
- Fix eframe window position bug (pixels vs points) #2763 (thanks @get200!)
- Add
Frame::request_screenshot
andFrame::screenshot
to communicate to the backend that a screenshot of the current frame should be exposed byFrame
duringApp::post_rendering
(#2676). - Add
eframe::run_simple_native
* a simple API for simple apps (#2453). - Add
NativeOptions::app_id
which allows to set the Wayland application ID under Linux (#1600). - Add
NativeOptions::active
#2813 (thanks @Dixeran!) - Remove
android-activity
dependency + addActivity
backend features #2863 (thanks @rib!) - Fix bug where the eframe window is never destroyed on Linux when using
run_and_return
(#2892) - Fix state persisting when exiting on Linux #2895 (thanks @flukejones!)
- Allow for requesting the user's attention to the window #2905 (thanks @TicClick!)
- Read and request window focus #2900 (thanks @TicClick!)
- Set app icon on Mac and Windows #2940
- Set a default icon for all eframe apps: a white
e
on black background #2996 - Add
NativeOptions::app_id
for the persistence location #3014 and for Wayland #3007 (thanks @thomaskrause!) - capture a screenshot using
Frame::request_screenshot
870264b
⚠️ BREAKING:eframe::start_web
has been replaced witheframe::WebRunner
, which also installs a nice panic hook (no need forconsole_error_panic_hook
).⚠️ BREAKING: WebGPU is now the default web renderer when using thewgpu
feature ofeframe
. To use WebGL withwgpu
, you need to addwgpu = { version = "0.16.0", features = ["webgl"] }
to your ownCargo.toml
. (#2945)- Add
eframe::WebLogger
for redirectinglog
calls to the web console (console.log
). - Prefer the client width/height for the canvas parent #2804 (thanks @samitbasu!)
- eframe web: Persist app state to local storage when leaving site #2927
- Better panic handling #2942 #2992
- Update wasm-bindgen to 0.2.86 #2995
- Properly unsubscribe from events on destroy 4d360f6
- Fix typing the letter 'P' on web (#2740).
- Allow compiling
eframe
with--no-default-features
(#2728).
- Fixed crash when native window position is in an invalid state, which could happen e.g. due to changes in monitor size or DPI (#2722).
⚠️ BREAKING:App::clear_color
now expects you to return a raw float array (#2666).- The
screen_reader
feature has now been renamedweb_screen_reader
and only work on web. On other platforms, use theaccesskit
feature flag instead (#2669).
eframe::run_native
now returns aResult
(#2433).- Update to
winit
0.28, adding support for mac trackpad zoom (#2654). - Fix bug where the cursor could get stuck using the wrong icon.
NativeOptions::transparent
now works with the wgpu backend (#2684).- Add
Frame::set_minimized
andset_maximized
(#2292, #2672). - Fixed persistence of native window position on Windows OS (#2583).
- Prevent ctrl-P/cmd-P from opening the print dialog (#2598).
- MSRV (Minimum Supported Rust Version) is now
1.65.0
(#2314). - Allow empty textures with the glow renderer.
- Don't repaint when just moving window (#1980).
- Added
NativeOptions::event_loop_builder
hook for apps to change platform specific event loop options (#1952). - Enabled deferred render state initialization to support Android (#1952).
- Added
shader_version
toNativeOptions
for cross compiling support on different target OpenGL | ES versions (on nativeglow
renderer only) (#1993). - Fix: app state is now saved when user presses Cmd-Q on Mac (#2013).
- Added
center
toNativeOptions
andmonitor_size
toWindowInfo
on desktop (#2035). - Improve IME support (#2046).
- Added mouse-passthrough option (#2080).
- Added
NativeOptions::fullsize_content
option on Mac to build titlebar-less windows with floating window controls (#2049). - Wgpu device/adapter/surface creation has now various configuration options exposed via
NativeOptions/WebOptions::wgpu_options
(#2207). - Fix: Make sure that
native_pixels_per_point
is updated (#2256). - Added optional, but enabled by default, integration with AccessKit for implementing platform accessibility APIs (#2294).
- Fix: Less flickering on resize on Windows (#2280).
⚠️ BREAKING:start_web
is a nowasync
(#2107).- Web: You can now use WebGL on top of
wgpu
by enabling thewgpu
feature (and disablingglow
via disabling default features) (#2107). - Web: Add
WebInfo::user_agent
(#2202). - Web: you can access your application from JS using
AppRunner::app_mut
. Seecrates/egui_demo_app/src/lib.rs
(#1886).
- MSRV (Minimum Supported Rust Version) is now
1.61.0
(#1846). - Added
wgpu
rendering backed (#1564):- Added features
wgpu
andglow
. - Added
NativeOptions::renderer
to switch between the rendering backends.
- Added features
egui_glow
: remove calls togl.get_error
in release builds to speed up rendering (#1583).- Added
App::post_rendering
for e.g. reading the framebuffer (#1591). - Use
Arc
forglow::Context
instead ofRc
(#1640). - Fixed bug where the result returned from
App::on_exit_event
would sometimes be ignored (#1696). - Added
NativeOptions::follow_system_theme
andNativeOptions::default_theme
(#1726). - Selectively expose parts of the API based on target arch (
wasm32
or not) (#1867).
- Fixed clipboard on Wayland (#1613).
- Added ability to read window position and size with
frame.info().window_info
(#1617). - Allow running on native without hardware accelerated rendering. Change with
NativeOptions::hardware_acceleration
(#1681, #1693). - Fixed window position persistence (#1745).
- Fixed mouse cursor change on Linux (#1747).
- Added
Frame::set_visible
(#1808). - Added fullscreen support (#1866).
- You can now continue execution after closing the native desktop window (#1889).
Frame::quit
has been renamed toFrame::close
andApp::on_exit_event
is nowApp::on_close_event
(#1943).
- Added ability to stop/re-run web app from JavaScript.
⚠️ You need to update your CSS withhtml, body: { height: 100%; width: 100%; }
(#1803). - Added
WebOptions::follow_system_theme
andWebOptions::default_theme
(#1726). - Added option to select WebGL version (#1803).
- MSRV (Minimum Supported Rust Version) is now
1.60.0
(#1467). - Removed
eframe::epi
- everything is now ineframe
(eframe::App
,eframe::Frame
etc) (#1545). - Removed
Frame::request_repaint
- just callegui::Context::request_repaint
for the same effect (#1366). - Changed app creation/setup (#1363):
- Removed
App::setup
andApp::name
. - Provide
CreationContext
when creating app with egui context, storage, integration info and glow context. - Change interface of
run_native
andstart_web
.
- Removed
- Added
Frame::storage()
andFrame::storage_mut()
(#1418).- You can now load/save state in
App::update
- Changed
App::update
to take&mut Frame
instead of&Frame
. Frame
is no longerClone
orSync
.
- You can now load/save state in
- Added
glow
(OpenGL) context toFrame
(#1425).
- Remove the
egui_glium
feature.eframe
will now always useegui_glow
as the native backend (#1357). - Change default for
NativeOptions::drag_and_drop_support
totrue
(#1329). - Added new
NativeOptions
:vsync
,multisampling
,depth_buffer
,stencil_buffer
. dark-light
(dark mode detection) is now an opt-in feature (#1437).- Fixed potential scale bug when DPI scaling changes (e.g. when dragging a window between different displays) (#1441).
- Added new feature
puffin
to addpuffin profiler
scopes (#1483). - Moved app persistence to a background thread, allowing for smoother frame rates (on native).
- Added
Frame::set_window_pos
(#1505).
- Removed
Frame::alloc_texture
. Useegui::Context::load_texture
instead (#1110). - Shift-scroll will now result in horizontal scrolling on all platforms (#1136).
- Log using the
tracing
crate. Log to stdout by addingtracing_subscriber::fmt::init();
to yourmain
(#1192).
- The default native backend is now
egui_glow
(instead ofegui_glium
) (#1020). - Automatically detect and apply dark or light mode from system (#1045).
- Fixed horizontal scrolling direction on Linux.
- Added
App::on_exit_event
(#1038) - Added
NativeOptions::initial_window_pos
. - Fixed
enable_drag
for Windows OS (#1108).
- The default web painter is now
egui_glow
(instead of WebGL) (#1020). - Fixed glow failure on Chromium (#1092).
- Updated
eframe::IntegrationInfo::web_location_hash
onhashchange
event (#1140). - Expose all parts of the location/url in
frame.info().web_info
(#1258).
Frame
can now be cloned, saved, and passed to background threads (#999).- Added
Frame::request_repaint
to replacerepaint_signal
(#999). - Added
Frame::alloc_texture/free_texture
to replacetex_allocator
(#999).
- Fixed dark rendering in WebKitGTK (#888).
- Added feature
glow
to switch to aglow
based painter (#868).
Frame
now providesset_window_title
to set window title dynamically (#828).Frame
now providesset_decorations
to set whether to show window decorations.- Remove "http" feature (use https://github.com/emilk/ehttp instead!).
- Added
App::persist_native_window
andApp::persist_egui_memory
to control what gets persisted.
- Increase native scroll speed.
- Added new backend
egui_glow
as an alternative toegui_glium
. Enable withdefault-features = false, features = ["default_fonts", "egui_glow"]
.
- Implement
eframe::NativeTexture
trait for the WebGL painter. - Deprecate `Painter::register_webgl_texture.
- Fixed multiline paste.
- Fixed painting with non-opaque backgrounds.
- Improve text input on mobile and for IME.
- Added dragging and dropping files into egui.
- Improve http fetch API.
run_native
now returns when the app is closed.- Web: Made text thicker and less pixelated.
- Fixed
http
feature flag and docs
App::setup
now takes aFrame
andStorage
by argument.App::load
has been removed. ImplementApp::setup
instead.- Web: Default to light visuals unless the system reports a preference for dark mode.
- Web: Improve alpha blending, making fonts look much better (especially in light mode)
- Web: Fix double-paste bug
- Moved options out of
trait App
into newNativeOptions
. - Added option for
always_on_top
. - Web: Scroll faster when scrolling with mouse wheel.
- You can now turn your window transparent with the
App::transparent
option. - You can now disable window decorations with the
App::decorated
option. - Web: Fix mobile and IME text input
- Web: Hold down a modifier key when clicking a link to open it in a new tab.
Contributors: n2
- You can now set your own app icons.
- You can control the initial size of the native window with
App::initial_window_size
. - You can control the maximum egui web canvas size with
App::max_size_points
. Frame::tex_allocator()
no longer returns anOption
(there is always a texture allocator).
- Added support for HTTP body.
- Web: Right-clicks will no longer open browser context menu.
- Web: Fix a bug where one couldn't select items in a combo box on a touch screen.
- Simplify
TextureAllocator
interface. - WebGL2 is now supported, with improved texture sampler. WebGL1 will be used as a fallback.
- Web: Slightly improved alpha-blending (work-around for non-existing linear-space blending).
- Web: Call
prevent_default
for arrow keys when entering text
- Initial release of
eframe