tpl_wayland: add destory function for wl_display 55/134755/3
authorSangjin Lee <lsj119@samsung.com>
Mon, 17 Apr 2017 07:04:02 +0000 (16:04 +0900)
committerjoonbum.ko <joonbum.ko@samsung.com>
Wed, 21 Jun 2017 07:04:24 +0000 (16:04 +0900)
When this api was called, twe will be remove the event source from thread.

Change-Id: Iadc162afaeea0b0ce6d083bbb8687a9181c4f191

src/tpl_wayland_egl_thread.c

index e99d650..924b0bd 100644 (file)
@@ -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)