|
|
|
|
@@ -166,6 +166,7 @@ struct xf86libinput {
|
|
|
|
|
unsigned char btnmap[MAX_BUTTONS + 1];
|
|
|
|
|
|
|
|
|
|
BOOL horiz_scrolling_enabled;
|
|
|
|
|
BOOL hires_scrolling_enabled;
|
|
|
|
|
|
|
|
|
|
float rotation_angle;
|
|
|
|
|
struct bezier_control_point pressurecurve[4];
|
|
|
|
|
@@ -264,7 +265,7 @@ xf86libinput_is_subdevice(InputInfoPtr pInfo)
|
|
|
|
|
char *source;
|
|
|
|
|
BOOL is_subdevice;
|
|
|
|
|
|
|
|
|
|
source = xf86SetStrOption(pInfo->options, "_source", "");
|
|
|
|
|
source = xf86CheckStrOption(pInfo->options, "_source", "");
|
|
|
|
|
is_subdevice = streq(source, "_driver/libinput");
|
|
|
|
|
free(source);
|
|
|
|
|
|
|
|
|
|
@@ -1660,21 +1661,22 @@ get_wheel_scroll_value(struct xf86libinput *driver_data,
|
|
|
|
|
enum libinput_pointer_axis axis)
|
|
|
|
|
{
|
|
|
|
|
#if HAVE_LIBINPUT_AXIS_VALUE_V120
|
|
|
|
|
return get_wheel_120_value(driver_data, event, axis);
|
|
|
|
|
#else
|
|
|
|
|
return guess_wheel_scroll_value(driver_data, event, axis);
|
|
|
|
|
if (driver_data->options.hires_scrolling_enabled)
|
|
|
|
|
return get_wheel_120_value(driver_data, event, axis);
|
|
|
|
|
#endif
|
|
|
|
|
return guess_wheel_scroll_value(driver_data, event, axis);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline double
|
|
|
|
|
get_finger_or_continuous_scroll_value(struct libinput_event_pointer *event,
|
|
|
|
|
get_finger_or_continuous_scroll_value(struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_event_pointer *event,
|
|
|
|
|
enum libinput_pointer_axis axis)
|
|
|
|
|
{
|
|
|
|
|
#if HAVE_LIBINPUT_AXIS_VALUE_V120
|
|
|
|
|
return libinput_event_pointer_get_scroll_value(event, axis);
|
|
|
|
|
#else
|
|
|
|
|
return libinput_event_pointer_get_axis_value(event, axis);
|
|
|
|
|
if (driver_data->options.hires_scrolling_enabled)
|
|
|
|
|
return libinput_event_pointer_get_scroll_value(event, axis);
|
|
|
|
|
#endif
|
|
|
|
|
return libinput_event_pointer_get_axis_value(event, axis);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
@@ -1703,7 +1705,10 @@ calculate_axis_value(struct xf86libinput *driver_data,
|
|
|
|
|
double dist = driver_data->options.scroll_pixel_distance;
|
|
|
|
|
assert(dist != 0.0);
|
|
|
|
|
|
|
|
|
|
value = get_finger_or_continuous_scroll_value(event, axis);
|
|
|
|
|
value = get_finger_or_continuous_scroll_value(driver_data,
|
|
|
|
|
event,
|
|
|
|
|
axis);
|
|
|
|
|
|
|
|
|
|
/* We need to scale this value into our scroll increment range
|
|
|
|
|
* because that one is constant for the lifetime of the
|
|
|
|
|
* device. The user may change the ScrollPixelDistance
|
|
|
|
|
@@ -2404,6 +2409,7 @@ xf86libinput_handle_event(struct libinput_event *event)
|
|
|
|
|
struct libinput_device *device;
|
|
|
|
|
enum libinput_event_type type;
|
|
|
|
|
InputInfoPtr pInfo;
|
|
|
|
|
struct xf86libinput *driver_data;
|
|
|
|
|
enum event_handling event_handling = EVENT_HANDLED;
|
|
|
|
|
|
|
|
|
|
type = libinput_event_get_type(event);
|
|
|
|
|
@@ -2414,6 +2420,8 @@ xf86libinput_handle_event(struct libinput_event *event)
|
|
|
|
|
if (!pInfo || !pInfo->dev->public.on)
|
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
|
|
driver_data = pInfo->private;
|
|
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
case LIBINPUT_EVENT_NONE:
|
|
|
|
|
case LIBINPUT_EVENT_DEVICE_ADDED:
|
|
|
|
|
@@ -2437,28 +2445,40 @@ xf86libinput_handle_event(struct libinput_event *event)
|
|
|
|
|
libinput_event_get_keyboard_event(event));
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_EVENT_POINTER_AXIS:
|
|
|
|
|
#if !HAVE_LIBINPUT_AXIS_VALUE_V120
|
|
|
|
|
/* ignore POINTER_AXIS where we have libinput 1.19 and higher */
|
|
|
|
|
#if HAVE_LIBINPUT_AXIS_VALUE_V120
|
|
|
|
|
/* ignore POINTER_AXIS where we have libinput 1.19 and
|
|
|
|
|
higher and high-resolution scroll is enabled */
|
|
|
|
|
if (driver_data->options.hires_scrolling_enabled)
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
xf86libinput_handle_axis(pInfo,
|
|
|
|
|
event,
|
|
|
|
|
libinput_event_pointer_get_axis_source(event));
|
|
|
|
|
#endif
|
|
|
|
|
libinput_event_pointer_get_axis_source(
|
|
|
|
|
libinput_event_get_pointer_event(event)
|
|
|
|
|
));
|
|
|
|
|
break;
|
|
|
|
|
#if HAVE_LIBINPUT_AXIS_VALUE_V120
|
|
|
|
|
case LIBINPUT_EVENT_POINTER_SCROLL_WHEEL:
|
|
|
|
|
xf86libinput_handle_axis(pInfo,
|
|
|
|
|
event,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL);
|
|
|
|
|
if (driver_data->options.hires_scrolling_enabled) {
|
|
|
|
|
xf86libinput_handle_axis(pInfo,
|
|
|
|
|
event,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_EVENT_POINTER_SCROLL_FINGER:
|
|
|
|
|
xf86libinput_handle_axis(pInfo,
|
|
|
|
|
event,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
|
|
|
|
|
if (driver_data->options.hires_scrolling_enabled) {
|
|
|
|
|
xf86libinput_handle_axis(pInfo,
|
|
|
|
|
event,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS:
|
|
|
|
|
xf86libinput_handle_axis(pInfo,
|
|
|
|
|
event,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS);
|
|
|
|
|
if (driver_data->options.hires_scrolling_enabled) {
|
|
|
|
|
xf86libinput_handle_axis(pInfo,
|
|
|
|
|
event,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
case LIBINPUT_EVENT_TOUCH_FRAME:
|
|
|
|
|
@@ -3196,6 +3216,15 @@ xf86libinput_parse_horiz_scroll_option(InputInfoPtr pInfo)
|
|
|
|
|
return xf86SetBoolOption(pInfo->options, "HorizontalScrolling", TRUE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline BOOL
|
|
|
|
|
xf86libinput_parse_hirescroll_option(InputInfoPtr pInfo,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
return xf86SetBoolOption(pInfo->options,
|
|
|
|
|
"HighResolutionWheelScrolling",
|
|
|
|
|
TRUE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline double
|
|
|
|
|
xf86libinput_parse_rotation_angle_option(InputInfoPtr pInfo,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
@@ -3358,6 +3387,7 @@ xf86libinput_parse_options(InputInfoPtr pInfo,
|
|
|
|
|
if (driver_data->capabilities & CAP_POINTER) {
|
|
|
|
|
xf86libinput_parse_draglock_option(pInfo, driver_data);
|
|
|
|
|
options->horiz_scrolling_enabled = xf86libinput_parse_horiz_scroll_option(pInfo);
|
|
|
|
|
options->hires_scrolling_enabled = xf86libinput_parse_hirescroll_option(pInfo, device);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xf86libinput_parse_pressurecurve_option(pInfo,
|
|
|
|
|
@@ -3641,7 +3671,7 @@ xf86libinput_pre_init(InputDriverPtr drv,
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We ref the device above, then remove it. It get's
|
|
|
|
|
/* We ref the device above, then remove it. It gets
|
|
|
|
|
re-added with the same path in DEVICE_ON, we hope
|
|
|
|
|
it doesn't change until then */
|
|
|
|
|
libinput_device_ref(device);
|
|
|
|
|
@@ -3835,6 +3865,7 @@ static Atom prop_draglock;
|
|
|
|
|
static Atom prop_horiz_scroll;
|
|
|
|
|
static Atom prop_pressurecurve;
|
|
|
|
|
static Atom prop_area_ratio;
|
|
|
|
|
static Atom prop_hires_scroll;
|
|
|
|
|
|
|
|
|
|
/* general properties */
|
|
|
|
|
static Atom prop_float;
|
|
|
|
|
@@ -4406,7 +4437,7 @@ LibinputSetPropertyScrollButtonLock(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
BOOL enabled;
|
|
|
|
|
|
|
|
|
|
if (val->format != 8 || val->type != XA_INTEGER || val->size != 1)
|
|
|
|
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
enabled = *(BOOL*)val->data;
|
|
|
|
|
@@ -4615,7 +4646,7 @@ LibinputSetPropertyHorizScroll(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
BOOL enabled;
|
|
|
|
|
|
|
|
|
|
if (val->format != 8 || val->type != XA_INTEGER || val->size != 1)
|
|
|
|
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
enabled = *(BOOL*)val->data;
|
|
|
|
|
@@ -4642,7 +4673,7 @@ LibinputSetPropertyScrollPixelDistance(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
uint32_t dist;
|
|
|
|
|
|
|
|
|
|
if (val->format != 32 || val->type != XA_CARDINAL || val->size != 1)
|
|
|
|
|
if (val->format != 32 || val->size != 1 || val->type != XA_CARDINAL)
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
dist = *(BOOL*)val->data;
|
|
|
|
|
@@ -4794,6 +4825,33 @@ LibinputSetPropertyAreaRatio(DeviceIntPtr dev,
|
|
|
|
|
return Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
LibinputSetPropertyHighResolutionScroll(DeviceIntPtr dev,
|
|
|
|
|
Atom atom,
|
|
|
|
|
XIPropertyValuePtr val,
|
|
|
|
|
BOOL checkonly)
|
|
|
|
|
{
|
|
|
|
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
BOOL enabled;
|
|
|
|
|
|
|
|
|
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
enabled = *(BOOL*)val->data;
|
|
|
|
|
if (checkonly) {
|
|
|
|
|
if (enabled != 0 && enabled != 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
} else {
|
|
|
|
|
driver_data->options.hires_scrolling_enabled = enabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|
|
|
|
BOOL checkonly)
|
|
|
|
|
@@ -4854,6 +4912,8 @@ 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_hires_scroll)
|
|
|
|
|
rc = LibinputSetPropertyHighResolutionScroll(dev, atom, val, checkonly);
|
|
|
|
|
else if (atom == prop_device || atom == prop_product_id ||
|
|
|
|
|
atom == prop_tap_default ||
|
|
|
|
|
atom == prop_tap_drag_default ||
|
|
|
|
|
@@ -5122,7 +5182,7 @@ LibinputInitAccelProperty(DeviceIntPtr dev,
|
|
|
|
|
|
|
|
|
|
if (profile_mask & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE)
|
|
|
|
|
profiles[0] = TRUE;
|
|
|
|
|
if (profile_mask & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE)
|
|
|
|
|
if (profile_mask & LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT)
|
|
|
|
|
profiles[1] = TRUE;
|
|
|
|
|
|
|
|
|
|
prop_accel_profiles_available = LibinputMakeProperty(dev,
|
|
|
|
|
@@ -5808,6 +5868,22 @@ LibinputInitTabletAreaRatioProperty(DeviceIntPtr dev,
|
|
|
|
|
2, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitHighResolutionScrollProperty(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
BOOL enabled = driver_data->options.hires_scrolling_enabled;
|
|
|
|
|
|
|
|
|
|
if ((driver_data->capabilities & CAP_POINTER) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
prop_hires_scroll = LibinputMakeProperty(dev,
|
|
|
|
|
LIBINPUT_PROP_HIRES_WHEEL_SCROLL_ENABLED,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
1, &enabled);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitProperty(DeviceIntPtr dev)
|
|
|
|
|
{
|
|
|
|
|
@@ -5867,4 +5943,5 @@ LibinputInitProperty(DeviceIntPtr dev)
|
|
|
|
|
LibinputInitScrollPixelDistanceProperty(dev, driver_data, device);
|
|
|
|
|
LibinputInitPressureCurveProperty(dev, driver_data);
|
|
|
|
|
LibinputInitTabletAreaRatioProperty(dev, driver_data);
|
|
|
|
|
LibinputInitHighResolutionScrollProperty(dev, driver_data, device);
|
|
|
|
|
}
|
|
|
|
|
|