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

Rework backends as calloop event sources #103

Closed
elinorbgr opened this issue Sep 30, 2018 · 2 comments
Closed

Rework backends as calloop event sources #103

elinorbgr opened this issue Sep 30, 2018 · 2 comments

Comments

@elinorbgr
Copy link
Member

Backends (drm, udev, libinput, etc...) should be reworkable as calloop event sources allowing greater flexibility in general and possibly a smoother overall design.

The idea would be to follow this general pattern:

  • each backend generating events that need to be processed have a method with a prototype like:
    fn process_pending_events<F: FnMut(Event)>(&mut self, f: F) -> Result<...> { ... }
    that calls the provided closure on all pending events for this source, but does not block if no events are available
  • each backend also implements the calloop::EventSource trait, proxying to the above method, allowing them to be easily inserted into an event loop.

This may need some modifications in calloop to work properly, the initial blocking point I've met is that currently some callback methods provide arguments that are borrows, while currently calloop requires Event: 'static, and I've not yet found a way to relax this constraint.

@Drakulix
Copy link
Member

This is partly addressed by #116, as the backends do not rely on EventedRawFd anymore, but EventedFd instead.

@elinorbgr
Copy link
Member Author

closing in favor of #203

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

No branches or pull requests

2 participants