X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=linux%2Fin_evdev.c;h=7866015212c45c64b89e377eb3a426c77a2fca5f;hb=8ced8d2b38431e23be1b26457110febbe10d14c7;hp=4e23677e0421333a58243a1d3fff16e0409b3257;hpb=782b026efc11a000491dbf0b8d9b417cafffdc25;p=libpicofe.git diff --git a/linux/in_evdev.c b/linux/in_evdev.c index 4e23677..7866015 100644 --- a/linux/in_evdev.c +++ b/linux/in_evdev.c @@ -317,6 +317,16 @@ static void in_evdev_set_blocking(void *drv_data, int y) perror("in_evdev: F_GETFL fcntl failed"); return; } + + if (flags & O_NONBLOCK) { + /* flush the event queue */ + struct input_event ev; + do { + ret = read(dev->fd, &ev, sizeof(ev)); + } + while (ret == sizeof(ev)); + } + if (y) flags &= ~O_NONBLOCK; else