-
Notifications
You must be signed in to change notification settings - Fork 909
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
Rework event handling to be based on a trait #3432
Comments
Re mini-batching problem: @daxpedda suggested a design similar to We discussed a potential solution at our last meeting, I'll try to write a bit more about that in the coming days. |
I'd like to add that for 0.30.0 we agreed that we do what the current design is doing and that tracing subscriber approach is more for 0.31.0 version. The resolution for 0.30.0 was to have a method that can will be called before each event. |
We discussed the mini-batching problem and the platform event trait problem today, meeting notes here. One of us still needs to write up some more details on this, but we think it should be possible. |
Regarding platform-specific events, why not define the methods on all platforms but just not call them on irrelevant platform(s)? (or alternatively have them as conditionally compiled trait methods). So long as the methods had a default implementation then it would be quite usable I think. |
The said issue is solved for 0.31, adding subpar solution for that into 0.30 is not appealing to me. In general IDETs/vtable + as_any solves that really good, but you need to go hard on traits, as long as you still have |
Winit is moving towards trait based end user application structure, thus add a simple `ApplicationHandler` trait which follows the `Event<T>`. To make use of this trait the new `run_app` group of APIs were added with the old `run` APIs being deprecated. Part-of: #3432
Winit is moving towards trait based end user application structure, thus add a simple `ApplicationHandler` trait which follows the `Event<T>`. To make use of this trait the new `run_app` group of APIs were added with the old `run` APIs being deprecated. Part-of: #3432
Winit is moving towards trait based end user application structure, thus add a simple `ApplicationHandler` trait which follows the `Event<T>`. To make use of this trait the new `run_app` group of APIs were added with the old `run` APIs being deprecated. Part-of: #3432
Winit is moving towards trait based end user application structure, thus add a simple `ApplicationHandler` trait which follows the `Event<T>`. To make use of this trait the new `run_app` group of APIs were added with the old `run` APIs being deprecated. Part-of: #3432
Winit is moving towards trait based end user application structure, thus add a simple `ApplicationHandler` trait which follows the `Event<T>`. To make use of this trait the new `run_app` group of APIs were added with the old `run` APIs being deprecated. Part-of: #3432
Add a simple `ApplicationHandler` trait since winit is moving towards trait based API. Add `run_app` group of APIs to accept `&mut impl ApplicationHandler` deprecating the old `run` APIs. Part-of: #3432
Add a simple `ApplicationHandler` trait since winit is moving towards trait based API. Add `run_app` group of APIs to accept `&mut impl ApplicationHandler` deprecating the old `run` APIs. Part-of: #3432
Add a simple `ApplicationHandler` trait since winit is moving towards trait based API. Add `run_app` group of APIs to accept `&mut impl ApplicationHandler` deprecating the old `run` APIs. Part-of: #3432
Add a simple `ApplicationHandler` trait since winit is moving towards trait based API. Add `run_app` group of APIs to accept `&mut impl ApplicationHandler` deprecating the old `run` APIs. Part-of: #3432
As a downstream user of winit (glium), I want to file my opposition to the deprecation of the This causes overhead, as now you have to type out the parameters, and potentially also import the types. It makes it harder to use winit. If you want to ignore a certain event, you can hide it in a |
For feedback please post in #3626. That said, we have wrote quite a lot about the motivation to switch to traits, the simplest one is return values. |
I don't understand this argument, traits will be all with default impls, so you don't have to implement anything unless you want something, and once you want something, yes, you'd have to write the method down, but it's not really an issue. Every program should implement methods/traits it needs, so in the end of the day you'll have less code to compile and less methods. |
Part of #3367, opening to discuss separately.
Winit needs some way for the user to synchronously respond to events with a value.
Prominent examples include:
Back
button/KeyCode
on Android #2304 (requires saying that you've handled, otherwise you'll block everything)To do this, we propose allowing the user to implement a trait, where each method is a callback that will be called when a certain event happens. Roughly:
Feel free to update this code-block once we narrow down the actual API.
Identified problems to which we need some sort of solution:
egui-winit
son_window_event
.dbg!(event)
and similar logging that access all events.Implementation plan:
ApplicationHandler
, while still keeping theEvent
-based API around to ease transition. Initial work in Begin transition to a trait-based system #3386.ApplicationHandler
#3387.The text was updated successfully, but these errors were encountered: