Repository navigation
Conversation
Make EventLoopProvider dyn-compatible with a single owning run_app entry point and allow EventLoop to accept concrete or boxed providers. Expose optional pumping, on-demand, registration, never-return and file-descriptor capabilities. Preserve unsupported providers for fallback and expose backend-specific access through downcasting. Adapt built-in backends while retaining their generic convenience APIs. Support configurations without a built-in backend and cover dispatch, ownership and callback lifetimes with integration tests and CI.
richerfu
requested review from
MarijnS95,
daxpedda,
jackpot51,
kchibisov and
madsmtm
as code owners
November 6, 2026 02:22
kchibisov
requested changes
Nov 10, 2026
kchibisov
left a comment
Member
There was a problem hiding this comment.
Perhaps the main issue for external integration at this point is generic, which I understand why is getting removed, if it's getting removed, all should be gone together and moved to some dyn.
cc @ogoffart @timon-schelling this is maybe one of the last API changes I'd consider for 0.31 that maybe would be nice to merge, so would like to know what you think about proposed approach here and if it makes sense.
Switch EventLoop::run_app, EventLoop::from_backend, and the EventLoopExtPumpEvents, EventLoopExtRunOnDemand, EventLoopExtRegister, and EventLoopExtNeverReturn traits to accept dyn ApplicationHandler and dyn EventLoopProvider directly instead of duplicating generic traits. Implement HasDisplayHandle on dyn EventLoopProvider via rwh_06_handle, removing the cached OwnedDisplayHandle in EventLoop and allowing is_wayland/is_x11 to inspect DisplayHandle directly. Drop forwarding AsFd/AsRawFd and EventLoopExt* impls on EventLoop in favor of the explicit *_ext/into_* accessors, and simplify platform_impl creation. Replace the synthetic external_provider mock test with a custom_backend example and fold the --no-default-features test into the main CI matrix.
richerfu
force-pushed
the
feat/event-loop-provider
branch
from
November 11, 2026 02:17
93e8401 to
44f5312
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Winit currently selects its event loop from built-in backends, so an external
backend cannot use the
winit::EventLoopfacade. This addsfrom_backendandfrom_boxed_backendso backend crates can integrate without becoming Winitdependencies, including on targets with no built-in backend.
This follows the proposal to keep backends out of tree and share the necessary
types through
winit-core, discussed in#4684.
The provider trait becomes dyn-compatible through a single owning
run_appentry point.
EventLoopand concrete built-in backends retain their genericrun_app(app)methods. Optional capabilities cover event pumping, on-demandexecution, callback registration, never-return execution, and Unix file
descriptors. Unsupported owning conversions return the original provider so
callers can fall back without losing configuration. Backend access and
downcasting support platform-specific extensions.
Provider implementations must update
run_appto acceptself: Box<Self>andBox<dyn ApplicationHandler>, and implementinto_registerandinto_never_return(returningErr(self)when unsupported). Existing infallibleextension methods retain their signatures; callers selecting providers
dynamically should query the corresponding capability first.
Validation completed locally:
cargo test -p winit -p winit-core, including 19 provider integration testscovering dispatch, capability fallback, ownership, and callback lifetimes.
with warnings denied; nightly rustfmt, Taplo, and spelling checks.
Wayland, and no built-in backend), and OHOS with no built-in backend.
Runtime tests were run on macOS. Cross-target checks are compile-only; Redox
was not checked locally. CI adds a generic external-provider test on Ubuntu.
changelogmodule if knowledge of this change couldbe valuable to users
of platform-specific behavior
this functionality (usage is covered by rustdoc examples and integration
tests)