diff options
Diffstat (limited to 'src/mtouch.c')
-rw-r--r-- | src/mtouch.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/mtouch.c b/src/mtouch.c index 2d05921..a74a1f6 100644 --- a/src/mtouch.c +++ b/src/mtouch.c @@ -14,9 +14,31 @@ int configure_mtouch(struct MTouch *mt, int fd) /******************************************************/ -int init_mtouch(struct MTouch *mt) +int open_mtouch(struct MTouch *mt, int fd) { + int rc; + if (mt->grabbed) + return 0; + SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1)); + if (rc < 0) { + xf86Msg(X_WARNING, "multitouch: cannot grab device\n"); + return rc; + } + mt->grabbed = 1; return 0; } /******************************************************/ + +void close_mtouch(struct MTouch *mt, int fd) +{ + int rc; + if (!mt->grabbed) + return 0; + SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)0)); + if (rc < 0) + xf86Msg(X_WARNING, "multitouch: cannot ungrab device\n"); + mt->grabbed = 0; +} + +/******************************************************/ |