-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Eframe] Allow eframe
to run on an existing event loop
#2875
Comments
I'd be happy to review a PR in this area! |
sdhgggggdfjghldksfjghksdfjg I want to run a
is my way of making it work in a hacky way because I don't care about making PR-ready code when asking for one is the only response from the maintainer here |
@LoganDark thanks for outlining the steps required to get this to work! If you're gonna make a fork and do the changes, why not just open a PR while you're at it?
I don't follow. What more do you want from me? This issue touches on a use case I have no experience in, and is a perfect place for others to help out. I've spent thousands of hours of my own time building egui, answering question, reviewing PRs, etc. egui also have had hundreds of other contributors, giving away their time for free so that you can enjoy egui. Is your time too valuable to open a PR, yet you still have time to complain? |
it exposes a ton of private implementation details to the public API and I assumed you wouldn't accept it since it's just adding
Sorry, I was just frustrated at the time and it's really upsetting to see the exact issue I'm trying to solve addressed with a simple "PRs welcome". I had bad experience with that specific type of response.
Value does not play a part in my decision-making, ADHD does. If you know anything about ADHD - don't lecture me for making a choice that sounds like it would be harder, or sounds like it wouldn't make that much of a difference. Words like this won't in any way encourage me to help out here. |
Recording.2023-09-04.102432.mp4Eh it looks like eframe has some global state or something that gets really mad when you have multiple windows open. Only the most recently created this could be a decent architecture though, because it allows you to access the apps themselves (and their fields) from the event loop (those buttons work by setting a field that the event loop checks for) |
Recording.2023-09-04.110820.mp4wait. that was an issue with the glow backend specifically. with wgpu it works perfectly what- |
whatever. I don't know anything about OpenGL or Glutin, don't know why it's corrupting other windows when they are open, but if wgpu works fine then I guess that's what I'll use. for what it's worth, making a PR for this would probably be probably easier than I thought because eframe's existing event loop implementation can be reimplemented in terms of this. And also it would probably remove the shameless copy and pasting between I'd still need your help to fix the glow backend and preferably with a bit less of whatever it is that was in your last comment but I've already done most of the work so it's probably fine. |
Hey @emilk, I actually do have a finished working implementation. I never submitted it because there are some design choices that need to be made regarding the exposed API. I'll try to open a PR later today with what I choose but listing the alternatives, since I think it'll be easier to reason about it looking at the code. |
Is your feature request related to a problem? Please describe.
I want my program to have 2 separate
winit
windows, one with anegui
interface managed byeframe
and another managed by myself. Currently, this is not possible witheframe
because the only API to start a window isrun_native
, which internally creates an event loop, and only 1 event loop can exist on a thread afaik.For now, I am managing the
egui
window by myself usingegui_winit
andegui_wgpu
, but there are a lot of caveats I need to take care (paint intervals, custom handling of specific events, etc), and if I wanted to integrate withepi
it would take even more work.Describe the solution you'd like
It would be great if
eframe
could implement:eframe
through a differentrun
method, perhapsrun_native_ex
,run_native_custom
,run_native_managed
, etc, which returns some kind of structure.on_event
method on said structure that returns the currently internalResult<EventResult>
result struct + enum, so users can managecontrol_flow
on their own.paint
method on said structure that paints stuff to the screen.Describe alternatives you've considered
Could also be solved if you could have 2 event loops on the same thread. I'm not that knowledgeable on
winit
's internals, so not sure if that's possible on their part (since it's currently not allowed, I'm guessing it's not).The text was updated successfully, but these errors were encountered: