Skip to content
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

Example of migrating backends to ApplicationHandler #3387

Conversation

madsmtm
Copy link
Member

@madsmtm madsmtm commented Jan 12, 2024

See #3386.

I stubled into a roadblock for this, as there are several backends which are currently queuing events. This means they either need some sort of event structure themselves if we're to remove Event<T>, or will have to be rewritten to not queue events (preferred).

Backends that are currently queuing events: macOS, iOS, web, Windows, Wayland.

I can only speak for macOS and iOS, but I'm pretty sure those already prevent re-entrancy for most events, so migrating to handling events immediately will be the strictly better solution.

In any case, this PR showcases the migration of the Redox backend, so it should be technologically possible.

@madsmtm madsmtm mentioned this pull request Jan 12, 2024
@kchibisov
Copy link
Member

yeah, I can't write like that on Wayland at all until I change other API. The issue is that Window creation must be made async before I can do so, because I do dispatch events and I can get events during creation of the window for other windows.

@madsmtm
Copy link
Member Author

madsmtm commented Jan 13, 2024

Right, I missed the EventSink when I reviewed which backends are queuing events.

@madsmtm
Copy link
Member Author

madsmtm commented Jan 13, 2024

If it's not really feasible to rewrite the Wayland backend to utilize this trait until we do other work, then... Don't! Use the crate::event_helper::map_event approach like I've done for macOS currently.

I'm also only talking about removing the Event<T> from public API; it could stay in private APIs for backends that need it to queue certain events, until we slowly get rid of unnecessary queuing.

@kchibisov
Copy link
Member

@madsmtm I may dispatch events from the window creation, like I'd need to change entire window creation process to be async like I have on my branch.

@madsmtm madsmtm deleted the branch application-handler-transition May 27, 2024 08:55
@madsmtm madsmtm closed this May 27, 2024
@madsmtm madsmtm deleted the backend-migrate-application-handler-example branch May 27, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants