This switches the kdrive code to use FD notification for input devices, rather than the block and wakeup handlers.
Signed-off-by: Keith Packard <kei...@keithp.com> --- hw/kdrive/src/kinput.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 4bb9315..da4f84a 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -153,7 +153,16 @@ KdNonBlockFd(int fd) } static void -KdAddFd(int fd) +KdNotifyFd(int fd, int ready, void *data) +{ + int i = (int) (intptr_t) data; + OsBlockSIGIO(); + (*kdInputFds[i].read)(fd, kdInputFds[i].closure); + OsReleaseSIGIO(); +} + +static void +KdAddFd(int fd, int i) { struct sigaction act; sigset_t set; @@ -162,6 +171,7 @@ KdAddFd(int fd) fcntl(fd, F_SETOWN, getpid()); KdNonBlockFd(fd); AddEnabledDevice(fd); + SetNotifyFd(fd, KdNotifyFd, X_NOTIFY_READ, (void *) (intptr_t) i); memset(&act, '\0', sizeof act); act.sa_handler = KdSigio; sigemptyset(&act.sa_mask); @@ -181,6 +191,7 @@ KdRemoveFd(int fd) kdnFds--; RemoveEnabledDevice(fd); + RemoveNotifyFd(fd); flags = fcntl(fd, F_GETFL); flags &= ~(FASYNC | NOBLOCK); fcntl(fd, F_SETFL, flags); @@ -202,9 +213,9 @@ KdRegisterFd(int fd, void (*read) (int fd, void *closure), void *closure) kdInputFds[kdNumInputFds].enable = 0; kdInputFds[kdNumInputFds].disable = 0; kdInputFds[kdNumInputFds].closure = closure; - kdNumInputFds++; if (kdInputEnabled) - KdAddFd(fd); + KdAddFd(fd, kdNumInputFds); + kdNumInputFds++; return TRUE; } @@ -1933,19 +1944,8 @@ KdBlockHandler(ScreenPtr pScreen, void *timeo, void *readmask) void KdWakeupHandler(ScreenPtr pScreen, unsigned long lresult, void *readmask) { - int result = (int) lresult; - fd_set *pReadmask = (fd_set *) readmask; - int i; KdPointerInfo *pi; - if (kdInputEnabled && result > 0) { - for (i = 0; i < kdNumInputFds; i++) - if (FD_ISSET(kdInputFds[i].fd, pReadmask)) { - OsBlockSIGIO(); - (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure); - OsReleaseSIGIO(); - } - } for (pi = kdPointers; pi; pi = pi->next) { if (pi->timeoutPending) { if ((long) (GetTimeInMillis() - pi->emulationTimeout) >= 0) { -- 2.6.1 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel