diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-10 11:19:00 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-10 11:19:00 +0100 |
| commit | e833a9d2318625eb641cff2edca9b5ca56594ce5 (patch) | |
| tree | c5b132fa35dbca3a4cb610ed5d5b428c833afee4 /src/wayclock.cc | |
| parent | 6b82cee41f6d144ddb302f696806d3a4dfeee48a (diff) | |
adding handler method
Diffstat (limited to 'src/wayclock.cc')
| -rw-r--r-- | src/wayclock.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/wayclock.cc b/src/wayclock.cc index 32d7023..369657e 100644 --- a/src/wayclock.cc +++ b/src/wayclock.cc @@ -3,9 +3,19 @@ #define WAYC_APP_NAME "Wayclock" +void handle(struct eventloop_s *loop, struct event_s *event) { + switch (event->kind) { + case EVENT_KIND_CLOSE: + wayc_eventloop_unregister(loop, event->window->id); + break; + default: + break; + } +} + int main() { struct eventloop_s loop; - if (!wayc_eventloop_init(&loop)) + if (!wayc_eventloop_init(&loop, handle)) wayc_panic("Failed to initialize event loop"); struct window_s window; @@ -19,7 +29,6 @@ int main() { while (wayc_eventloop_running(&loop)) { wayc_eventloop_update(&loop); - wayc_eventloop_unregister(&loop, winid); } wayc_window_deinit(&window); |
