[kmscon-devel] [PATCH] wlt: toolkit: flush display after wl_display_dispatch_pending()
David Herrmann
dh.herrmann at gmail.com
Thu Sep 12 04:11:13 PDT 2013
Hi Ran
On Wed, Sep 11, 2013 at 6:05 PM, Ran Benita <ran234 at gmail.com> wrote:
> 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 at gmail.com>
> ---
> Hi David,
>
> I've used this locally for some time but forgot to send it. It works fine,
> but feel free to fix it however you prefer.
>
> Ran
Applied and pushed, thanks Ran!
I had this lying around here for quite some time. However, I tried
fixing it properly by changing the FD to non-blocking mode (see the
TODO marker). But that turned out to be more work than I expected and
I ditched it and forgot about it. I currently work on separating
libtsm, libtermcommon and wlterm from the kmscon repository. But the
GSoC-project and LPC/XDC presentations are more urgent right now. In
two weeks I'll be back from the US and I hope to finish this
separation then.
I also intend to move wlterm to GTK+-3. It saves me from all the
troubles of breaking wayland APIs.
Thanks
David
> src/wlt_toolkit.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/wlt_toolkit.c b/src/wlt_toolkit.c
> index f2a118f..ef036dd 100644
> --- a/src/wlt_toolkit.c
> +++ b/src/wlt_toolkit.c
> @@ -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);
> --
> 1.8.4
>
> _______________________________________________
> kmscon-devel mailing list
> kmscon-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/kmscon-devel
More information about the kmscon-devel
mailing list