[PATCH xinput] Increase interactiveness of test* output

Julien Cristau jcristau at debian.org
Tue Jul 2 10:25:30 PDT 2013


On Tue, Jul  2, 2013 at 18:13:53 +0100, Jon TURNEY wrote:

> On 20/08/2012 01:45, Peter Hutterer wrote:
> > From: Nikolai Kondrashov <spbnick-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>
> > 
> > Force line buffering for test and test_xi2 to increase interactiveness and
> > avoid losing data with non-terminal stdout. This fixes capturing xinput
> > test* output into a file.
> > 
> > Signed-off-by: Nikolai Kondrashov <spbnick-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>
> > Signed-off-by: Peter Hutterer <peter.hutterer-Pf4JEFdB4epeoWH0uzbU5w at public.gmane.org>
> > ---
> >  src/test.c     | 2 ++
> >  src/test_xi2.c | 2 ++
> >  2 files changed, 4 insertions(+)
> > 
> > diff --git a/src/test.c b/src/test.c
> > index 97305c5..0c95501 100644
> > --- a/src/test.c
> > +++ b/src/test.c
> > @@ -98,6 +98,8 @@ print_events(Display	*dpy)
> >  {
> >      XEvent        Event;
> >  
> > +    setlinebuf(stdout);
> 
> I think this just got pushed, but it seems break building xinput for MinGW
> (see [1])
> 
> It looks like using setvbuf() rather than setlinebuf() should be more
> portable.  Patch attached.
> 
Or call fflush(stdout) in every loop before sleeping in XNextEvent?

Cheers,
Julien


More information about the xorg-devel mailing list