Forwarding dispatch implementation #1384
Draft
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.
Draft while I didn't even crate a wayland-rs PR for the required changed. See Drakulix/wayland-rs@62a7ec5.
Example for xdg-activation (semi random pick).
This allows forwarding Dispatch implementation, e.g. to handle internal locks.
As a side effect this requires almost the opposite direction of what #1327 tries to accomplish. So far it looks like we need
D
to implementGlobalDispatch
/Dispatch
for this to work, I haven't been able to get this to compile with @PolyMeilex patches without introduces heaps of new generics.For this to be usable we obviously need
delegate_dispatch!
/delegate_global_dispatch
to optionally handle the newF
parameter, which would get rid of at least one of the manual implementations in the example.I would additionally like to add a
forward_dispatch!
-macro to get rid of the other.Open for comments and further discussion. This would be very useful for cosmic-comp for a variety of reasons.
E.g. this enables internal locks for more fine-grained multi-threading (as can be seen in the example). This also allows to limit implementations of our
*Handler
-traits to parts ofD
. E.g. theSeatHandler
could run on a subset ofD
, allowingset_grab
and other to be called inside of the window-management code, where you might not have access to all ofD
.