diff options
-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: |