wlt: toolkit: flush display after wl_display_dispatch_pending()
authorRan Benita <ran234@gmail.com>
Wed, 11 Sep 2013 16:05:32 +0000 (19:05 +0300)
committerDavid Herrmann <dh.herrmann@gmail.com>
Thu, 12 Sep 2013 11:04:51 +0000 (13:04 +0200)
wlterm doesn't work with current Wayland/Weston; the events are never
sent and the window doesn't come up. We need to flush the display, as
per wl_display_dispatch_pending(3):

    To proper integrate the wayland display fd into a main loop, the
    client should always call wl_display_dispatch_pending() and then
    wl_display_flush() prior to going back to sleep.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
src/wlt_toolkit.c

index f2a118f..ef036dd 100644 (file)
@@ -405,10 +405,13 @@ static void dp_dispatch(struct wlt_display *disp, bool nonblock)
        int ret;
 
        errno = 0;
-       if (nonblock)
+       if (nonblock) {
                ret = wl_display_dispatch_pending(disp->dp);
-       else
+               if (ret != -1)
+                       ret = wl_display_flush(disp->dp);
+       } else {
                ret = wl_display_dispatch(disp->dp);
+       }
 
        if (ret == -1) {
                log_error("error during wayland dispatch (%d): %m", errno);