1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 23:13:13 -04:00
Commit Graph

147 Commits

Author SHA1 Message Date
Konkitoman
141421547b Fix: a sync viewport cannot render itself he needs his parent to be rendered now when sync viewport needs a redraw that redraw will be redirected to his parent 2023-08-02 19:58:12 +03:00
Konkitoman
34fea8a0e5 Some more work on making possible to render viewport_sync in glutin
Context::current_rendering_viewport was replaced by Context::get_viewport_id
Added Context::get_parent_viewport_id
Changed Context::run to need parent_viewport_id
Changed Context::beagin to need parent_viewport_id
Added ImplContext::frame_stack
Some work on making posibile to render multiples frames at the same time
A lot of more things in glutin backend is not Arc<RwLock<T>>
2023-08-02 17:14:31 +03:00
Konkitoman
c7c9713bf8 create_viewport_sync prep Glutin
WGPU Unimplemented again, use Arc<RwLock<T>> for a lot of things
2023-08-01 17:30:36 +03:00
Konkitoman
1e6c1b55d3 Some work on frontend for making create_viewport_sync possible 2023-08-01 15:19:18 +03:00
Konkitoman
fd1c01cf1f Removed Context::set_current_rendering_viewport
Now we always need to say what viewport we rendering in Context::beagin or Context::run
2023-07-30 20:03:56 +03:00
Konkitoman
bb0b80fb08 Fix some warnings 2023-07-28 18:28:16 +03:00
Konkitoman
c56d09a2e5 Fix WGPU implementation memory leak
Now unused surfaces will be cleared
2023-07-27 18:22:43 +03:00
Konkitoman
769c71a714 WGPU implementation 2023-07-27 18:18:14 +03:00
Konkitoman
0e74cf4ca0 Some work making the native window to look like the egui one, and to work the same 2023-07-27 15:08:21 +03:00
Konkitoman
cb09e630a2 Add a new example and change how embedding is stored 2023-07-25 16:40:03 +03:00
Konkitoman
2131f251fc Update example and now the viewport will always render if can create a native window will be embedded 2023-07-25 12:43:34 +03:00
Konkitoman
08b3afdc5e Now the window will have the correct size
Now window will not be resizable if is set to false
2023-07-25 12:10:56 +03:00
Konkitoman
19d1fecb99 Now we can drag any viewport but only the viewport that is focused will be draged because if not on x11 the input will be taken until the application is killed 2023-07-25 11:53:10 +03:00
Konkitoman
93a7c018d7 Now App::update will be responsabile for what viewport will be drawned and its content
A big refactoring was needed
2023-07-25 10:54:31 +03:00
Konkitoman
19f807b4e9 Fix 100% cpu usage because a non existen window is tryng to draw
Fix a small memory leak
2023-07-25 09:57:54 +03:00
Konkitoman
86068c6590 Fix small memory leak
Now windows that do not exist will not be able to stay in redraw requests
2023-07-25 09:48:12 +03:00
Konkitoman
4143f58cc8 Now if winit supports if the window cant be closed will not show the close button 2023-07-24 16:37:47 +03:00
Konkitoman
f4a196cddc Now a WindowEvent::CloseRequested is received will be sent to egui_winit::State in RawInput
Now when we press the close button from a native window if the window has a open variabile connected the window will be closed
2023-07-24 16:15:34 +03:00
Konkitoman
4d883b8217 Fix mouse input
Now on Context.create_viewport in the render function will we have viewport_id and parent_viewport_id
New problem if a windows is fucused and we interact with other window the first event will be send to the last window that was focused
2023-07-24 14:24:30 +03:00
Konkitoman
3a1d9f2e21 A lot of changes:
Now the Viewport render function is passed to the backend
I was needed to update the demo because now Window::show() needs a Fn before was a FnOnce
I changed from FnOnce to Fn because we want the window to be rendered separately from the main window
That means now the variabiles that we are moving to window need to be Rc or Arc!
This is making harder to use `Window`!
I'am waiting for more ideas!
In eframe now any Window has a property render that stores the current window render function, if has not function App::update will be called insted!
New problems in any other window excluding the main window we have no mouse input, i don't know why!
Now every window has embedded to false by default, for testing purposes!
2023-07-23 19:38:02 +03:00
Konkitoman
ea2dcd8cb5 Rename every thing that i was implemented for multiples windows to Viewport 2023-07-23 12:47:36 +03:00
Konkitoman
0daafa0c0f Fixed the problem that cause a break in time space 2023-07-21 22:58:17 +03:00
Konkitoman
2b13572220 Now every window has egui-winit, but a big problem is that a window don't render if the window frame number is bigger the the current frame, this is a spaculation because i don't know if a window stores the current frame i don't know what happens because new window render from the first time but the egui-ctx don't want to render the new window
is like i have tow egui-ctx
2023-07-21 22:00:22 +03:00
Konkitoman
23bb315468 Now a window will not render other window content 2023-07-19 14:01:12 +03:00
Konkitoman
b66cf96343 Not will only redraw what is needed and the cpu will not be at 100% all the time 2023-07-19 11:16:51 +03:00
Konkitoman
680a547a68 Now is rendering on the new windows 2023-07-19 10:48:35 +03:00
Konkitoman
28d5c6e62c Now window will be destroyed if is not rendered 2023-07-18 17:52:55 +03:00
Konkitoman
8f475ef8d8 Is creating a window 2023-07-18 16:50:41 +03:00
Konkitoman
c91de8a871 Some more work for multiples windows support 2023-07-18 15:29:56 +03:00
Konkitoman
7cbe26a1a1 Some work for making eframe to be able to have multiples windows 2023-07-17 16:15:38 +03:00
icedrocket
2a2529bb9c eframe: sleep a bit only when minimized (#3139) 2023-07-10 10:56:24 +02:00
amfaber
9478e50d01 Fix panic on wgpu GL backend due to new screenshot capability (#3078)
* Triage for GL backend

* And cargo-fmt

* Changelog update with PR and issue

* Update crates/eframe/src/epi/mod.rs

Co-authored-by: Andreas Reich <r_andreas2@web.de>

* Update crates/egui-wgpu/src/winit.rs

Co-authored-by: Andreas Reich <r_andreas2@web.de>

* Add "supports_screenshot" to surface state

* Cranky fix

* fmt

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2023-06-15 11:16:25 +02:00
bilabila
9774d4af2c eframe: fix android app quit on resume with glow backend (#3080) 2023-06-15 09:05:11 +02:00
τ
073f49682d Expose Raw Window and Display Handles (#3073)
* Expose raw window and display handles in eframe

* Ensure that no one implements `Clone` in the future

* Cleanup

---------

Co-authored-by: Matti Virkkunen <mvirkkunen@gmail.com>
2023-06-11 22:18:28 +02:00
pan93412
860dac69da eframe: Only run_return twice on Windows (#3053)
The approach of #1889 may remove observers in a view
twice, which produces the Obj-C Exception:

    Cannot remove an observer <...> for the key path
    "nextResponder" from <WinitView ...> because
    it is not registered as an observer.

The above message can only be seen when attaching the
application to debugger. Users normally see:

    [1]    *** trace trap  cargo run

This commit fixes it by only running `event_loop.run_return()`
twice on Windows. Besides:

* We have set `ControlFlow::Exit` on `Event::LoopDestroyed`,
  `EventResult::Exit` and on error; therefore, it is safe
  to not calling `set_exit()`.
* This commit also fix the persistence function in macOS.
  It can't store the content in Memory due to this exception.

Fixed: #2768 (eframe: "App quit unexpectedly" on macOS)

Signed-off-by: pan93412 <pan93412@gmail.com>
2023-06-05 14:57:21 +02:00
Emil Ernerfeldt
cccdfd246e Cleanup ahead of release 2023-05-23 19:53:32 +02:00
Emil Ernerfeldt
03bb89153b eframe: Use NativeOptions::AppId for the persistance location (#3014)
* eframe: Use NativeOptions::AppId for the persistance location

* Fix doclinks

* Fix typo in docs

Closes https://github.com/emilk/egui/issues/3003
2023-05-23 08:38:14 +02:00
Emil Ernerfeldt
68a4239036 Fix --no-default-features (#3015) 2023-05-22 22:11:07 +02:00
Emil Ernerfeldt
45826999ac Add profiling scopes to app icon stuff 2023-05-22 21:40:16 +02:00
Thomas Krause
cc9f1adb84 Add an optional app_id field to eframe's NativeOptions for Wayland (#3007)
* Add an optional app_id field to eframe's NativeOptions (#1600).

This is used in the window builder to set the application ID, which is e.g. important for a proper configuration in `.desktop` files under Wayland.
When no application ID is explicitly set, it defaults to the title of the window.

* Only enable NativeOptions::app_id under Linux.

The wayland feature is not sufficent as constraint and it won't compile e.g. under Windows.
While Wayland could also be used on other Unix-Systems like FreeBSD, this would probably need some specific testing. Winit uses the following definition as "wayland_platform" and on which the required packages are available:

> wayland_platform: { all(feature = "wayland", free_unix, not(wasm), not(redox)) },

* Do not use title as default application ID under Wayland.

The title might be used to also communicate state (opened file, ...) to the user and this might have unforeseen consequences for the application ID. It seems to be better to use the old behavior of not setting an application ID in this case. Also add an example on how to set the application ID in the documentation.

* Avoid as_deref(), which was a left-over of a previous version

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

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-05-22 21:40:04 +02:00
Emil Ernerfeldt
7b76161a6a Set a default icon for all eframe apps: a white e on black background (#2996)
As a user you can change this by setting `NativeOptions::icon_data`.
Set it to `None` to get the default icon assigned by the OS.
2023-05-17 16:23:32 +02:00
Emil Ernerfeldt
ea71b7f20b eframe web: detect and report panics during startup (#2992)
* Detect panics during initialization and show them to the user

* PanicHandler now also logs the panics

* Add example of how to call into your app from JS

* Refactor: break out AppRunner and AppRunnerRef to own files

* Hide AppRunner

* Simplify user code

* AppRunnerRef -> WebRunner

* Better docs

* Don't paint until first animation frame

* Update multiple_apps.html

* Update web demo

* Cleanup and fixes

* left-align panic message in html
2023-05-16 22:22:09 +02:00
Emil Ernerfeldt
e9fa6c8ff6 Add Pointer::is_decidedly_dragging and could_any_button_be_click (#2979)
* Add Pointer::is_decidedly_dragging and could_any_button_be_click

This allows users to distinguish between click and drags
while they are not yet done.

* Fix warning in eframe

* fix typo
2023-05-08 12:27:49 +02:00
Emil Ernerfeldt
3d6a15f442 Log warning instead of error when failing to decode RON in storage (#2961)
* Log warning instead of error when failing to decode RON in storage

* New web demo

* Clean up some warn/error logging

* Avoid deadlock that could happen on crash

* Log errors using console.warn, because console.error can cause crashes

* Use patched version of wasm-bindgen-cli, allowing >2GB memory

* New web demo
2023-04-27 09:45:44 +02:00
Andreas Reich
f76eefb98d [wgpu] Expose wgpu::Adapter via RenderState (#2954)
* [wgpu] Expose adapter, better errors, better docs, more code sharing, use stencil bits

* doc fix

* remove unnecessary unsafe

* handle missing framebuffer format

* better handling of renderstate creation in winit.rs

* remove unnecessary use directive
2023-04-25 17:42:13 +02:00
Andreas Reich
20e291d3f6 [egui-wgpu] Device configuration is now dependent on adapter (#2951)
* [egui-wgpu] Device configuration is now dependent on adapter
Additionally, renamed `backends` into `supported_backends` and improved & unified wgpu config defaults.

* improve wgpu backend default

* clippy fix

* formatting

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-04-25 09:53:13 +02:00
Andreas Reich
0e6d69d4c4 Make egui work on WebGPU out of the box. (#2945)
* Make wgpu webgl/gles opt-in (but still work out of the box via feature flag), workaround canvas creation issue

* missing allow unsafe code annotations

* add breaking change not to eframe release notes

* Add --webgpu flag to build_demo_web.sh

* Improve CHANGELOG docs

* Clean up, and prepare for having to wasm:s

* put canvas without workaround under `if false`

* fix spelling

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-04-24 11:26:45 +02:00
Niklas Korz
f962378243 wgpu 0.16 (#2884)
* Adapt to latest wgpu changes

* Point to latest wgpu commit

* Fix egui-wgpu winit

* wgpu 0.16

* Fix web compilation issue

* Add libloading to deny.toml skip

* lock fix after merge, sort deny skip list

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2023-04-21 11:40:25 +02:00
Emil Ernerfeldt
4d360f67a4 eframe web: rememeber to unsubscribe from events on destroy 2023-04-21 09:22:34 +02:00
Emil Ernerfeldt
ac50fa0d94 eframe web: Better panic handling (#2942)
* 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
2023-04-21 08:33:01 +02:00