summaryrefslogtreecommitdiff
path: root/src/wayclock.cc
diff options
context:
space:
mode:
authorFabrice <fabrice@schaub-dev.xyz>2026-02-10 11:19:00 +0100
committerFabrice <fabrice@schaub-dev.xyz>2026-02-10 11:19:00 +0100
commite833a9d2318625eb641cff2edca9b5ca56594ce5 (patch)
treec5b132fa35dbca3a4cb610ed5d5b428c833afee4 /src/wayclock.cc
parent6b82cee41f6d144ddb302f696806d3a4dfeee48a (diff)
adding handler method
Diffstat (limited to 'src/wayclock.cc')
-rw-r--r--src/wayclock.cc13
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);