-int main(int argc, char **argv) {
- lognotice("WinMan ver. %s", WINMAN_VERSION_STRING);
+struct afb_instance *g_afb_instance;
+
+int afb_instance::init() {
+ if (!this->display->ok()) {
+ return -1;
+ }
+
+ return this->app.init();
+}
+
+int display_event_callback(sd_event_source *evs, int /*fd*/, uint32_t events,
+ void * /*data*/) {
+ if ((events & EPOLLHUP) != 0) {
+ logerror("The compositor hung up, dying now.");
+ delete g_afb_instance;
+ g_afb_instance = nullptr;
+ goto error;
+ }
+
+ if ((events & EPOLLIN) != 0u) {
+ if (g_afb_instance->app.dispatch_events() == -1) {
+ goto error;
+ }
+ }