libinput polling
Stefanos A.
stapostol at gmail.com
Tue Jul 15 02:51:40 PDT 2014
Hello everyone,
I am trying out libinput as an input backend for OpenTK[1] when running on
a VT terminal. Using weston as a reference, I have managed to get keyboard
input working as expected. The API is pleasantly terse, with very little of
the X11/XI2 non-sense remaining.
There is one thing I haven't been able to manage so far is to implement a
blocking poll on the input thread. If my understanding is correct (and it
probably isn't), I should be able to call libinput_get_fd() and then poll
on that for events. However, if I do that, poll invariably returns an error
(-1):
int fd = libinput_get_fd(input_context);
struct poll_fd pfd = {
.fd = fd,
.events = POLLIN
};
while (!exit) {
int ret = poll(&pfd, 1, -1);
if (ret < 0) {
// ret is always -1
exit = ret;
}
else {
// never gets here
libinput_dispatch(input_context);
}
}
If I remove 'poll' then I can retrieve input events without any trouble.
Is what I am trying to do supported? If so, what could be the problem? Or,
if not, then is there a supported way to block on libinput events?
Cheers!
[1] http://www.opentk.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140715/bb3fca3e/attachment.html>
More information about the wayland-devel
mailing list