mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
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>
This commit is contained in:
13
src/evdev.c
13
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:
|
||||
|
||||
Reference in New Issue
Block a user