wayland_egl: fix handle to the source of wayland 54/134754/3
authorSangjin Lee <lsj119@samsung.com>
Mon, 17 Apr 2017 05:47:11 +0000 (14:47 +0900)
committerjoonbum.ko <joonbum.ko@samsung.com>
Wed, 21 Jun 2017 07:04:24 +0000 (16:04 +0900)
Change-Id: I7c15966a2874d6fc7b3b3e88bad6a6a79ac41062

src/tpl_wayland_egl_thread.c

index d85a346..e99d650 100644 (file)
@@ -1,8 +1,10 @@
+#include <stdio.h>
 #include <stdlib.h>
 #include <glib.h>
 #include <wayland-client.h>
 
 #include <tpl.h>
+#include <wayland-tbm-client.h>
 
 typedef struct _twe_thread_context     twe_thread_context;
 typedef struct _twe_thread                     twe_thread;
@@ -83,13 +85,14 @@ _twe_thread_wl_disp_prepare(GSource *source, gint *time)
 {
        twe_wl_disp_source *wl_source = (twe_wl_disp_source *)source;
 
-       while (wl_display_prepare_read(wl_source->disp) != 0) {
-               wl_display_dispatch_pending(wl_source->disp);
+       while (wl_display_prepare_read_queue(wl_source->disp, wl_source->ev_queue) != 0) {
+               wl_display_dispatch_queue_pending(wl_source->disp, wl_source->ev_queue);
        }
 
        wl_display_flush(wl_source->disp);
+       *time = -1;
 
-       return TRUE;
+       return FALSE;
 }
 
 static gboolean
@@ -97,12 +100,14 @@ _twe_thread_wl_disp_check(GSource *source)
 {
        twe_wl_disp_source *wl_source = (twe_wl_disp_source *)source;
 
-       if (wl_source->gfd.revents)
+       if (wl_source->gfd.revents) {
                wl_display_read_events(wl_source->disp);
-       else
+               return TRUE;
+       } else {
                wl_display_cancel_read(wl_source->disp);
+       }
 
-       return TRUE;
+       return FALSE;
 }
 
 static gboolean
@@ -144,11 +149,12 @@ twe_thread_add_wl_display(twe_thread* thread,
        source->disp = display;
        source->ev_queue = ev_queue;
        source->gfd.fd = wl_display_get_fd(display);
-       source->gfd.events = G_IO_IN | G_IO_OUT | G_IO_ERR;
+       source->gfd.events = G_IO_IN | G_IO_ERR;
        source->gfd.revents = 0;
 
        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