diff options
author | Peter Hutterer <peter.hutterer@redhat.com> | 2008-10-16 15:23:06 +1030 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@redhat.com> | 2008-10-17 11:18:39 +1030 |
commit | 4912e2aa7f867a86d383010023b8426c881fb3b0 (patch) | |
tree | ad79b0adf6d524ed26185f9f4922908bec5bb5d3 /src/evdev.c | |
parent | Don't post keycodes > 255. (diff) | |
download | xf86-input-evdev-4912e2aa7f867a86d383010023b8426c881fb3b0.tar.gz xf86-input-evdev-4912e2aa7f867a86d383010023b8426c881fb3b0.tar.bz2 xf86-input-evdev-4912e2aa7f867a86d383010023b8426c881fb3b0.zip |
Add option "GrabDevice", don't grab the device by default.
We now have the matching code in the server to set the console to RAW mode and
don't need to grab the devices anymore.
This is an updated version of e8534d47c8524ac081c2e3e6ebaabe4c6b274a18, which
was reverted in 6dc41991557fa55a9e2f5aaf0fe40c70a08d41fd.
Diffstat (limited to 'src/evdev.c')
-rw-r--r-- | src/evdev.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/evdev.c b/src/evdev.c index 865b451..1a664ac 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -979,7 +979,7 @@ EvdevOn(DeviceIntPtr device) pInfo = device->public.devicePrivate; pEvdev = pInfo->private; - if (pInfo->fd != -1 && !pEvdev->kernel24 && + if (pInfo->fd != -1 && pEvdev->grabDevice && (rc = ioctl(pInfo->fd, EVIOCGRAB, (void *)1))) { xf86Msg(X_WARNING, "%s: Grab failed (%s)\n", pInfo->name, @@ -1028,7 +1028,7 @@ EvdevProc(DeviceIntPtr device, int what) case DEVICE_OFF: if (pInfo->fd != -1) { - if (!pEvdev->kernel24 && ioctl(pInfo->fd, EVIOCGRAB, (void *)0)) + if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)0)) xf86Msg(X_WARNING, "%s: Release failed (%s)\n", pInfo->name, strerror(errno)); xf86RemoveEnabledDevice(pInfo); @@ -1177,17 +1177,19 @@ EvdevProbe(InputInfoPtr pInfo) long rel_bitmask[NBITS(REL_MAX)]; long abs_bitmask[NBITS(ABS_MAX)]; int i, has_axes, has_keys, num_buttons; + int kernel24 = 0; EvdevPtr pEvdev = pInfo->private; - if (ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) { + if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) { if (errno == EINVAL) { /* keyboards are unsafe in 2.4 */ - pEvdev->kernel24 = 1; + kernel24 = 1; + pEvdev->grabDevice = 0; } else { xf86Msg(X_ERROR, "Grab failed. Device already configured?\n"); return 1; } - } else { + } else if (pEvdev->grabDevice) { ioctl(pInfo->fd, EVIOCGRAB, (void *)0); } @@ -1263,7 +1265,7 @@ EvdevProbe(InputInfoPtr pInfo) } if (has_keys) { - if (pEvdev->kernel24) { + if (kernel24) { xf86Msg(X_INFO, "%s: Kernel < 2.6 is too old, ignoring keyboard\n", pInfo->name); } else { @@ -1348,6 +1350,11 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags) pEvdev->invert_x = xf86SetBoolOption(pInfo->options, "InvertX", FALSE); pEvdev->invert_y = xf86SetBoolOption(pInfo->options, "InvertY", FALSE); + /* Grabbing the event device stops in-kernel event forwarding. In other + words, it disables rfkill and the "Macintosh mouse button emulation". + Note that this needs a server that sets the console to RAW mode. */ + pEvdev->grabDevice = xf86CheckBoolOption(dev->commonOptions, "GrabDevice", 0); + pEvdev->noXkb = noXkbExtension; /* parse the XKB options during kbd setup */ EvdevInitButtonMapping(pInfo); |