summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2018-02-02 13:54:32 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2018-02-21 09:53:12 +1000
commit9d9f59fd4c5a57e4663b19c3cace6f78202c4689 (patch)
treea783ab409d453edfdde9ae6f03ac32f5ce7cd39a
parent73534814909b8b6f4fce8f44b412b2903397bdb0 (diff)
Apply the capabilities checks on subdevices when applying the config
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 <yshuiv7@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Yuxuan Shui <yshuiv7@gmail.com>
-rw-r--r--src/xf86libinput.c30
1 files changed, 30 insertions, 0 deletions
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,