summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2013-01-11 21:01:47 -0600
committerKristian Høgsberg <krh@bitplanet.net>2013-01-15 14:05:27 -0500
commit2423497b999c999528a7d2380a13fcb3e3412d0a (patch)
tree3428a59502eda4bbba3bd320bc856a0a41bd0d49 /src
parent31511d0ea08e9419bf6a3169ea196a551b4a94be (diff)
Add a destroy signal to the wl_event_loop object
Diffstat (limited to 'src')
-rw-r--r--src/event-loop.c21
-rw-r--r--src/wayland-server.h6
2 files changed, 27 insertions, 0 deletions
diff --git a/src/event-loop.c b/src/event-loop.c
index 8db9c7c..25e8f9c 100644
--- a/src/event-loop.c
+++ b/src/event-loop.c
@@ -43,6 +43,8 @@ struct wl_event_loop {
struct wl_list check_list;
struct wl_list idle_list;
struct wl_list destroy_list;
+
+ struct wl_signal destroy_signal;
};
struct wl_event_source_interface {
@@ -357,12 +359,16 @@ wl_event_loop_create(void)
wl_list_init(&loop->idle_list);
wl_list_init(&loop->destroy_list);
+ wl_signal_init(&loop->destroy_signal);
+
return loop;
}
WL_EXPORT void
wl_event_loop_destroy(struct wl_event_loop *loop)
{
+ wl_signal_emit(&loop->destroy_signal, loop);
+
wl_event_loop_process_destroy_list(loop);
close(loop->epoll_fd);
free(loop);
@@ -429,3 +435,18 @@ wl_event_loop_get_fd(struct wl_event_loop *loop)
{
return loop->epoll_fd;
}
+
+WL_EXPORT void
+wl_event_loop_add_destroy_listener(struct wl_event_loop *loop,
+ struct wl_listener *listener)
+{
+ wl_signal_add(&loop->destroy_signal, listener);
+}
+
+WL_EXPORT struct wl_listener *
+wl_event_loop_get_destroy_listener(struct wl_event_loop *loop,
+ wl_notify_func_t notify)
+{
+ wl_signal_get(&loop->destroy_signal, notify);
+}
+
diff --git a/src/wayland-server.h b/src/wayland-server.h
index 576304f..c7369eb 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -84,6 +84,12 @@ struct wl_touch;
struct wl_listener;
typedef void (*wl_notify_func_t)(struct wl_listener *listener, void *data);
+void wl_event_loop_add_destroy_listener(struct wl_event_loop *loop,
+ struct wl_listener * listener);
+struct wl_listener *wl_event_loop_get_destroy_listener(
+ struct wl_event_loop *loop,
+ wl_notify_func_t notify);
+
struct wl_display *wl_display_create(void);
void wl_display_destroy(struct wl_display *display);
struct wl_event_loop *wl_display_get_event_loop(struct wl_display *display);