egui
egui copied to clipboard
Multiple native windows
We should add an example egui_glow/examples/multiple_windows.rs that opens multiple native winit windows and runs one egui instance is each.
Probably requires some improvements to the egui_glow API.
I put together a proof of concept of this a couple months back after seeing #552 , I didn't fully test it but it might be a good starting point:
https://github.com/vivlim/egui-glow-multiwin
I think multi native windows would be a really good addition to egui. @vivlim I just tested your repo on a linux Manjaro[0] and everything worked great! I am definitely borrowing inspiration from your code for now, but seeing this integrated into egui by default, or even through an egui crate, would be amazing.
I had a question about how the separate native windows would communicate with each other but your demo does that too, so I just need to dig through the code and grok that part out.
Really good work done here folks.
[0] Here are my full specs if that's useful for validating that the code in egui-glow-multiwin works with some linux distros: OS: Manjaro Linux x86_64 Kernel: 5.15.41-1-MANJARO Resolution: 1920x1080, 1920x1080 DE: Plasma 5.24.5 WM: KWin CPU: AMD Ryzen 9 5950X (32) @ 3.400GHz GPU: NVIDIA GeForce RTX 3060 Memory: 13535MiB / 64292MiB
Default host: x86_64-unknown-linux-gnu stable-x86_64-unknown-linux-gnu rustc 1.61.0
I would also like to have this functionality. Having Egui windows be constrained to the native os windows size is a little limiting when you want to design small popout windows and such.
I tested the approach from @vivlim and it worked quite well initially. However i noticed some pretty sevier performance issues once you have multiple windows open. This happens because an update on one window causes a redraw on all the windows. This means moving a window around becomes quite stuttery the more windows are open.
Something like this would increase the utility of egui by a lot. So many more use-cases could be enabled. Right now it is quite restricting to be forced to make a window fullscreen just in order to use egui windows. Since that is not feasible if the app is not large enough, it forces a complete redesign (which may not work well).
This is being worked on actively in https://github.com/emilk/egui/pull/3172 - please try it out and give feedback!
Example of multiple viewports/windows https://github.com/emilk/egui/tree/master/examples/multiple_viewports