diff --git a/examples/draw.c b/examples/draw.c index b91c667..4a052c6 100644 --- a/examples/draw.c +++ b/examples/draw.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +54,11 @@ void on_pointer_event(struct nvnc_client* client, uint16_t x, uint16_t y, pixman_region_fini(®ion); } +void on_sigint() +{ + aml_exit(aml_get_default()); +} + int main(int argc, char* argv[]) { struct draw draw; @@ -76,7 +82,13 @@ int main(int argc, char* argv[]) nvnc_set_pointer_fn(server, on_pointer_event); nvnc_set_userdata(server, &draw); + struct aml_signal* sig = aml_signal_new(SIGINT, on_sigint, NULL, NULL); + aml_start(aml_get_default(), sig); + aml_unref(sig); + aml_run(aml); nvnc_close(server); + nvnc_fb_unref(draw.fb); + aml_unref(aml); } diff --git a/examples/png-server.c b/examples/png-server.c index c113022..6efaeb9 100644 --- a/examples/png-server.c +++ b/examples/png-server.c @@ -18,11 +18,17 @@ #include #include +#include #include #include struct nvnc_fb* read_png_file(const char* filename); +void on_sigint() +{ + aml_exit(aml_get_default()); +} + int main(int argc, char* argv[]) { const char* file = argv[1]; @@ -56,8 +62,13 @@ int main(int argc, char* argv[]) nvnc_feed_frame(server, fb, ®ion); pixman_region_fini(®ion); + struct aml_signal* sig = aml_signal_new(SIGINT, on_sigint, NULL, NULL); + aml_start(aml_get_default(), sig); + aml_unref(sig); + aml_run(aml); nvnc_close(server); nvnc_fb_unref(fb); + aml_unref(aml); }