Properties are initialized on the correct devices only but on resume we'd just blindly apply the config from our device. Depending on the resume order, this would mean we'd apply a previously set config with a default config.
Example: * pointer device with keyboard subdevice * pointer device exports natural scrolling, keyboard device does not and remains at default (off) * client enables natural scrolling on the pointer device * VT switch away, VT switch back * pointer device gets enabled first, enables natural scrolling on the libinput device * keyboard device gets enabled second, resets to the default value Reported-by: Yuxuan Shui <yshu...@gmail.com> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Tested-by: Yuxuan Shui <yshu...@gmail.com> --- src/xf86libinput.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/xf86libinput.c b/src/xf86libinput.c index cb37dab..83ab75d 100644 --- a/src/xf86libinput.c +++ b/src/xf86libinput.c @@ -505,6 +505,9 @@ LibinputApplyConfigNaturalScroll(DeviceIntPtr dev, { InputInfoPtr pInfo = dev->public.devicePrivate; + if (!subdevice_has_capabilities(dev, CAP_POINTER)) + return; + if (libinput_device_config_scroll_has_natural_scroll(device) && libinput_device_config_scroll_set_natural_scroll_enabled(device, driver_data->options.natural_scrolling) != LIBINPUT_CONFIG_STATUS_SUCCESS) @@ -520,6 +523,9 @@ LibinputApplyConfigAccel(DeviceIntPtr dev, { InputInfoPtr pInfo = dev->public.devicePrivate; + if (!subdevice_has_capabilities(dev, CAP_POINTER)) + return; + if (libinput_device_config_accel_is_available(device) && libinput_device_config_accel_set_speed(device, driver_data->options.speed) != LIBINPUT_CONFIG_STATUS_SUCCESS) @@ -556,6 +562,9 @@ LibinputApplyConfigTap(DeviceIntPtr dev, { InputInfoPtr pInfo = dev->public.devicePrivate; + if (!subdevice_has_capabilities(dev, CAP_POINTER)) + return; + if (libinput_device_config_tap_get_finger_count(device) > 0 && libinput_device_config_tap_set_enabled(device, driver_data->options.tapping) != LIBINPUT_CONFIG_STATUS_SUCCESS) @@ -600,6 +609,9 @@ LibinputApplyConfigCalibration(DeviceIntPtr dev, { InputInfoPtr pInfo = dev->public.devicePrivate; + if (!subdevice_has_capabilities(dev, CAP_TOUCH|CAP_TABLET)) + return; + if (libinput_device_config_calibration_has_matrix(device) && libinput_device_config_calibration_set_matrix(device, driver_data->options.matrix) != LIBINPUT_CONFIG_STATUS_SUCCESS) @@ -620,6 +632,9 @@ LibinputApplyConfigLeftHanded(DeviceIntPtr dev, { InputInfoPtr pInfo = dev->public.devicePrivate; + if (!subdevice_has_capabilities(dev, CAP_POINTER|CAP_TABLET)) + return; + if (libinput_device_config_left_handed_is_available(device) && libinput_device_config_left_handed_set(device, driver_data->options.left_handed) != LIBINPUT_CONFIG_STATUS_SUCCESS) @@ -635,6 +650,9 @@ LibinputApplyConfigScrollMethod(DeviceIntPtr dev, { InputInfoPtr pInfo = dev->public.devicePrivate; + if (!subdevice_has_capabilities(dev, CAP_POINTER)) + return; + if (libinput_device_config_scroll_set_method(device, driver_data->options.scroll_method) != LIBINPUT_CONFIG_STATUS_SUCCESS) { const char *method; @@ -671,6 +689,9 @@ LibinputApplyConfigClickMethod(DeviceIntPtr dev, { InputInfoPtr pInfo = dev->public.devicePrivate; + if (!subdevice_has_capabilities(dev, CAP_POINTER)) + return; + if (libinput_device_config_click_set_method(device, driver_data->options.click_method) != LIBINPUT_CONFIG_STATUS_SUCCESS) { const char *method; @@ -696,6 +717,9 @@ LibinputApplyConfigMiddleEmulation(DeviceIntPtr dev, { InputInfoPtr pInfo = dev->public.devicePrivate; + if (!subdevice_has_capabilities(dev, CAP_POINTER)) + return; + if (libinput_device_config_middle_emulation_is_available(device) && libinput_device_config_middle_emulation_set_enabled(device, driver_data->options.middle_emulation) != LIBINPUT_CONFIG_STATUS_SUCCESS) @@ -711,6 +735,9 @@ LibinputApplyConfigDisableWhileTyping(DeviceIntPtr dev, { InputInfoPtr pInfo = dev->public.devicePrivate; + if (!subdevice_has_capabilities(dev, CAP_POINTER)) + return; + if (libinput_device_config_dwt_is_available(device) && libinput_device_config_dwt_set_enabled(device, driver_data->options.disable_while_typing) != LIBINPUT_CONFIG_STATUS_SUCCESS) @@ -726,6 +753,9 @@ LibinputApplyConfigRotation(DeviceIntPtr dev, { InputInfoPtr pInfo = dev->public.devicePrivate; + if (!subdevice_has_capabilities(dev, CAP_POINTER)) + return; + if (libinput_device_config_rotation_is_available(device) && libinput_device_config_rotation_set_angle(device, driver_data->options.rotation_angle) != LIBINPUT_CONFIG_STATUS_SUCCESS) xf86IDrvMsg(pInfo, X_ERROR, -- 2.14.3 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel