From 4b6f4c2a15c7854bcf93b4b6a8ea20e10fb004f5 Mon Sep 17 00:00:00 2001 From: Sangjin Lee Date: Mon, 17 Apr 2017 16:04:02 +0900 Subject: [PATCH] tpl_wayland: add destory function for wl_display When this api was called, twe will be remove the event source from thread. Change-Id: Iadc162afaeea0b0ce6d083bbb8687a9181c4f191 --- src/tpl_wayland_egl_thread.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index e99d650..924b0bd 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -152,12 +152,28 @@ twe_thread_add_wl_display(twe_thread* thread, source->gfd.events = G_IO_IN | G_IO_ERR; source->gfd.revents = 0; + g_source_set_callback(&source->gsource, NULL, display, NULL); g_source_add_poll(&source->gsource, &source->gfd); g_source_attach(&source->gsource, g_main_loop_get_context(ctx->twe_loop)); g_source_unref(&source->gsource); } void +twe_thread_del_wl_display(twe_thread* thread, struct wl_display *display) +{ + twe_wl_disp_source *source; + + source = (twe_wl_disp_source *)g_main_context_find_source_by_user_data(g_main_loop_get_context(thread->ctx->twe_loop), display); + if (!source) { + printf("ERR: Cannot find wl_display:%d\n", display); + return; + } + + g_source_destroy(&source->gsource); + g_source_unref(&source->gsource); +} + +void twe_thread_add_wl_surface(twe_thread* thread, struct wl_surface *surface, tbm_surface_queue_h surface_queue) -- 2.7.4