diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-05-19 14:55:32 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-05-28 09:24:28 +1000 |
commit | b27d03b248e36ec7a674113baa494b82e3ad728b (patch) | |
tree | c44f24794e475cde325b8a83a25fb4ce4c1bdba6 /src/evdev.c | |
parent | ba78428ed50685fd89ef4f35143a9b3f2b1ac0f6 (diff) |
Comment odd EVIOCGRAB behaviour and reshuffle conditions a bit.
The reason for this rather weird approach is to ungrab immediately after
getting a successful grab. Evdev shouldn't be hogging the device if nothing
is done with it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Diffstat (limited to 'src/evdev.c')
-rw-r--r-- | src/evdev.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/evdev.c b/src/evdev.c index 6f1a646..27c28cb 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1768,12 +1768,17 @@ EvdevProbe(InputInfoPtr pInfo) int ignore_abs = 0, ignore_rel = 0; EvdevPtr pEvdev = pInfo->private; - if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) { + /* If grabDevice is set, ungrab immediately since we only want to grab + * between DEVICE_ON and DEVICE_OFF. If we never get DEVICE_ON, don't + * hold a grab. */ + if (pEvdev->grabDevice) + { + if (ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) { xf86Msg(X_ERROR, "Grab failed. Device already configured?\n"); return 1; - } else if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)0)) { - xf86Msg(X_WARNING, "%s: Release failed (%s)\n", pInfo->name, - strerror(errno)); + } else if (ioctl(pInfo->fd, EVIOCGRAB, (void *)0)) + xf86Msg(X_WARNING, "%s: Release failed (%s)\n", pInfo->name, + strerror(errno)); } /* Trinary state for ignoring axes: |