Commit 87f9fe3a authored by Peter Hutterer's avatar Peter Hutterer

Only initialize properties that match capabilities on a subdevice

If a device is split into multiple subdevices, usually pointer+keyboard, we
initialized properties matching the libinput device on both devices. This
results in the keyboard having e.g. a Accel Speed or Left Handed settings even
though it cannot send any events of that type.

Filter by capabilities on the subdevice so we only get those properties that
match the subdevice's capabilities.

https://bugs.freedesktop.org/show_bug.cgi?id=100900Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 0c657e0d
......@@ -5231,6 +5231,19 @@ LibinputInitTabletAreaRatioProperty(DeviceIntPtr dev,
2, data);
}
static inline bool
subdevice_filter_for_capabilities(DeviceIntPtr dev,
uint32_t capabilities)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
struct xf86libinput *driver_data = pInfo->private;
if (!xf86libinput_is_subdevice(pInfo))
return false;
return !(driver_data->capabilities & capabilities);
}
static void
LibinputInitProperty(DeviceIntPtr dev)
{
......@@ -5243,21 +5256,35 @@ LibinputInitProperty(DeviceIntPtr dev)
prop_float = XIGetKnownProperty("FLOAT");
LibinputInitTapProperty(dev, driver_data, device);
LibinputInitTapDragProperty(dev, driver_data, device);
LibinputInitTapDragLockProperty(dev, driver_data, device);
LibinputInitTapButtonmapProperty(dev, driver_data, device);
LibinputInitCalibrationProperty(dev, driver_data, device);
LibinputInitAccelProperty(dev, driver_data, device);
LibinputInitNaturalScrollProperty(dev, driver_data, device);
/* On a subdevice, we likely only have a keyboard, so filter out the
* properties for the capabilities we don't have */
if (!subdevice_filter_for_capabilities(dev, CAP_POINTER|CAP_TOUCH)) {
LibinputInitTapProperty(dev, driver_data, device);
LibinputInitTapDragProperty(dev, driver_data, device);
LibinputInitTapDragLockProperty(dev, driver_data, device);
LibinputInitTapButtonmapProperty(dev, driver_data, device);
LibinputInitNaturalScrollProperty(dev, driver_data, device);
}
if (!subdevice_filter_for_capabilities(dev, CAP_TOUCH|CAP_TABLET)) {
LibinputInitCalibrationProperty(dev, driver_data, device);
LibinputInitLeftHandedProperty(dev, driver_data, device);
LibinputInitAccelProperty(dev, driver_data, device);
}
if (!subdevice_filter_for_capabilities(dev, CAP_POINTER)) {
LibinputInitScrollMethodsProperty(dev, driver_data, device);
LibinputInitClickMethodsProperty(dev, driver_data, device);
LibinputInitMiddleEmulationProperty(dev, driver_data, device);
LibinputInitRotationAngleProperty(dev, driver_data, device);
}
if (!subdevice_filter_for_capabilities(dev, CAP_TABLET_PAD)) {
LibinputInitModeGroupProperties(dev, driver_data, device);
}
LibinputInitSendEventsProperty(dev, driver_data, device);
LibinputInitLeftHandedProperty(dev, driver_data, device);
LibinputInitScrollMethodsProperty(dev, driver_data, device);
LibinputInitClickMethodsProperty(dev, driver_data, device);
LibinputInitMiddleEmulationProperty(dev, driver_data, device);
LibinputInitDisableWhileTypingProperty(dev, driver_data, device);
LibinputInitModeGroupProperties(dev, driver_data, device);
LibinputInitRotationAngleProperty(dev, driver_data, device);
/* Device node property, read-only */
device_node = driver_data->path;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment