diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-06-15 22:07:31 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-06-16 02:33:13 +0200 |
| commit | 74109dec517245ec9215454226792d72ae0912b0 (patch) | |
| tree | 5137fed90b4164d5a5465b760d3224b03ec84a1b /src/mtouch.c | |
| parent | 268777ce14ca5903d0db7511570765b608b36870 (diff) | |
Control grabbing by parameter
Add a parameter to control whether the underlying device
should be grabbed or not. Default to yes.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/mtouch.c')
| -rw-r--r-- | src/mtouch.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mtouch.c b/src/mtouch.c index 959783a..db75b6f 100644 --- a/src/mtouch.c +++ b/src/mtouch.c | |||
| @@ -21,6 +21,8 @@ | |||
| 21 | 21 | ||
| 22 | #include "mtouch.h" | 22 | #include "mtouch.h" |
| 23 | 23 | ||
| 24 | static const int use_grab = 1; | ||
| 25 | |||
| 24 | int configure_mtouch(struct MTouch *mt, int fd) | 26 | int configure_mtouch(struct MTouch *mt, int fd) |
| 25 | { | 27 | { |
| 26 | int rc = read_capabilities(&mt->caps, fd); | 28 | int rc = read_capabilities(&mt->caps, fd); |
| @@ -32,22 +34,28 @@ int configure_mtouch(struct MTouch *mt, int fd) | |||
| 32 | 34 | ||
| 33 | int open_mtouch(struct MTouch *mt, int fd) | 35 | int open_mtouch(struct MTouch *mt, int fd) |
| 34 | { | 36 | { |
| 35 | int rc; | ||
| 36 | mtdev_init(&mt->dev, &mt->caps); | 37 | mtdev_init(&mt->dev, &mt->caps); |
| 37 | init_iobuf(&mt->buf); | 38 | init_iobuf(&mt->buf); |
| 38 | init_hwstate(&mt->hs, &mt->caps); | 39 | init_hwstate(&mt->hs, &mt->caps); |
| 39 | init_mtstate(&mt->prev_state); | 40 | init_mtstate(&mt->prev_state); |
| 40 | init_mtstate(&mt->state); | 41 | init_mtstate(&mt->state); |
| 41 | init_memory(&mt->mem); | 42 | init_memory(&mt->mem); |
| 42 | SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1)); | 43 | if (use_grab) { |
| 43 | return rc; | 44 | int rc; |
| 45 | SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1)); | ||
| 46 | return rc; | ||
| 47 | } | ||
| 48 | return 0; | ||
| 44 | } | 49 | } |
| 45 | 50 | ||
| 46 | int close_mtouch(struct MTouch *mt, int fd) | 51 | int close_mtouch(struct MTouch *mt, int fd) |
| 47 | { | 52 | { |
| 48 | int rc; | 53 | if (use_grab) { |
| 49 | SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)0)); | 54 | int rc; |
| 50 | return rc; | 55 | SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)0)); |
| 56 | } | ||
| 57 | mtdev_destroy(&mt->dev); | ||
| 58 | return 0; | ||
| 51 | } | 59 | } |
| 52 | 60 | ||
| 53 | int parse_event(struct MTouch *mt, const struct input_event *ev) | 61 | int parse_event(struct MTouch *mt, const struct input_event *ev) |
