From 27fa6c3310ce3ae7800b834ba107e8e80132c194 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Wed, 26 Sep 2012 21:38:00 +0200 Subject: [PATCH] wlt: toolkit: add wlt_window_get_eloop() helper This helper allows widgets to retrieve the eloop that is used by the window. Otherwise, we couldn't dispatch events there. No refcounting is needed as all widgets are destroyed before the window is destroyed. Other users need to perform ref-counting by themself. Signed-off-by: David Herrmann --- src/wlt_toolkit.c | 8 ++++++++ src/wlt_toolkit.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/wlt_toolkit.c b/src/wlt_toolkit.c index 04c0b0c..8d4ad62 100644 --- a/src/wlt_toolkit.c +++ b/src/wlt_toolkit.c @@ -1219,6 +1219,14 @@ void wlt_window_close(struct wlt_window *wnd) ev_eloop_register_idle_cb(wnd->disp->eloop, close_window, wnd); } +struct ev_eloop *wlt_window_get_eloop(struct wlt_window *wnd) +{ + if (!wnd) + return NULL; + + return wnd->disp->eloop; +} + void wlt_widget_destroy(struct wlt_widget *widget) { if (!widget) diff --git a/src/wlt_toolkit.h b/src/wlt_toolkit.h index ddaa8b0..eda4614 100644 --- a/src/wlt_toolkit.h +++ b/src/wlt_toolkit.h @@ -138,6 +138,7 @@ void wlt_window_set_cursor(struct wlt_window *wnd, unsigned int cursor); void wlt_window_set_close_cb(struct wlt_window *wnd, wlt_window_close_cb cb); void wlt_window_close(struct wlt_window *wnd); +struct ev_eloop *wlt_window_get_eloop(struct wlt_window *wnd); void wlt_widget_destroy(struct wlt_widget *widget); struct wlt_window *wlt_widget_get_window(struct wlt_widget *widget);