Move event loop into EventDispatcher.

This commit is contained in:
Jared Boone 2015-08-14 22:01:20 -07:00
parent d5ebb9ef1e
commit 49b91d9c5d

View File

@ -66,6 +66,20 @@ public:
};
}
void run() {
while(true) {
const auto events = wait();
dispatch(events);
}
}
private:
touch::Manager touch_manager;
ui::Widget* const top_widget;
ui::Painter& painter;
ui::Context& context;
uint32_t encoder_last = 0;
eventmask_t wait() {
return chEvtWaitAny(ALL_EVENTS);
}
@ -100,13 +114,6 @@ public:
}
}
private:
touch::Manager touch_manager;
ui::Widget* const top_widget;
ui::Painter& painter;
ui::Context& context;
uint32_t encoder_last = 0;
void handle_application_queue() {
while( !shared_memory.application_queue.is_empty() ) {
auto message = shared_memory.application_queue.pop();
@ -250,10 +257,7 @@ int main(void) {
m4_init(portapack::spi_flash::baseband, portapack::spi_flash::m4_text_ram_base);
while(true) {
const auto events = event_dispatcher.wait();
event_dispatcher.dispatch(events);
}
event_dispatcher.run();
return 0;
}