-
Notifications
You must be signed in to change notification settings - Fork 57
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
Don't panic when reentering wnd_proc due to mouse move or timer #130
Conversation
- This can happen, e.g. when opening the system web browser in an event handler via webbrowser crate. - Execute the default window procedure in that case.
This is a similar issue to what occurs when using an external library to open a native file dialog (e.g. with the I'm also reluctant to merge this PR since it only changes some window events to use One possible idea for a more complete solution would be to add a A less involved stopgap solution would be to replace all uses of |
Thanks for the reply. Yes, I'm aware of these downsides. It was intended as a quick solution that improves one particular issue, without going "all in" ;) But of course, I would also prefer a more thorough solution. For me, the defer approach sounds most reasonable. |
@glowcoil I would like to work on the "defer" approach. Or are you already at it? If not, I think this |
I won't have a chance to work on this in the near future, so feel free to give it a try. However, I don't think that internally deferring events is an acceptable solution. In the case of long-running reentrant event loops, like file dialogs, that approach will queue up events for as long as the file dialog is open and then dispatch them all at once immediately after the dialog is closed, which is definitely not desirable behavior. A secondary issue is that some functionality requires synchronously responding to events before returning from the
You can think of the |
I'm going to open a new PR which uses the |
Explanation:
wnd_proc
can happen, e.g. when opening the system web browser in an event handler via webbrowser crate.try_borrow_mut
to fall back to the default window procedure ifwnd_proc
is reentered.borrow_mut
totry_borrow_mut
, just the ones necessary to make the webbrowser crate work, see this PR for egui-baseview: Add support for opening egui links in browser BillyDM/egui-baseview#12.