[PATCH v2 synaptics] Disable GrabEventDevice by default

Peter Hutterer peter.hutterer at who-t.net
Thu Mar 20 20:08:21 PDT 2014


This was required when we started supporting hotplugging to avoid duplicate
events. These days the drawback of not being able to record events in the case
of a bug is significant, possibly more so than whatever static
configurations are still out there. Let's see how much pain this causes.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
I thought about this some more and figured we might as well fix some of the
pain ahead of time. If there is a static InputDevice section for a synaptics
device, and AutoAddDevices is enabled (the default), just disabling
GrabEventDevice _will_ cause duplicate devices.

So here's a small but hopefully effective enough fix for that: only disable
the grab if the synaptics device itself is hotplugged. The config backend
(udev, hal, wscons) should make sure that we don't get the same device twice
anyway.

 src/synaptics.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 07fd450..f4c1d4a 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -576,6 +576,8 @@ set_default_parameters(InputInfoPtr pInfo)
     int width, height, diag, range;
     int horizHyst, vertHyst;
     int middle_button_timeout;
+    int grab_event_device = 0;
+    const char *source;
 
     /* The synaptics specs specify typical edge widths of 4% on x, and 5.4% on
      * y (page 7) [Synaptics TouchPad Interfacing Guide, 510-000080 - A
@@ -747,7 +749,16 @@ set_default_parameters(InputInfoPtr pInfo)
         xf86SetRealOption(opts, "PressureMotionMinFactor", 1.0);
     pars->press_motion_max_factor =
         xf86SetRealOption(opts, "PressureMotionMaxFactor", 1.0);
-    pars->grab_event_device = xf86SetBoolOption(opts, "GrabEventDevice", TRUE);
+
+    /* Only grab the device by default if it's not coming from a config
+       backend. This way we avoid the device being added twice and sending
+       duplicate events.
+      */
+    source = xf86CheckStrOption(opts, "_source", NULL);
+    if (source == NULL || strncmp(source, "server/", 7) != 0)
+        grab_event_device = TRUE;
+    pars->grab_event_device = xf86SetBoolOption(opts, "GrabEventDevice", grab_event_device);
+
     pars->tap_and_drag_gesture =
         xf86SetBoolOption(opts, "TapAndDragGesture", TRUE);
     pars->resolution_horiz =
-- 
1.8.5.3



More information about the xorg-devel mailing list