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
appctx: New event loop usage #87
Conversation
The old model was hard to use and not very Rusty, so I decided to make it work a bit more like winit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes seem reasonable and the example works fine.
Some points:
- Add some text, telling you to draw would be cool. Got confused at first since nothing really happened (already had a blank screen though)
- Address clippy and rustfmt failing.
I'm personally fine with the way this works. @bkirwi, @fenollp any thoughts here?
Screenshot:
I've checked "allow edits by maintainers", feel free to make any changes you see fit. I think the rustfmt fail is because I use tabs instead of spaces - I'd rather leave the conversion to someone else, since I don't like spaces. |
Since there don't seem any additional comments from other maintainers, I'll just consider this change fine and merge it. |
I personally don't have strong feelings about the change. I don't love the callbacks in It's a bit awkward that libremarkable is a mix of low-level primitives for writing on the remarkable, plus some opinionated higher level stuff that many apps end up outgrowing. There may be more ways to tweak |
That's exactly what is happening except it's more difficult to set that stuff up without the appctx. appctx gives you events. Without it you have to start threads and stuff manually, so it's easier to just use appctx. You don't need to use anything except the event loop. |
Sure. For posterity, it's something like: let (input_tx, input_rx) = channel::<InputEvent>();
EvDevContext::new(InputDevice::GPIO, input_tx.clone()).start();
EvDevContext::new(InputDevice::Multitouch, input_tx.clone()).start();
EvDevContext::new(InputDevice::Wacom, input_tx).start();
while let Ok(event) = input_rx.recv() {
// ~whatever
} (And drop some of the input devices if you don't care about those events, of course.)
|
The old model was hard to use and not very Rusty, so I decided to make it work a bit more like winit.
Also comes with a new demo showcasing how easy it is to use the new event loop to build a simple program.