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

Forwarding dispatch implementation #1384

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Drakulix
Copy link
Member

@Drakulix Drakulix commented Apr 9, 2024

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 implement GlobalDispatch/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 new F 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 of D. E.g. the SeatHandler could run on a subset of D, allowing set_grab and other to be called inside of the window-management code, where you might not have access to all of D.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant