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) | |||
| 14 | 14 | ||
| 15 | /******************************************************/ | 15 | /******************************************************/ |
| 16 | 16 | ||
| 17 | int init_mtouch(struct MTouch *mt) | 17 | int open_mtouch(struct MTouch *mt, int fd) |
| 18 | { | 18 | { |
| 19 | int rc; | ||
| 20 | if (mt->grabbed) | ||
| 21 | return 0; | ||
| 22 | SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1)); | ||
| 23 | if (rc < 0) { | ||
| 24 | xf86Msg(X_WARNING, "multitouch: cannot grab device\n"); | ||
| 25 | return rc; | ||
| 26 | } | ||
| 27 | mt->grabbed = 1; | ||
| 19 | return 0; | 28 | return 0; |
| 20 | } | 29 | } |
| 21 | 30 | ||
| 22 | /******************************************************/ | 31 | /******************************************************/ |
| 32 | |||
| 33 | void close_mtouch(struct MTouch *mt, int fd) | ||
| 34 | { | ||
| 35 | int rc; | ||
| 36 | if (!mt->grabbed) | ||
| 37 | return 0; | ||
| 38 | SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)0)); | ||
| 39 | if (rc < 0) | ||
| 40 | xf86Msg(X_WARNING, "multitouch: cannot ungrab device\n"); | ||
| 41 | mt->grabbed = 0; | ||
| 42 | } | ||
| 43 | |||
| 44 | /******************************************************/ | ||
