summaryrefslogtreecommitdiff
path: root/src/xf86libinput.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2018-05-23 08:14:23 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2018-05-23 08:14:23 +1000
commit20bb8d6b9f4375557472dad67b5f8dcf31be27d3 (patch)
tree5e6c82074c74ea9b7d78d9cac463274fc457a951 /src/xf86libinput.c
parent1e88664d958a000ac610ae9000459c461ba45bd8 (diff)
downloadxorg-driver-xf86-input-libinput-20bb8d6b9f4375557472dad67b5f8dcf31be27d3.tar.gz
Revert "Implement the custom acceleration curve options"
Custom pointer acceleration curves were reverted in libinput, so no point having this code here. This reverts commit d84e0035d12a9655c09a6e8c619b1144be42c90c. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/xf86libinput.c')
-rw-r--r--src/xf86libinput.c227
1 files changed, 2 insertions, 225 deletions
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 180907e..2e950cd 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -122,11 +122,6 @@ struct xf86libinput_tablet_tool {
struct libinput_tablet_tool *tool;
};
-struct curve_point {
- struct xorg_list node;
- float x, fx;
-} curve_point;
-
struct xf86libinput {
InputInfoPtr pInfo;
char *path;
@@ -178,8 +173,6 @@ struct xf86libinput {
struct ratio {
int x, y;
} area;
-
- struct xorg_list curve_points;
} options;
struct draglock draglock;
@@ -554,11 +547,6 @@ LibinputApplyConfigAccel(DeviceIntPtr dev,
case LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT:
profile = "flat";
break;
-#if HAVE_LIBINPUT_CUSTOM_ACCEL_CURVE
- case LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE:
- profile = "device-speed-curve";
- break;
-#endif
default:
profile = "unknown";
break;
@@ -775,30 +763,6 @@ LibinputApplyConfigRotation(DeviceIntPtr dev,
driver_data->options.rotation_angle);
}
-static void
-LibinputApplyConfigAccelCurvePoints(DeviceIntPtr dev,
- struct xf86libinput *driver_data,
- struct libinput_device *device)
-{
-#if HAVE_LIBINPUT_CUSTOM_ACCEL_CURVE
- struct curve_point *p;
-
- if (!subdevice_has_capabilities(dev, CAP_POINTER))
- return;
-
- if (!libinput_device_config_accel_is_available(device))
- return;
-
- if (libinput_device_config_accel_get_profile(device) !=
- LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE)
- return;
-
- xorg_list_for_each_entry(p, &driver_data->options.curve_points, node) {
- libinput_device_config_accel_set_curve_point(device, p->x, p->fx);
- }
-#endif
-}
-
static inline void
LibinputApplyConfig(DeviceIntPtr dev)
{
@@ -817,7 +781,6 @@ LibinputApplyConfig(DeviceIntPtr dev)
LibinputApplyConfigMiddleEmulation(dev, driver_data, device);
LibinputApplyConfigDisableWhileTyping(dev, driver_data, device);
LibinputApplyConfigRotation(dev, driver_data, device);
- LibinputApplyConfigAccelCurvePoints(dev, driver_data, device);
}
static int
@@ -2637,10 +2600,6 @@ xf86libinput_parse_accel_profile_option(InputInfoPtr pInfo,
profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
else if (strncasecmp(str, "flat", 4) == 0)
profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
-#if HAVE_LIBINPUT_CUSTOM_ACCEL_CURVE
- else if (strncasecmp(str, "device-speed-curve", 18) == 0)
- profile = LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE;
-#endif
else {
xf86IDrvMsg(pInfo, X_ERROR,
"Unknown accel profile '%s'. Using default.\n",
@@ -2758,57 +2717,6 @@ xf86libinput_parse_calibration_option(InputInfoPtr pInfo,
free(str);
}
-static inline void
-xf86libinput_parse_accel_curve_points_options(InputInfoPtr pInfo,
- struct libinput_device *device,
- struct xorg_list *points)
-{
-#if HAVE_LIBINPUT_CUSTOM_ACCEL_CURVE
- uint32_t supported;
- char *str, *s;
-
- xorg_list_init(points);
-
- if (!libinput_device_config_accel_is_available(device))
- return;
-
- supported = libinput_device_config_accel_get_profiles(device);
- if ((supported & LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE) == 0)
- return;
-
- str = xf86SetStrOption(pInfo->options, "AccelCurvePoints", NULL);
- if (!str)
- return;
-
- s = str;
- while (s) {
- char *token = strtok_r(s, " ", &s);
- struct curve_point *p;
- int nparsed;
-
- if (!token)
- break;
-
- p = calloc(1, sizeof(*p));
- if (!p)
- break;
-
- nparsed = sscanf(token, "%f:%f", &p->x, &p->fx);
- if (nparsed != 2) {
- xf86IDrvMsg(pInfo, X_ERROR,
- "Failed to parse curve points: %s\n", str);
- free(p);
- break;
- }
-
- xorg_list_append(&p->node, points);
- libinput_device_config_accel_set_curve_point(device, p->x, p->fx);
- }
-
- free(str);
-#endif
-}
-
static inline BOOL
xf86libinput_parse_lefthanded_option(InputInfoPtr pInfo,
struct libinput_device *device)
@@ -3180,8 +3088,6 @@ xf86libinput_parse_options(InputInfoPtr pInfo,
options->disable_while_typing = xf86libinput_parse_disablewhiletyping_option(pInfo, device);
options->rotation_angle = xf86libinput_parse_rotation_angle_option(pInfo, device);
xf86libinput_parse_calibration_option(pInfo, device, driver_data->options.matrix);
- xf86libinput_parse_accel_curve_points_options(pInfo, device,
- &driver_data->options.curve_points);
/* non-libinput options */
xf86libinput_parse_buttonmap_option(pInfo,
@@ -3658,7 +3564,6 @@ static Atom prop_draglock;
static Atom prop_horiz_scroll;
static Atom prop_pressurecurve;
static Atom prop_area_ratio;
-static Atom prop_accel_curve_points;
/* general properties */
static Atom prop_float;
@@ -3985,7 +3890,7 @@ LibinputSetPropertyAccelProfile(DeviceIntPtr dev,
BOOL* data;
uint32_t profiles = 0;
- if (val->format != 8 || val->size < 2 || val->size > 3 || val->type != XA_INTEGER)
+ if (val->format != 8 || val->size != 2 || val->type != XA_INTEGER)
return BadMatch;
data = (BOOL*)val->data;
@@ -3994,10 +3899,6 @@ LibinputSetPropertyAccelProfile(DeviceIntPtr dev,
profiles |= LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
if (data[1])
profiles |= LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
-#if HAVE_LIBINPUT_CUSTOM_ACCEL_CURVE
- if (val->size > 2 && data[2])
- profiles |= LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE;
-#endif
if (checkonly) {
uint32_t supported;
@@ -4563,64 +4464,6 @@ LibinputSetPropertyAreaRatio(DeviceIntPtr dev,
return Success;
}
-static inline int
-LibinputSetPropertyAccelCurvePoints(DeviceIntPtr dev,
- Atom atom,
- XIPropertyValuePtr val,
- BOOL checkonly)
-{
-#if HAVE_LIBINPUT_CUSTOM_ACCEL_CURVE
- InputInfoPtr pInfo = dev->public.devicePrivate;
- struct xf86libinput *driver_data = pInfo->private;
- struct libinput_device *device = driver_data->shared_device->device;
- float *vals;
-
- if (val->format != 32 || val->size % 2 != 0 || val->type != prop_float)
- return BadMatch;
-
- vals = val->data;
-
- if (val->size >= 128) /* 128 curve points is enough for everybody */
- return BadMatch;
-
- if (checkonly) {
- uint32_t supported;
-
- supported = libinput_device_config_accel_get_profiles(device);
- if ((supported & LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE) == 0)
- return BadMatch;
-
- for (size_t i = 0; i < val->size; i++) {
- if (vals[i] < 0.0)
- return BadValue;
- }
- } else {
- struct curve_point *p, *tmp;
-
- xorg_list_for_each_entry_safe(p, tmp,
- &driver_data->options.curve_points,
- node) {
- xorg_list_del(&p->node);
- free(p);
- }
- xorg_list_init(&driver_data->options.curve_points);
-
- for (size_t i = 0; i < val->size; i += 2) {
- p = calloc(1, sizeof(*p));
- if (!p)
- break;
-
- p->x = vals[i];
- p->fx = vals[i+1];
- xorg_list_append(&p->node,
- &driver_data->options.curve_points);
- }
- }
-
-#endif
- return Success;
-}
-
static int
LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
BOOL checkonly)
@@ -4677,8 +4520,6 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
rc = LibinputSetPropertyPressureCurve(dev, atom, val, checkonly);
else if (atom == prop_area_ratio)
rc = LibinputSetPropertyAreaRatio(dev, atom, val, checkonly);
- else if (atom == prop_accel_curve_points)
- rc = LibinputSetPropertyAccelCurvePoints(dev, atom, val, checkonly);
else if (atom == prop_device || atom == prop_product_id ||
atom == prop_tap_default ||
atom == prop_tap_drag_default ||
@@ -4917,7 +4758,7 @@ LibinputInitAccelProperty(DeviceIntPtr dev,
float speed = driver_data->options.speed;
uint32_t profile_mask;
enum libinput_config_accel_profile profile;
- BOOL profiles[3] = {FALSE};
+ BOOL profiles[2] = {FALSE};
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
@@ -4947,10 +4788,6 @@ LibinputInitAccelProperty(DeviceIntPtr dev,
profiles[0] = TRUE;
if (profile_mask & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE)
profiles[1] = TRUE;
-#if HAVE_LIBINPUT_CUSTOM_ACCEL_CURVE
- if (profile_mask & LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE)
- profiles[2] = TRUE;
-#endif
prop_accel_profiles_available = LibinputMakeProperty(dev,
LIBINPUT_PROP_ACCEL_PROFILES_AVAILABLE,
@@ -4970,11 +4807,6 @@ LibinputInitAccelProperty(DeviceIntPtr dev,
case LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT:
profiles[1] = TRUE;
break;
-#if HAVE_LIBINPUT_CUSTOM_ACCEL_CURVE
- case LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE:
- profiles[2] = TRUE;
- break;
-#endif
default:
break;
}
@@ -4997,11 +4829,6 @@ LibinputInitAccelProperty(DeviceIntPtr dev,
case LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT:
profiles[1] = TRUE;
break;
-#if HAVE_LIBINPUT_CUSTOM_ACCEL_CURVE
- case LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE:
- profiles[2] = TRUE;
- break;
-#endif
default:
break;
}
@@ -5605,55 +5432,6 @@ LibinputInitTabletAreaRatioProperty(DeviceIntPtr dev,
}
static void
-LibinputInitAccelCurvePointsProperty(DeviceIntPtr dev,
- struct xf86libinput *driver_data,
- struct libinput_device *device)
-{
-#if HAVE_LIBINPUT_CUSTOM_ACCEL_CURVE
- struct curve_point *p;
- uint32_t supported;
- float *data = NULL;
- int npoints, idx;
-
- if (!subdevice_has_capabilities(dev, CAP_POINTER))
- return;
-
- if (!libinput_device_config_accel_is_available(device))
- return;
-
- supported = libinput_device_config_accel_get_profiles(device);
- if ((supported & LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE) == 0)
- return;
-
- npoints = 0;
- xorg_list_for_each_entry(p, &driver_data->options.curve_points, node)
- npoints++;
-
- if (npoints > 0) {
- npoints = min(npoints, 128);
- data = alloca(npoints * 2 * sizeof *data);
- idx = 0;
- xorg_list_for_each_entry(p, &driver_data->options.curve_points, node) {
- data[idx++] = p->x;
- data[idx++] = p->fx;
-
- if (idx >= npoints)
- break;
-
- }
- }
-
- prop_accel_curve_points = LibinputMakeProperty(dev,
- LIBINPUT_PROP_ACCEL_CURVE_POINTS,
- prop_float, 32,
- npoints, data);
- if (!prop_accel_curve_points)
- return;
-
-#endif
-}
-
-static void
LibinputInitProperty(DeviceIntPtr dev)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
@@ -5711,5 +5489,4 @@ LibinputInitProperty(DeviceIntPtr dev)
LibinputInitHorizScrollProperty(dev, driver_data);
LibinputInitPressureCurveProperty(dev, driver_data);
LibinputInitTabletAreaRatioProperty(dev, driver_data);
- LibinputInitAccelCurvePointsProperty(dev, driver_data, device);
}