|
|
|
|
@@ -52,6 +52,9 @@
|
|
|
|
|
#define TABLET_NUM_BUTTONS 7 /* we need scroll buttons */
|
|
|
|
|
#define TOUCH_MAX_SLOTS 15
|
|
|
|
|
#define XORG_KEYCODE_OFFSET 8
|
|
|
|
|
#define SCROLL_INCREMENT 15
|
|
|
|
|
#define TOUCHPAD_SCROLL_DIST_MIN 10 /* in libinput pixels */
|
|
|
|
|
#define TOUCHPAD_SCROLL_DIST_MAX 50 /* in libinput pixels */
|
|
|
|
|
|
|
|
|
|
#define streq(a, b) (strcmp(a, b) == 0)
|
|
|
|
|
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
|
|
|
|
|
@@ -75,6 +78,13 @@
|
|
|
|
|
#define CAP_TABLET 0x8
|
|
|
|
|
#define CAP_TABLET_TOOL 0x10
|
|
|
|
|
#define CAP_TABLET_PAD 0x20
|
|
|
|
|
#define CAP_GESTURE 0x40
|
|
|
|
|
|
|
|
|
|
#if HAVE_INPUTPROTO24
|
|
|
|
|
#if ABI_XINPUT_VERSION >= SET_ABI_VERSION(24, 4)
|
|
|
|
|
#define HAVE_GESTURES
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
struct xf86libinput_driver {
|
|
|
|
|
struct libinput *libinput;
|
|
|
|
|
@@ -146,6 +156,7 @@ struct xf86libinput {
|
|
|
|
|
CARD32 sendevents;
|
|
|
|
|
CARD32 scroll_button; /* xorg button number */
|
|
|
|
|
BOOL scroll_buttonlock;
|
|
|
|
|
uint32_t scroll_pixel_distance;
|
|
|
|
|
float speed;
|
|
|
|
|
float matrix[9];
|
|
|
|
|
enum libinput_config_scroll_method scroll_method;
|
|
|
|
|
@@ -155,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];
|
|
|
|
|
@@ -253,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);
|
|
|
|
|
|
|
|
|
|
@@ -1085,9 +1097,18 @@ xf86libinput_init_touch(InputInfoPtr pInfo)
|
|
|
|
|
if (ntouches == 0) /* unknown - mtdev */
|
|
|
|
|
ntouches = TOUCH_MAX_SLOTS;
|
|
|
|
|
InitTouchClassDeviceStruct(dev, ntouches, XIDirectTouch, 2);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GESTURES
|
|
|
|
|
static void
|
|
|
|
|
xf86libinput_init_gesture(InputInfoPtr pInfo)
|
|
|
|
|
{
|
|
|
|
|
DeviceIntPtr dev = pInfo->dev;
|
|
|
|
|
int ntouches = TOUCH_MAX_SLOTS;
|
|
|
|
|
InitGestureClassDeviceStruct(dev, ntouches);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
xf86libinput_init_tablet_pen_or_eraser(InputInfoPtr pInfo,
|
|
|
|
|
struct libinput_tablet_tool *tool)
|
|
|
|
|
@@ -1331,6 +1352,10 @@ xf86libinput_init(DeviceIntPtr dev)
|
|
|
|
|
}
|
|
|
|
|
if (driver_data->capabilities & CAP_TOUCH)
|
|
|
|
|
xf86libinput_init_touch(pInfo);
|
|
|
|
|
#ifdef HAVE_GESTURES
|
|
|
|
|
if (driver_data->capabilities & CAP_GESTURE)
|
|
|
|
|
xf86libinput_init_gesture(pInfo);
|
|
|
|
|
#endif
|
|
|
|
|
if (driver_data->capabilities & CAP_TABLET_TOOL)
|
|
|
|
|
xf86libinput_init_tablet(pInfo);
|
|
|
|
|
if (driver_data->capabilities & CAP_TABLET_PAD)
|
|
|
|
|
@@ -1543,9 +1568,9 @@ xf86libinput_handle_key(InputInfoPtr pInfo, struct libinput_event_keyboard *even
|
|
|
|
|
* so the use-case above shouldn't matter anymore.
|
|
|
|
|
*/
|
|
|
|
|
static inline double
|
|
|
|
|
get_wheel_scroll_value(struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_event_pointer *event,
|
|
|
|
|
enum libinput_pointer_axis axis)
|
|
|
|
|
guess_wheel_scroll_value(struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_event_pointer *event,
|
|
|
|
|
enum libinput_pointer_axis axis)
|
|
|
|
|
{
|
|
|
|
|
struct scroll_axis *s;
|
|
|
|
|
double f;
|
|
|
|
|
@@ -1605,23 +1630,95 @@ out:
|
|
|
|
|
return s->dist/s->fraction * discrete;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if HAVE_LIBINPUT_AXIS_VALUE_V120
|
|
|
|
|
static inline double
|
|
|
|
|
get_wheel_120_value(struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_event_pointer *event,
|
|
|
|
|
enum libinput_pointer_axis axis)
|
|
|
|
|
{
|
|
|
|
|
struct scroll_axis *s;
|
|
|
|
|
double angle;
|
|
|
|
|
|
|
|
|
|
switch (axis) {
|
|
|
|
|
case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
|
|
|
|
|
s = &driver_data->scroll.h;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
|
|
|
|
|
s = &driver_data->scroll.v;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return 0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
angle = libinput_event_pointer_get_scroll_value_v120(event, axis);
|
|
|
|
|
return s->dist * angle/120;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static inline double
|
|
|
|
|
get_wheel_scroll_value(struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_event_pointer *event,
|
|
|
|
|
enum libinput_pointer_axis axis)
|
|
|
|
|
{
|
|
|
|
|
#if HAVE_LIBINPUT_AXIS_VALUE_V120
|
|
|
|
|
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 xf86libinput *driver_data,
|
|
|
|
|
struct libinput_event_pointer *event,
|
|
|
|
|
enum libinput_pointer_axis axis)
|
|
|
|
|
{
|
|
|
|
|
#if HAVE_LIBINPUT_AXIS_VALUE_V120
|
|
|
|
|
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
|
|
|
|
|
calculate_axis_value(struct xf86libinput *driver_data,
|
|
|
|
|
enum libinput_pointer_axis axis,
|
|
|
|
|
struct libinput_event_pointer *event,
|
|
|
|
|
enum libinput_pointer_axis_source source,
|
|
|
|
|
double *value_out)
|
|
|
|
|
{
|
|
|
|
|
enum libinput_pointer_axis_source source;
|
|
|
|
|
double value;
|
|
|
|
|
|
|
|
|
|
if (!libinput_event_pointer_has_axis(event, axis))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
source = libinput_event_pointer_get_axis_source(event);
|
|
|
|
|
/* Event may be LIBINPUT_POINTER_AXIS or
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_SCROLL_{WHEEL|FINGER|CONTINUOUS}, depending
|
|
|
|
|
* on the libinput version.
|
|
|
|
|
*
|
|
|
|
|
* libinput guarantees the axis source is set for the second set of
|
|
|
|
|
* events too but we can switch to the event type once we ditch
|
|
|
|
|
* libinput < 1.19 support.
|
|
|
|
|
*/
|
|
|
|
|
if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL) {
|
|
|
|
|
value = get_wheel_scroll_value(driver_data, event, axis);
|
|
|
|
|
} else {
|
|
|
|
|
value = libinput_event_pointer_get_axis_value(event, axis);
|
|
|
|
|
double dist = driver_data->options.scroll_pixel_distance;
|
|
|
|
|
assert(dist != 0.0);
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
* though, so where we have a dist of 10 but an increment of
|
|
|
|
|
* 15, we need to scale from 0..10 into 0..15.
|
|
|
|
|
*
|
|
|
|
|
* We now switched to vdist of 120, so make this
|
|
|
|
|
* proportionate - 120/15 is 8.
|
|
|
|
|
*/
|
|
|
|
|
value = value/dist * SCROLL_INCREMENT * 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*value_out = value;
|
|
|
|
|
@@ -1630,32 +1727,26 @@ calculate_axis_value(struct xf86libinput *driver_data,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xf86libinput_handle_axis(InputInfoPtr pInfo, struct libinput_event_pointer *event)
|
|
|
|
|
xf86libinput_handle_axis(InputInfoPtr pInfo,
|
|
|
|
|
struct libinput_event *e,
|
|
|
|
|
enum libinput_pointer_axis_source source)
|
|
|
|
|
{
|
|
|
|
|
struct libinput_event_pointer *event;
|
|
|
|
|
DeviceIntPtr dev = pInfo->dev;
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
ValuatorMask *mask = driver_data->valuators;
|
|
|
|
|
double value;
|
|
|
|
|
enum libinput_pointer_axis_source source;
|
|
|
|
|
|
|
|
|
|
if ((driver_data->capabilities & CAP_POINTER) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
valuator_mask_zero(mask);
|
|
|
|
|
|
|
|
|
|
source = libinput_event_pointer_get_axis_source(event);
|
|
|
|
|
switch(source) {
|
|
|
|
|
case LIBINPUT_POINTER_AXIS_SOURCE_FINGER:
|
|
|
|
|
case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
|
|
|
|
|
case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event = libinput_event_get_pointer_event(e);
|
|
|
|
|
if (calculate_axis_value(driver_data,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
|
|
|
|
event,
|
|
|
|
|
source,
|
|
|
|
|
&value))
|
|
|
|
|
valuator_mask_set_double(mask, 3, value);
|
|
|
|
|
|
|
|
|
|
@@ -1665,9 +1756,15 @@ xf86libinput_handle_axis(InputInfoPtr pInfo, struct libinput_event_pointer *even
|
|
|
|
|
if (calculate_axis_value(driver_data,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
|
|
|
|
|
event,
|
|
|
|
|
source,
|
|
|
|
|
&value))
|
|
|
|
|
valuator_mask_set_double(mask, 2, value);
|
|
|
|
|
|
|
|
|
|
if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL &&
|
|
|
|
|
!valuator_mask_isset(mask, 2) &&
|
|
|
|
|
!valuator_mask_isset(mask, 3))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
xf86PostMotionEventM(dev, Relative, mask);
|
|
|
|
|
}
|
|
|
|
|
@@ -1723,6 +1820,86 @@ xf86libinput_handle_touch(InputInfoPtr pInfo,
|
|
|
|
|
xf86PostTouchEvent(dev, touchids[slot], type, 0, m);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GESTURES
|
|
|
|
|
static void
|
|
|
|
|
xf86libinput_handle_gesture_swipe(InputInfoPtr pInfo,
|
|
|
|
|
struct libinput_event_gesture *event,
|
|
|
|
|
enum libinput_event_type event_type)
|
|
|
|
|
{
|
|
|
|
|
DeviceIntPtr dev = pInfo->dev;
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
int type;
|
|
|
|
|
uint32_t flags = 0;
|
|
|
|
|
|
|
|
|
|
if ((driver_data->capabilities & CAP_GESTURE) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
switch (event_type) {
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN:
|
|
|
|
|
type = XI_GestureSwipeBegin;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE:
|
|
|
|
|
type = XI_GestureSwipeUpdate;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_SWIPE_END:
|
|
|
|
|
type = XI_GestureSwipeEnd;
|
|
|
|
|
if (libinput_event_gesture_get_cancelled(event))
|
|
|
|
|
flags |= XIGestureSwipeEventCancelled;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xf86PostGestureSwipeEvent(dev, type,
|
|
|
|
|
libinput_event_gesture_get_finger_count(event),
|
|
|
|
|
flags,
|
|
|
|
|
libinput_event_gesture_get_dx(event),
|
|
|
|
|
libinput_event_gesture_get_dy(event),
|
|
|
|
|
libinput_event_gesture_get_dx_unaccelerated(event),
|
|
|
|
|
libinput_event_gesture_get_dy_unaccelerated(event));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xf86libinput_handle_gesture_pinch(InputInfoPtr pInfo,
|
|
|
|
|
struct libinput_event_gesture *event,
|
|
|
|
|
enum libinput_event_type event_type)
|
|
|
|
|
{
|
|
|
|
|
DeviceIntPtr dev = pInfo->dev;
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
int type;
|
|
|
|
|
uint32_t flags = 0;
|
|
|
|
|
|
|
|
|
|
if ((driver_data->capabilities & CAP_GESTURE) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
switch (event_type) {
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN:
|
|
|
|
|
type = XI_GesturePinchBegin;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE:
|
|
|
|
|
type = XI_GesturePinchUpdate;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_PINCH_END:
|
|
|
|
|
type = XI_GesturePinchEnd;
|
|
|
|
|
if (libinput_event_gesture_get_cancelled(event))
|
|
|
|
|
flags |= XIGesturePinchEventCancelled;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xf86PostGesturePinchEvent(dev, type,
|
|
|
|
|
libinput_event_gesture_get_finger_count(event),
|
|
|
|
|
flags,
|
|
|
|
|
libinput_event_gesture_get_dx(event),
|
|
|
|
|
libinput_event_gesture_get_dy(event),
|
|
|
|
|
libinput_event_gesture_get_dx_unaccelerated(event),
|
|
|
|
|
libinput_event_gesture_get_dy_unaccelerated(event),
|
|
|
|
|
libinput_event_gesture_get_scale(event),
|
|
|
|
|
libinput_event_gesture_get_angle_delta(event));
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static InputInfoPtr
|
|
|
|
|
xf86libinput_pick_device(struct xf86libinput_device *shared_device,
|
|
|
|
|
struct libinput_event *event)
|
|
|
|
|
@@ -2232,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);
|
|
|
|
|
@@ -2242,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:
|
|
|
|
|
@@ -2265,9 +2445,42 @@ 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 and high-resolution scroll is enabled */
|
|
|
|
|
if (driver_data->options.hires_scrolling_enabled)
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
xf86libinput_handle_axis(pInfo,
|
|
|
|
|
libinput_event_get_pointer_event(event));
|
|
|
|
|
event,
|
|
|
|
|
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:
|
|
|
|
|
if (driver_data->options.hires_scrolling_enabled) {
|
|
|
|
|
xf86libinput_handle_axis(pInfo,
|
|
|
|
|
event,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_EVENT_POINTER_SCROLL_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:
|
|
|
|
|
if (driver_data->options.hires_scrolling_enabled) {
|
|
|
|
|
xf86libinput_handle_axis(pInfo,
|
|
|
|
|
event,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
case LIBINPUT_EVENT_TOUCH_FRAME:
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_EVENT_TOUCH_UP:
|
|
|
|
|
@@ -2281,9 +2494,20 @@ xf86libinput_handle_event(struct libinput_event *event)
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN:
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE:
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_SWIPE_END:
|
|
|
|
|
#ifdef HAVE_GESTURES
|
|
|
|
|
xf86libinput_handle_gesture_swipe(pInfo,
|
|
|
|
|
libinput_event_get_gesture_event(event),
|
|
|
|
|
type);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN:
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE:
|
|
|
|
|
case LIBINPUT_EVENT_GESTURE_PINCH_END:
|
|
|
|
|
#ifdef HAVE_GESTURES
|
|
|
|
|
xf86libinput_handle_gesture_pinch(pInfo,
|
|
|
|
|
libinput_event_get_gesture_event(event),
|
|
|
|
|
type);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_EVENT_TABLET_TOOL_AXIS:
|
|
|
|
|
event_handling = xf86libinput_handle_tablet_axis(pInfo,
|
|
|
|
|
@@ -2826,6 +3050,39 @@ xf86libinput_parse_scrollbuttonlock_option(InputInfoPtr pInfo,
|
|
|
|
|
return buttonlock;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
xf86libinput_want_scroll_distance_option(struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
uint32_t methods =
|
|
|
|
|
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN |
|
|
|
|
|
LIBINPUT_CONFIG_SCROLL_2FG |
|
|
|
|
|
LIBINPUT_CONFIG_SCROLL_EDGE;
|
|
|
|
|
|
|
|
|
|
if ((libinput_device_config_scroll_get_methods(device) & methods) == 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
|
xf86libinput_parse_scroll_pixel_distance_option(InputInfoPtr pInfo,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
uint32_t dflt = SCROLL_INCREMENT;
|
|
|
|
|
uint32_t dist;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_want_scroll_distance_option(device))
|
|
|
|
|
return dflt;
|
|
|
|
|
|
|
|
|
|
dist = xf86SetIntOption(pInfo->options, "ScrollPixelDistance", dflt);
|
|
|
|
|
if (dist < TOUCHPAD_SCROLL_DIST_MIN || dist > TOUCHPAD_SCROLL_DIST_MAX) {
|
|
|
|
|
xf86IDrvMsg(pInfo, X_ERROR,
|
|
|
|
|
"Invalid ScrollPixelDistance %d\n", dist);
|
|
|
|
|
dist = dflt;
|
|
|
|
|
}
|
|
|
|
|
return dist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned int
|
|
|
|
|
xf86libinput_parse_clickmethod_option(InputInfoPtr pInfo,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
@@ -2959,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)
|
|
|
|
|
@@ -3107,6 +3373,7 @@ xf86libinput_parse_options(InputInfoPtr pInfo,
|
|
|
|
|
options->scroll_method = xf86libinput_parse_scroll_option(pInfo, device);
|
|
|
|
|
options->scroll_button = xf86libinput_parse_scrollbutton_option(pInfo, device);
|
|
|
|
|
options->scroll_buttonlock = xf86libinput_parse_scrollbuttonlock_option(pInfo, device);
|
|
|
|
|
options->scroll_pixel_distance = xf86libinput_parse_scroll_pixel_distance_option(pInfo, device);
|
|
|
|
|
options->click_method = xf86libinput_parse_clickmethod_option(pInfo, device);
|
|
|
|
|
options->middle_emulation = xf86libinput_parse_middleemulation_option(pInfo, device);
|
|
|
|
|
options->disable_while_typing = xf86libinput_parse_disablewhiletyping_option(pInfo, device);
|
|
|
|
|
@@ -3120,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,
|
|
|
|
|
@@ -3247,6 +3515,10 @@ xf86libinput_create_subdevice(InputInfoPtr pInfo,
|
|
|
|
|
options = xf86ReplaceBoolOption(options, "_libinput/cap-pointer", 1);
|
|
|
|
|
if (capabilities & CAP_TOUCH)
|
|
|
|
|
options = xf86ReplaceBoolOption(options, "_libinput/cap-touch", 1);
|
|
|
|
|
#ifdef HAVE_GESTURES
|
|
|
|
|
if (capabilities & CAP_GESTURE)
|
|
|
|
|
options = xf86ReplaceBoolOption(options, "_libinput/cap-gesture", 1);
|
|
|
|
|
#endif
|
|
|
|
|
if (capabilities & CAP_TABLET_TOOL)
|
|
|
|
|
options = xf86ReplaceBoolOption(options, "_libinput/cap-tablet-tool", 1);
|
|
|
|
|
if (capabilities & CAP_TABLET_PAD)
|
|
|
|
|
@@ -3285,6 +3557,10 @@ caps_from_options(InputInfoPtr pInfo)
|
|
|
|
|
capabilities |= CAP_POINTER;
|
|
|
|
|
if (xf86CheckBoolOption(pInfo->options, "_libinput/cap-touch", 0))
|
|
|
|
|
capabilities |= CAP_TOUCH;
|
|
|
|
|
#ifdef HAVE_GESTURES
|
|
|
|
|
if (xf86CheckBoolOption(pInfo->options, "_libinput/cap-gesture", 0))
|
|
|
|
|
capabilities |= CAP_GESTURE;
|
|
|
|
|
#endif
|
|
|
|
|
if (xf86CheckBoolOption(pInfo->options, "_libinput/cap-tablet-tool", 0))
|
|
|
|
|
capabilities |= CAP_TABLET_TOOL;
|
|
|
|
|
|
|
|
|
|
@@ -3395,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);
|
|
|
|
|
@@ -3420,8 +3696,8 @@ xf86libinput_pre_init(InputDriverPtr drv,
|
|
|
|
|
* affect touchpad scroll speed. For wheels it doesn't matter as
|
|
|
|
|
* we're using the discrete value only.
|
|
|
|
|
*/
|
|
|
|
|
driver_data->scroll.v.dist = 15;
|
|
|
|
|
driver_data->scroll.h.dist = 15;
|
|
|
|
|
driver_data->scroll.v.dist = 120;
|
|
|
|
|
driver_data->scroll.h.dist = 120;
|
|
|
|
|
|
|
|
|
|
if (!is_subdevice) {
|
|
|
|
|
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER))
|
|
|
|
|
@@ -3430,6 +3706,10 @@ xf86libinput_pre_init(InputDriverPtr drv,
|
|
|
|
|
driver_data->capabilities |= CAP_KEYBOARD;
|
|
|
|
|
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH))
|
|
|
|
|
driver_data->capabilities |= CAP_TOUCH;
|
|
|
|
|
#ifdef HAVE_GESTURES
|
|
|
|
|
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_GESTURE))
|
|
|
|
|
driver_data->capabilities |= CAP_GESTURE;
|
|
|
|
|
#endif
|
|
|
|
|
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TABLET_TOOL))
|
|
|
|
|
driver_data->capabilities |= CAP_TABLET;
|
|
|
|
|
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TABLET_PAD))
|
|
|
|
|
@@ -3452,7 +3732,7 @@ xf86libinput_pre_init(InputDriverPtr drv,
|
|
|
|
|
* this device, create a separate device instead */
|
|
|
|
|
if (!is_subdevice &&
|
|
|
|
|
driver_data->capabilities & CAP_KEYBOARD &&
|
|
|
|
|
driver_data->capabilities & (CAP_POINTER|CAP_TOUCH)) {
|
|
|
|
|
driver_data->capabilities & (CAP_POINTER|CAP_TOUCH|CAP_GESTURE)) {
|
|
|
|
|
driver_data->capabilities &= ~CAP_KEYBOARD;
|
|
|
|
|
xf86libinput_create_subdevice(pInfo,
|
|
|
|
|
CAP_KEYBOARD,
|
|
|
|
|
@@ -3563,6 +3843,8 @@ static Atom prop_scroll_button;
|
|
|
|
|
static Atom prop_scroll_button_default;
|
|
|
|
|
static Atom prop_scroll_buttonlock;
|
|
|
|
|
static Atom prop_scroll_buttonlock_default;
|
|
|
|
|
static Atom prop_scroll_pixel_distance;
|
|
|
|
|
static Atom prop_scroll_pixel_distance_default;
|
|
|
|
|
static Atom prop_click_methods_available;
|
|
|
|
|
static Atom prop_click_method_enabled;
|
|
|
|
|
static Atom prop_click_method_default;
|
|
|
|
|
@@ -3583,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;
|
|
|
|
|
@@ -3684,7 +3967,7 @@ update_mode_prop(InputInfoPtr pInfo,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline BOOL
|
|
|
|
|
xf86libinput_check_device (DeviceIntPtr dev,
|
|
|
|
|
xf86libinput_check_device(DeviceIntPtr dev,
|
|
|
|
|
Atom atom)
|
|
|
|
|
{
|
|
|
|
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
|
|
|
@@ -3722,7 +4005,7 @@ LibinputSetPropertyTap(DeviceIntPtr dev,
|
|
|
|
|
if (*data != 0 && *data != 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_tap_get_finger_count(device) == 0)
|
|
|
|
|
@@ -3816,7 +4099,7 @@ LibinputSetPropertyTapButtonmap(DeviceIntPtr dev,
|
|
|
|
|
if ((data[0] && data[1]) || (!data[0] && !data[1]))
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3855,7 +4138,7 @@ LibinputSetPropertyCalibration(DeviceIntPtr dev,
|
|
|
|
|
data[8] != 1.0)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
if (!libinput_device_config_calibration_has_matrix(device))
|
|
|
|
|
@@ -3889,7 +4172,7 @@ LibinputSetPropertyAccel(DeviceIntPtr dev,
|
|
|
|
|
if (*data < -1.0 || *data > 1.0)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_accel_is_available(device) == 0)
|
|
|
|
|
@@ -3929,7 +4212,7 @@ LibinputSetPropertyAccelProfile(DeviceIntPtr dev,
|
|
|
|
|
if (__builtin_popcount(profiles) > 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
supported = libinput_device_config_accel_get_profiles(device);
|
|
|
|
|
@@ -3962,7 +4245,7 @@ LibinputSetPropertyNaturalScroll(DeviceIntPtr dev,
|
|
|
|
|
if (*data != 0 && *data != 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_scroll_has_natural_scroll(device) == 0)
|
|
|
|
|
@@ -3999,7 +4282,7 @@ LibinputSetPropertySendEvents(DeviceIntPtr dev,
|
|
|
|
|
if (checkonly) {
|
|
|
|
|
uint32_t supported;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
supported = libinput_device_config_send_events_get_modes(device);
|
|
|
|
|
@@ -4033,7 +4316,7 @@ LibinputSetPropertyLeftHanded(DeviceIntPtr dev,
|
|
|
|
|
int supported;
|
|
|
|
|
int left_handed = *data;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
supported = libinput_device_config_left_handed_is_available(device);
|
|
|
|
|
@@ -4097,7 +4380,7 @@ LibinputSetPropertyScrollMethods(DeviceIntPtr dev,
|
|
|
|
|
if (__builtin_popcount(modes) > 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
supported = libinput_device_config_scroll_get_methods(device);
|
|
|
|
|
@@ -4130,7 +4413,7 @@ LibinputSetPropertyScrollButton(DeviceIntPtr dev,
|
|
|
|
|
uint32_t button = *data;
|
|
|
|
|
uint32_t supported;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
supported = libinput_device_pointer_has_button(device,
|
|
|
|
|
@@ -4154,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;
|
|
|
|
|
@@ -4162,7 +4445,7 @@ LibinputSetPropertyScrollButtonLock(DeviceIntPtr dev,
|
|
|
|
|
if (enabled != 0 && enabled != 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
} else {
|
|
|
|
|
driver_data->options.scroll_buttonlock = enabled;
|
|
|
|
|
@@ -4363,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;
|
|
|
|
|
@@ -4371,7 +4654,7 @@ LibinputSetPropertyHorizScroll(DeviceIntPtr dev,
|
|
|
|
|
if (enabled != 0 && enabled != 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
} else {
|
|
|
|
|
driver_data->options.horiz_scrolling_enabled = enabled;
|
|
|
|
|
@@ -4380,6 +4663,34 @@ LibinputSetPropertyHorizScroll(DeviceIntPtr dev,
|
|
|
|
|
return Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
LibinputSetPropertyScrollPixelDistance(DeviceIntPtr dev,
|
|
|
|
|
Atom atom,
|
|
|
|
|
XIPropertyValuePtr val,
|
|
|
|
|
BOOL checkonly)
|
|
|
|
|
{
|
|
|
|
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
uint32_t dist;
|
|
|
|
|
|
|
|
|
|
if (val->format != 32 || val->size != 1 || val->type != XA_CARDINAL)
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
dist = *(BOOL*)val->data;
|
|
|
|
|
if (checkonly) {
|
|
|
|
|
if (dist < TOUCHPAD_SCROLL_DIST_MIN ||
|
|
|
|
|
dist > TOUCHPAD_SCROLL_DIST_MAX)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
} else {
|
|
|
|
|
driver_data->options.scroll_pixel_distance = dist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
LibinputSetPropertyRotationAngle(DeviceIntPtr dev,
|
|
|
|
|
Atom atom,
|
|
|
|
|
@@ -4400,7 +4711,7 @@ LibinputSetPropertyRotationAngle(DeviceIntPtr dev,
|
|
|
|
|
if (*angle < 0.0 || *angle >= 360.0)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_rotation_is_available(device) == 0)
|
|
|
|
|
@@ -4444,7 +4755,7 @@ LibinputSetPropertyPressureCurve(DeviceIntPtr dev,
|
|
|
|
|
return BadValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
if (!cubic_bezier(controls, test_bezier, ARRAY_SIZE(test_bezier)))
|
|
|
|
|
@@ -4484,7 +4795,7 @@ LibinputSetPropertyAreaRatio(DeviceIntPtr dev,
|
|
|
|
|
(area.x == 0 && area.y != 0))
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
} else {
|
|
|
|
|
struct xf86libinput *other;
|
|
|
|
|
@@ -4514,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)
|
|
|
|
|
@@ -4557,6 +4895,8 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|
|
|
|
rc = LibinputSetPropertyDragLockButtons(dev, atom, val, checkonly);
|
|
|
|
|
else if (atom == prop_horiz_scroll)
|
|
|
|
|
rc = LibinputSetPropertyHorizScroll(dev, atom, val, checkonly);
|
|
|
|
|
else if (atom == prop_scroll_pixel_distance)
|
|
|
|
|
rc = LibinputSetPropertyScrollPixelDistance(dev, atom, val, checkonly);
|
|
|
|
|
else if (atom == prop_mode_groups) {
|
|
|
|
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
@@ -4572,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 ||
|
|
|
|
|
@@ -4588,6 +4930,7 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|
|
|
|
atom == prop_scroll_methods_available ||
|
|
|
|
|
atom == prop_scroll_button_default ||
|
|
|
|
|
atom == prop_scroll_buttonlock_default ||
|
|
|
|
|
atom == prop_scroll_pixel_distance_default ||
|
|
|
|
|
atom == prop_click_method_default ||
|
|
|
|
|
atom == prop_click_methods_available ||
|
|
|
|
|
atom == prop_middle_emulation_default ||
|
|
|
|
|
@@ -4839,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,
|
|
|
|
|
@@ -5114,6 +5457,32 @@ LibinputInitScrollMethodsProperty(DeviceIntPtr dev,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitScrollPixelDistanceProperty(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
CARD32 dist = driver_data->options.scroll_pixel_distance;
|
|
|
|
|
|
|
|
|
|
if (!subdevice_has_capabilities(dev, CAP_POINTER))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_want_scroll_distance_option(device))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
prop_scroll_pixel_distance = LibinputMakeProperty(dev,
|
|
|
|
|
LIBINPUT_PROP_SCROLL_PIXEL_DISTANCE,
|
|
|
|
|
XA_CARDINAL, 32,
|
|
|
|
|
1, &dist);
|
|
|
|
|
if (!prop_scroll_pixel_distance)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
prop_scroll_pixel_distance_default = LibinputMakeProperty(dev,
|
|
|
|
|
LIBINPUT_PROP_SCROLL_PIXEL_DISTANCE_DEFAULT,
|
|
|
|
|
XA_CARDINAL, 32,
|
|
|
|
|
1, &dist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitClickMethodsProperty(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data,
|
|
|
|
|
@@ -5499,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)
|
|
|
|
|
{
|
|
|
|
|
@@ -5555,6 +5940,8 @@ LibinputInitProperty(DeviceIntPtr dev)
|
|
|
|
|
|
|
|
|
|
LibinputInitDragLockProperty(dev, driver_data);
|
|
|
|
|
LibinputInitHorizScrollProperty(dev, driver_data);
|
|
|
|
|
LibinputInitScrollPixelDistanceProperty(dev, driver_data, device);
|
|
|
|
|
LibinputInitPressureCurveProperty(dev, driver_data);
|
|
|
|
|
LibinputInitTabletAreaRatioProperty(dev, driver_data);
|
|
|
|
|
LibinputInitHighResolutionScrollProperty(dev, driver_data, device);
|
|
|
|
|
}
|
|
|
|
|
|