aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-06-15 22:07:31 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-06-16 02:33:13 +0200
commit74109dec517245ec9215454226792d72ae0912b0 (patch)
tree5137fed90b4164d5a5465b760d3224b03ec84a1b
parent268777ce14ca5903d0db7511570765b608b36870 (diff)
downloadxorg-input-kobomultitouch-74109dec517245ec9215454226792d72ae0912b0.tar.gz
xorg-input-kobomultitouch-74109dec517245ec9215454226792d72ae0912b0.tar.bz2
xorg-input-kobomultitouch-74109dec517245ec9215454226792d72ae0912b0.zip
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>
-rw-r--r--src/mtouch.c20
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 @@
#include "mtouch.h"
+static const int use_grab = 1;
+
int configure_mtouch(struct MTouch *mt, int fd)
{
int rc = read_capabilities(&mt->caps, fd);
@@ -32,22 +34,28 @@ int configure_mtouch(struct MTouch *mt, int fd)
int open_mtouch(struct MTouch *mt, int fd)
{
- int rc;
mtdev_init(&mt->dev, &mt->caps);
init_iobuf(&mt->buf);
init_hwstate(&mt->hs, &mt->caps);
init_mtstate(&mt->prev_state);
init_mtstate(&mt->state);
init_memory(&mt->mem);
- SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1));
- return rc;
+ if (use_grab) {
+ int rc;
+ SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1));
+ return rc;
+ }
+ return 0;
}
int close_mtouch(struct MTouch *mt, int fd)
{
- int rc;
- SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)0));
- return rc;
+ if (use_grab) {
+ int rc;
+ SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)0));
+ }
+ mtdev_destroy(&mt->dev);
+ return 0;
}
int parse_event(struct MTouch *mt, const struct input_event *ev)