|
|
|
|
@@ -94,6 +94,7 @@ struct xf86libinput {
|
|
|
|
|
float speed;
|
|
|
|
|
float matrix[9];
|
|
|
|
|
enum libinput_config_scroll_method scroll_method;
|
|
|
|
|
enum libinput_config_click_method click_method;
|
|
|
|
|
} options;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -259,7 +260,8 @@ LibinputApplyConfig(DeviceIntPtr dev)
|
|
|
|
|
driver_data->options.matrix[6], driver_data->options.matrix[7],
|
|
|
|
|
driver_data->options.matrix[8]);
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_left_handed_set(device,
|
|
|
|
|
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)
|
|
|
|
|
xf86IDrvMsg(pInfo, X_ERROR,
|
|
|
|
|
"Failed to set LeftHanded to %d\n",
|
|
|
|
|
@@ -283,11 +285,30 @@ LibinputApplyConfig(DeviceIntPtr dev)
|
|
|
|
|
method);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scroll_button = btn_xorg2linux(driver_data->options.scroll_button);
|
|
|
|
|
if (libinput_device_config_scroll_set_button(device, scroll_button) != LIBINPUT_CONFIG_STATUS_SUCCESS)
|
|
|
|
|
if (libinput_device_config_scroll_get_methods(device) & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) {
|
|
|
|
|
scroll_button = btn_xorg2linux(driver_data->options.scroll_button);
|
|
|
|
|
if (libinput_device_config_scroll_set_button(device, scroll_button) != LIBINPUT_CONFIG_STATUS_SUCCESS)
|
|
|
|
|
xf86IDrvMsg(pInfo, X_ERROR,
|
|
|
|
|
"Failed to set ScrollButton to %d\n",
|
|
|
|
|
driver_data->options.scroll_button);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_click_set_method(device,
|
|
|
|
|
driver_data->options.click_method) != LIBINPUT_CONFIG_STATUS_SUCCESS) {
|
|
|
|
|
const char *method;
|
|
|
|
|
|
|
|
|
|
switch (driver_data->options.click_method) {
|
|
|
|
|
case LIBINPUT_CONFIG_CLICK_METHOD_NONE: method = "none"; break;
|
|
|
|
|
case LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS: method = "buttonareas"; break;
|
|
|
|
|
case LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER: method = "clickfinger"; break;
|
|
|
|
|
default:
|
|
|
|
|
method = "unknown"; break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xf86IDrvMsg(pInfo, X_ERROR,
|
|
|
|
|
"Failed to set ScrollButton to %d\n",
|
|
|
|
|
driver_data->options.scroll_button);
|
|
|
|
|
"Failed to set click method to %s\n",
|
|
|
|
|
method);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
@@ -326,6 +347,8 @@ xf86libinput_on(DeviceIntPtr dev)
|
|
|
|
|
driver_context.device_enabled_count++;
|
|
|
|
|
dev->public.on = TRUE;
|
|
|
|
|
|
|
|
|
|
LibinputApplyConfig(dev);
|
|
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -367,7 +390,7 @@ init_button_map(unsigned char *btnmap, size_t size)
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
memset(btnmap, 0, size);
|
|
|
|
|
for (i = 0; i <= size; i++)
|
|
|
|
|
for (i = 0; i < size; i++)
|
|
|
|
|
btnmap[i] = i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -414,7 +437,7 @@ xf86libinput_init_pointer(InputInfoPtr pInfo)
|
|
|
|
|
Atom axislabels[TOUCHPAD_NUM_AXES];
|
|
|
|
|
|
|
|
|
|
for (i = BTN_BACK; i >= BTN_SIDE; i--) {
|
|
|
|
|
if (libinput_device_has_button(driver_data->device, i)) {
|
|
|
|
|
if (libinput_device_pointer_has_button(driver_data->device, i)) {
|
|
|
|
|
nbuttons += i - BTN_SIDE + 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -462,7 +485,7 @@ xf86libinput_init_pointer_absolute(InputInfoPtr pInfo)
|
|
|
|
|
Atom axislabels[TOUCHPAD_NUM_AXES];
|
|
|
|
|
|
|
|
|
|
for (i = BTN_BACK; i >= BTN_SIDE; i--) {
|
|
|
|
|
if (libinput_device_has_button(driver_data->device, i)) {
|
|
|
|
|
if (libinput_device_pointer_has_button(driver_data->device, i)) {
|
|
|
|
|
nbuttons += i - BTN_SIDE + 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -609,13 +632,14 @@ xf86libinput_init(DeviceIntPtr dev)
|
|
|
|
|
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH))
|
|
|
|
|
xf86libinput_init_touch(pInfo);
|
|
|
|
|
|
|
|
|
|
LibinputApplyConfig(dev);
|
|
|
|
|
LibinputInitProperty(dev);
|
|
|
|
|
XIRegisterPropertyHandler(dev, LibinputSetProperty, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
/* unref the device now, because we'll get a new ref during
|
|
|
|
|
DEVICE_ON */
|
|
|
|
|
libinput_device_unref(device);
|
|
|
|
|
|
|
|
|
|
LibinputInitProperty(dev);
|
|
|
|
|
XIRegisterPropertyHandler(dev, LibinputSetProperty, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -732,18 +756,22 @@ xf86libinput_handle_axis(InputInfoPtr pInfo, struct libinput_event_pointer *even
|
|
|
|
|
|
|
|
|
|
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
|
|
|
|
|
if (libinput_event_pointer_has_axis(event, axis)) {
|
|
|
|
|
if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL)
|
|
|
|
|
if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL) {
|
|
|
|
|
value = libinput_event_pointer_get_axis_value_discrete(event, axis);
|
|
|
|
|
else
|
|
|
|
|
value *= driver_data->scroll_vdist;
|
|
|
|
|
} else {
|
|
|
|
|
value = libinput_event_pointer_get_axis_value(event, axis);
|
|
|
|
|
}
|
|
|
|
|
valuator_mask_set_double(mask, 3, value);
|
|
|
|
|
}
|
|
|
|
|
axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
|
|
|
|
|
if (libinput_event_pointer_has_axis(event, axis)) {
|
|
|
|
|
if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL)
|
|
|
|
|
if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL) {
|
|
|
|
|
value = libinput_event_pointer_get_axis_value_discrete(event, axis);
|
|
|
|
|
else
|
|
|
|
|
value *= driver_data->scroll_hdist;
|
|
|
|
|
} else {
|
|
|
|
|
value = libinput_event_pointer_get_axis_value(event, axis);
|
|
|
|
|
}
|
|
|
|
|
valuator_mask_set_double(mask, 2, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -943,6 +971,7 @@ xf86libinput_parse_options(InputInfoPtr pInfo,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
uint32_t scroll_methods;
|
|
|
|
|
uint32_t click_methods;
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_tap_get_finger_count(device) > 0) {
|
|
|
|
|
BOOL tap = xf86SetBoolOption(pInfo->options,
|
|
|
|
|
@@ -1113,16 +1142,42 @@ xf86libinput_parse_options(InputInfoPtr pInfo,
|
|
|
|
|
driver_data->options.scroll_button = scroll_button;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
click_methods = libinput_device_config_click_get_methods(device);
|
|
|
|
|
if (click_methods != LIBINPUT_CONFIG_CLICK_METHOD_NONE) {
|
|
|
|
|
enum libinput_config_click_method m;
|
|
|
|
|
char *method = xf86SetStrOption(pInfo->options,
|
|
|
|
|
"ClickMethod",
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
if (!method)
|
|
|
|
|
m = libinput_device_config_click_get_method(device);
|
|
|
|
|
else if (strncasecmp(method, "buttonareas", 11) == 0)
|
|
|
|
|
m = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
|
|
|
|
else if (strncasecmp(method, "clickfinger", 11) == 0)
|
|
|
|
|
m = LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
|
|
|
|
|
else if (strncasecmp(method, "none", 4) == 0)
|
|
|
|
|
m = LIBINPUT_CONFIG_CLICK_METHOD_NONE;
|
|
|
|
|
else {
|
|
|
|
|
xf86IDrvMsg(pInfo, X_ERROR,
|
|
|
|
|
"Unknown click method '%s'. Using default.\n",
|
|
|
|
|
method);
|
|
|
|
|
m = libinput_device_config_click_get_method(device);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
driver_data->options.click_method = m;
|
|
|
|
|
free(method);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int xf86libinput_pre_init(InputDriverPtr drv,
|
|
|
|
|
InputInfoPtr pInfo,
|
|
|
|
|
int flags)
|
|
|
|
|
static int
|
|
|
|
|
xf86libinput_pre_init(InputDriverPtr drv,
|
|
|
|
|
InputInfoPtr pInfo,
|
|
|
|
|
int flags)
|
|
|
|
|
{
|
|
|
|
|
struct xf86libinput *driver_data = NULL;
|
|
|
|
|
struct libinput *libinput = NULL;
|
|
|
|
|
struct libinput_device *device;
|
|
|
|
|
char *path;
|
|
|
|
|
char *path = NULL;
|
|
|
|
|
|
|
|
|
|
pInfo->type_name = 0;
|
|
|
|
|
pInfo->device_control = xf86libinput_device_control;
|
|
|
|
|
@@ -1138,8 +1193,8 @@ static int xf86libinput_pre_init(InputDriverPtr drv,
|
|
|
|
|
if (!driver_data->valuators)
|
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
|
|
driver_data->scroll_vdist = 1;
|
|
|
|
|
driver_data->scroll_hdist = 1;
|
|
|
|
|
driver_data->scroll_vdist = 15;
|
|
|
|
|
driver_data->scroll_hdist = 15;
|
|
|
|
|
|
|
|
|
|
path = xf86SetStrOption(pInfo->options, "Device", NULL);
|
|
|
|
|
if (!path)
|
|
|
|
|
@@ -1281,12 +1336,34 @@ static Atom prop_left_handed;
|
|
|
|
|
static Atom prop_scroll_methods_available;
|
|
|
|
|
static Atom prop_scroll_method_enabled;
|
|
|
|
|
static Atom prop_scroll_button;
|
|
|
|
|
static Atom prop_click_methods_available;
|
|
|
|
|
static Atom prop_click_method_enabled;
|
|
|
|
|
|
|
|
|
|
/* general properties */
|
|
|
|
|
static Atom prop_float;
|
|
|
|
|
static Atom prop_device;
|
|
|
|
|
static Atom prop_product_id;
|
|
|
|
|
|
|
|
|
|
static inline BOOL
|
|
|
|
|
xf86libinput_check_device (DeviceIntPtr dev,
|
|
|
|
|
Atom atom)
|
|
|
|
|
{
|
|
|
|
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
struct libinput_device *device = driver_data->device;
|
|
|
|
|
|
|
|
|
|
if (device == NULL) {
|
|
|
|
|
BUG_WARN(dev->public.on);
|
|
|
|
|
xf86IDrvMsg(pInfo, X_INFO,
|
|
|
|
|
"SetProperty on %d called but device is disabled.\n"
|
|
|
|
|
"This driver cannot change properties on a disabled device\n",
|
|
|
|
|
atom);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
LibinputSetPropertyTap(DeviceIntPtr dev,
|
|
|
|
|
Atom atom,
|
|
|
|
|
@@ -1306,6 +1383,9 @@ LibinputSetPropertyTap(DeviceIntPtr dev,
|
|
|
|
|
if (*data != 0 && *data != 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_tap_get_finger_count(device) == 0)
|
|
|
|
|
return BadMatch;
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1337,6 +1417,9 @@ LibinputSetPropertyCalibration(DeviceIntPtr dev,
|
|
|
|
|
data[8] != 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
if (!libinput_device_config_calibration_has_matrix(device))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1368,6 +1451,9 @@ LibinputSetPropertyAccel(DeviceIntPtr dev,
|
|
|
|
|
if (*data < -1 || *data > 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_accel_is_available(device) == 0)
|
|
|
|
|
return BadMatch;
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1397,6 +1483,9 @@ LibinputSetPropertyNaturalScroll(DeviceIntPtr dev,
|
|
|
|
|
if (*data != 0 && *data != 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_scroll_has_natural_scroll(device) == 0)
|
|
|
|
|
return BadMatch;
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1429,9 +1518,12 @@ LibinputSetPropertySendEvents(DeviceIntPtr dev,
|
|
|
|
|
modes |= LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE;
|
|
|
|
|
|
|
|
|
|
if (checkonly) {
|
|
|
|
|
uint32_t supported =
|
|
|
|
|
libinput_device_config_send_events_get_modes(device);
|
|
|
|
|
uint32_t supported;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
supported = libinput_device_config_send_events_get_modes(device);
|
|
|
|
|
if ((modes | supported) != supported)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
@@ -1459,9 +1551,13 @@ LibinputSetPropertyLeftHanded(DeviceIntPtr dev,
|
|
|
|
|
data = (BOOL*)val->data;
|
|
|
|
|
|
|
|
|
|
if (checkonly) {
|
|
|
|
|
int supported = libinput_device_config_left_handed_is_available(device);
|
|
|
|
|
int supported;
|
|
|
|
|
int left_handed = *data;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
supported = libinput_device_config_left_handed_is_available(device);
|
|
|
|
|
if (!supported && left_handed)
|
|
|
|
|
return BadValue;
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1496,11 +1592,15 @@ LibinputSetPropertyScrollMethods(DeviceIntPtr dev,
|
|
|
|
|
modes |= LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
|
|
|
|
|
|
|
|
|
|
if (checkonly) {
|
|
|
|
|
uint32_t supported = libinput_device_config_scroll_get_methods(device);
|
|
|
|
|
uint32_t supported;
|
|
|
|
|
|
|
|
|
|
if (__builtin_popcount(modes) > 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
supported = libinput_device_config_scroll_get_methods(device);
|
|
|
|
|
if (modes && (modes & supported) == 0)
|
|
|
|
|
return BadValue;
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1528,9 +1628,13 @@ LibinputSetPropertyScrollButton(DeviceIntPtr dev,
|
|
|
|
|
|
|
|
|
|
if (checkonly) {
|
|
|
|
|
uint32_t button = *data;
|
|
|
|
|
uint32_t supported = libinput_device_has_button(device,
|
|
|
|
|
btn_xorg2linux(button));
|
|
|
|
|
uint32_t supported;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device (dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
supported = libinput_device_pointer_has_button(device,
|
|
|
|
|
btn_xorg2linux(button));
|
|
|
|
|
if (button && !supported)
|
|
|
|
|
return BadValue;
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1540,6 +1644,48 @@ LibinputSetPropertyScrollButton(DeviceIntPtr dev,
|
|
|
|
|
return Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
LibinputSetPropertyClickMethod(DeviceIntPtr dev,
|
|
|
|
|
Atom atom,
|
|
|
|
|
XIPropertyValuePtr val,
|
|
|
|
|
BOOL checkonly)
|
|
|
|
|
{
|
|
|
|
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
struct libinput_device *device = driver_data->device;
|
|
|
|
|
BOOL* data;
|
|
|
|
|
uint32_t modes = 0;
|
|
|
|
|
|
|
|
|
|
if (val->format != 8 || val->size != 2 || val->type != XA_INTEGER)
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
data = (BOOL*)val->data;
|
|
|
|
|
|
|
|
|
|
if (data[0])
|
|
|
|
|
modes |= LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
|
|
|
|
if (data[1])
|
|
|
|
|
modes |= LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
|
|
|
|
|
|
|
|
|
|
if (checkonly) {
|
|
|
|
|
uint32_t supported;
|
|
|
|
|
|
|
|
|
|
if (__builtin_popcount(modes) > 1)
|
|
|
|
|
return BadValue;
|
|
|
|
|
|
|
|
|
|
if (!xf86libinput_check_device(dev, atom))
|
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
|
|
supported = libinput_device_config_click_get_methods(device);
|
|
|
|
|
if (modes && (modes & supported) == 0)
|
|
|
|
|
return BadValue;
|
|
|
|
|
} else {
|
|
|
|
|
driver_data->options.click_method = modes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|
|
|
|
BOOL checkonly)
|
|
|
|
|
@@ -1567,6 +1713,10 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|
|
|
|
rc = LibinputSetPropertyScrollMethods(dev, atom, val, checkonly);
|
|
|
|
|
else if (atom == prop_scroll_button)
|
|
|
|
|
rc = LibinputSetPropertyScrollButton(dev, atom, val, checkonly);
|
|
|
|
|
else if (atom == prop_click_methods_available)
|
|
|
|
|
return BadAccess; /* read-only */
|
|
|
|
|
else if (atom == prop_click_method_enabled)
|
|
|
|
|
rc = LibinputSetPropertyClickMethod(dev, atom, val, checkonly);
|
|
|
|
|
else if (atom == prop_device || atom == prop_product_id)
|
|
|
|
|
return BadAccess; /* read-only */
|
|
|
|
|
else
|
|
|
|
|
@@ -1579,196 +1729,240 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitProperty(DeviceIntPtr dev)
|
|
|
|
|
LibinputInitTapProperty(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
struct libinput_device *device = driver_data->device;
|
|
|
|
|
const char *device_node;
|
|
|
|
|
CARD32 product[2];
|
|
|
|
|
uint32_t scroll_methods;
|
|
|
|
|
uint32_t sendevent_modes;
|
|
|
|
|
BOOL tap = driver_data->options.tapping;
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
prop_float = XIGetKnownProperty("FLOAT");
|
|
|
|
|
if (libinput_device_config_tap_get_finger_count(device) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_tap_get_finger_count(device) > 0) {
|
|
|
|
|
BOOL tap = driver_data->options.tapping;
|
|
|
|
|
prop_tap = MakeAtom(LIBINPUT_PROP_TAP, strlen(LIBINPUT_PROP_TAP), TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_tap, XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace, 1, &tap, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_tap, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prop_tap = MakeAtom(LIBINPUT_PROP_TAP, strlen(LIBINPUT_PROP_TAP), TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_tap, XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace, 1, &tap, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_tap, FALSE);
|
|
|
|
|
}
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitCalibrationProperty(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
float calibration[9];
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
if (!libinput_device_config_calibration_has_matrix(device))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* We use a 9-element matrix just to be closer to the X server's
|
|
|
|
|
transformation matrix which also has the full matrix */
|
|
|
|
|
if (libinput_device_config_calibration_has_matrix(device)) {
|
|
|
|
|
float calibration[9];
|
|
|
|
|
|
|
|
|
|
libinput_device_config_calibration_get_matrix(device, calibration);
|
|
|
|
|
calibration[6] = 0;
|
|
|
|
|
calibration[7] = 0;
|
|
|
|
|
calibration[8] = 1;
|
|
|
|
|
libinput_device_config_calibration_get_matrix(device, calibration);
|
|
|
|
|
calibration[6] = 0;
|
|
|
|
|
calibration[7] = 0;
|
|
|
|
|
calibration[8] = 1;
|
|
|
|
|
|
|
|
|
|
prop_calibration = MakeAtom(LIBINPUT_PROP_CALIBRATION,
|
|
|
|
|
strlen(LIBINPUT_PROP_CALIBRATION),
|
|
|
|
|
TRUE);
|
|
|
|
|
prop_calibration = MakeAtom(LIBINPUT_PROP_CALIBRATION,
|
|
|
|
|
strlen(LIBINPUT_PROP_CALIBRATION),
|
|
|
|
|
TRUE);
|
|
|
|
|
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_calibration, prop_float, 32,
|
|
|
|
|
PropModeReplace, 9, calibration, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_calibration, FALSE);
|
|
|
|
|
}
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_calibration, prop_float, 32,
|
|
|
|
|
PropModeReplace, 9, calibration, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_calibration, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_accel_is_available(device)) {
|
|
|
|
|
float speed = driver_data->options.speed;
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitAccelProperty(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
float speed = driver_data->options.speed;
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
prop_accel = MakeAtom(LIBINPUT_PROP_ACCEL, strlen(LIBINPUT_PROP_ACCEL), TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_accel, prop_float, 32,
|
|
|
|
|
PropModeReplace, 1, &speed, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_accel, FALSE);
|
|
|
|
|
}
|
|
|
|
|
if (!libinput_device_config_accel_is_available(device))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_scroll_has_natural_scroll(device)) {
|
|
|
|
|
BOOL natural_scroll = driver_data->options.natural_scrolling;
|
|
|
|
|
prop_accel = MakeAtom(LIBINPUT_PROP_ACCEL, strlen(LIBINPUT_PROP_ACCEL), TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_accel, prop_float, 32,
|
|
|
|
|
PropModeReplace, 1, &speed, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_accel, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prop_natural_scroll = MakeAtom(LIBINPUT_PROP_NATURAL_SCROLL,
|
|
|
|
|
strlen(LIBINPUT_PROP_NATURAL_SCROLL),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_natural_scroll, XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace, 1, &natural_scroll, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_natural_scroll, FALSE);
|
|
|
|
|
}
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitNaturalScrollProperty(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
BOOL natural_scroll = driver_data->options.natural_scrolling;
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
if (!libinput_device_config_scroll_has_natural_scroll(device))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
prop_natural_scroll = MakeAtom(LIBINPUT_PROP_NATURAL_SCROLL,
|
|
|
|
|
strlen(LIBINPUT_PROP_NATURAL_SCROLL),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_natural_scroll, XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace, 1, &natural_scroll, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_natural_scroll, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitSendEventsProperty(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
uint32_t sendevent_modes;
|
|
|
|
|
uint32_t sendevents;
|
|
|
|
|
BOOL modes[2] = {FALSE};
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
sendevent_modes = libinput_device_config_send_events_get_modes(device);
|
|
|
|
|
if (sendevent_modes != LIBINPUT_CONFIG_SEND_EVENTS_ENABLED) {
|
|
|
|
|
uint32_t sendevents;
|
|
|
|
|
BOOL modes[2] = {FALSE};
|
|
|
|
|
if (sendevent_modes == LIBINPUT_CONFIG_SEND_EVENTS_ENABLED)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (sendevent_modes & LIBINPUT_CONFIG_SEND_EVENTS_DISABLED)
|
|
|
|
|
modes[0] = TRUE;
|
|
|
|
|
if (sendevent_modes & LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE)
|
|
|
|
|
modes[1] = TRUE;
|
|
|
|
|
if (sendevent_modes & LIBINPUT_CONFIG_SEND_EVENTS_DISABLED)
|
|
|
|
|
modes[0] = TRUE;
|
|
|
|
|
if (sendevent_modes & LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE)
|
|
|
|
|
modes[1] = TRUE;
|
|
|
|
|
|
|
|
|
|
prop_sendevents_available = MakeAtom(LIBINPUT_PROP_SENDEVENTS_AVAILABLE,
|
|
|
|
|
strlen(LIBINPUT_PROP_SENDEVENTS_AVAILABLE),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_sendevents_available,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace, 2, modes, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_sendevents_available, FALSE);
|
|
|
|
|
prop_sendevents_available = MakeAtom(LIBINPUT_PROP_SENDEVENTS_AVAILABLE,
|
|
|
|
|
strlen(LIBINPUT_PROP_SENDEVENTS_AVAILABLE),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_sendevents_available,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace, 2, modes, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_sendevents_available, FALSE);
|
|
|
|
|
|
|
|
|
|
memset(modes, 0, sizeof(modes));
|
|
|
|
|
sendevents = driver_data->options.sendevents;
|
|
|
|
|
|
|
|
|
|
switch(sendevents) {
|
|
|
|
|
case LIBINPUT_CONFIG_SEND_EVENTS_DISABLED:
|
|
|
|
|
modes[0] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE:
|
|
|
|
|
modes[1] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prop_sendevents_enabled = MakeAtom(LIBINPUT_PROP_SENDEVENTS_ENABLED,
|
|
|
|
|
strlen(LIBINPUT_PROP_SENDEVENTS_ENABLED),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_sendevents_enabled,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace, 2, modes, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_sendevents_enabled, FALSE);
|
|
|
|
|
memset(modes, 0, sizeof(modes));
|
|
|
|
|
sendevents = driver_data->options.sendevents;
|
|
|
|
|
|
|
|
|
|
switch(sendevents) {
|
|
|
|
|
case LIBINPUT_CONFIG_SEND_EVENTS_DISABLED:
|
|
|
|
|
modes[0] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE:
|
|
|
|
|
modes[1] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (libinput_device_config_left_handed_is_available(device)) {
|
|
|
|
|
BOOL left_handed = driver_data->options.left_handed;
|
|
|
|
|
prop_sendevents_enabled = MakeAtom(LIBINPUT_PROP_SENDEVENTS_ENABLED,
|
|
|
|
|
strlen(LIBINPUT_PROP_SENDEVENTS_ENABLED),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_sendevents_enabled,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace, 2, modes, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_sendevents_enabled, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prop_left_handed = MakeAtom(LIBINPUT_PROP_LEFT_HANDED,
|
|
|
|
|
strlen(LIBINPUT_PROP_LEFT_HANDED),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_left_handed,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace, 1, &left_handed, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_left_handed, FALSE);
|
|
|
|
|
}
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitLeftHandedProperty(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
BOOL left_handed = driver_data->options.left_handed;
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
if (!libinput_device_config_left_handed_is_available(device))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
prop_left_handed = MakeAtom(LIBINPUT_PROP_LEFT_HANDED,
|
|
|
|
|
strlen(LIBINPUT_PROP_LEFT_HANDED),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev, prop_left_handed,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace, 1, &left_handed, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_left_handed, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitScrollMethodsProperty(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
uint32_t scroll_methods;
|
|
|
|
|
enum libinput_config_scroll_method method;
|
|
|
|
|
BOOL methods[3] = {FALSE};
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
scroll_methods = libinput_device_config_scroll_get_methods(device);
|
|
|
|
|
if (scroll_methods != LIBINPUT_CONFIG_SCROLL_NO_SCROLL) {
|
|
|
|
|
enum libinput_config_scroll_method method;
|
|
|
|
|
BOOL methods[3] = {FALSE};
|
|
|
|
|
if (scroll_methods == LIBINPUT_CONFIG_SCROLL_NO_SCROLL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (scroll_methods & LIBINPUT_CONFIG_SCROLL_2FG)
|
|
|
|
|
methods[0] = TRUE;
|
|
|
|
|
if (scroll_methods & LIBINPUT_CONFIG_SCROLL_EDGE)
|
|
|
|
|
methods[1] = TRUE;
|
|
|
|
|
if (scroll_methods & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN)
|
|
|
|
|
methods[2] = TRUE;
|
|
|
|
|
if (scroll_methods & LIBINPUT_CONFIG_SCROLL_2FG)
|
|
|
|
|
methods[0] = TRUE;
|
|
|
|
|
if (scroll_methods & LIBINPUT_CONFIG_SCROLL_EDGE)
|
|
|
|
|
methods[1] = TRUE;
|
|
|
|
|
if (scroll_methods & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN)
|
|
|
|
|
methods[2] = TRUE;
|
|
|
|
|
|
|
|
|
|
prop_scroll_methods_available =
|
|
|
|
|
MakeAtom(LIBINPUT_PROP_SCROLL_METHODS_AVAILABLE,
|
|
|
|
|
strlen(LIBINPUT_PROP_SCROLL_METHODS_AVAILABLE),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev,
|
|
|
|
|
prop_scroll_methods_available,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace,
|
|
|
|
|
ARRAY_SIZE(methods),
|
|
|
|
|
&methods, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev,
|
|
|
|
|
prop_scroll_methods_available,
|
|
|
|
|
FALSE);
|
|
|
|
|
prop_scroll_methods_available =
|
|
|
|
|
MakeAtom(LIBINPUT_PROP_SCROLL_METHODS_AVAILABLE,
|
|
|
|
|
strlen(LIBINPUT_PROP_SCROLL_METHODS_AVAILABLE),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev,
|
|
|
|
|
prop_scroll_methods_available,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace,
|
|
|
|
|
ARRAY_SIZE(methods),
|
|
|
|
|
&methods, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev,
|
|
|
|
|
prop_scroll_methods_available,
|
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
|
|
memset(methods, 0, sizeof(methods));
|
|
|
|
|
memset(methods, 0, sizeof(methods));
|
|
|
|
|
|
|
|
|
|
method = libinput_device_config_scroll_get_method(device);
|
|
|
|
|
switch(method) {
|
|
|
|
|
case LIBINPUT_CONFIG_SCROLL_2FG:
|
|
|
|
|
methods[0] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_SCROLL_EDGE:
|
|
|
|
|
methods[1] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN:
|
|
|
|
|
methods[2] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prop_scroll_method_enabled =
|
|
|
|
|
MakeAtom(LIBINPUT_PROP_SCROLL_METHOD_ENABLED,
|
|
|
|
|
strlen(LIBINPUT_PROP_SCROLL_METHOD_ENABLED),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev,
|
|
|
|
|
prop_scroll_method_enabled,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace,
|
|
|
|
|
ARRAY_SIZE(methods),
|
|
|
|
|
&methods, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
XISetDevicePropertyDeletable(dev,
|
|
|
|
|
prop_scroll_method_enabled,
|
|
|
|
|
FALSE);
|
|
|
|
|
method = libinput_device_config_scroll_get_method(device);
|
|
|
|
|
switch(method) {
|
|
|
|
|
case LIBINPUT_CONFIG_SCROLL_2FG:
|
|
|
|
|
methods[0] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_SCROLL_EDGE:
|
|
|
|
|
methods[1] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN:
|
|
|
|
|
methods[2] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prop_scroll_method_enabled =
|
|
|
|
|
MakeAtom(LIBINPUT_PROP_SCROLL_METHOD_ENABLED,
|
|
|
|
|
strlen(LIBINPUT_PROP_SCROLL_METHOD_ENABLED),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev,
|
|
|
|
|
prop_scroll_method_enabled,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace,
|
|
|
|
|
ARRAY_SIZE(methods),
|
|
|
|
|
&methods, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
XISetDevicePropertyDeletable(dev,
|
|
|
|
|
prop_scroll_method_enabled,
|
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
|
|
/* Scroll button */
|
|
|
|
|
if (libinput_device_config_scroll_get_methods(device) &
|
|
|
|
|
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) {
|
|
|
|
|
CARD32 scroll_button = driver_data->options.scroll_button;
|
|
|
|
|
@@ -1784,6 +1978,95 @@ LibinputInitProperty(DeviceIntPtr dev)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev, prop_scroll_button, FALSE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitClickMethodsProperty(DeviceIntPtr dev,
|
|
|
|
|
struct xf86libinput *driver_data,
|
|
|
|
|
struct libinput_device *device)
|
|
|
|
|
{
|
|
|
|
|
uint32_t click_methods;
|
|
|
|
|
enum libinput_config_click_method method;
|
|
|
|
|
BOOL methods[2] = {FALSE};
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
click_methods = libinput_device_config_click_get_methods(device);
|
|
|
|
|
if (click_methods == LIBINPUT_CONFIG_CLICK_METHOD_NONE)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (click_methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS)
|
|
|
|
|
methods[0] = TRUE;
|
|
|
|
|
if (click_methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER)
|
|
|
|
|
methods[1] = TRUE;
|
|
|
|
|
|
|
|
|
|
prop_click_methods_available =
|
|
|
|
|
MakeAtom(LIBINPUT_PROP_CLICK_METHODS_AVAILABLE,
|
|
|
|
|
strlen(LIBINPUT_PROP_CLICK_METHODS_AVAILABLE),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev,
|
|
|
|
|
prop_click_methods_available,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace,
|
|
|
|
|
ARRAY_SIZE(methods),
|
|
|
|
|
&methods, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
XISetDevicePropertyDeletable(dev,
|
|
|
|
|
prop_click_methods_available,
|
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
|
|
memset(methods, 0, sizeof(methods));
|
|
|
|
|
|
|
|
|
|
method = libinput_device_config_click_get_method(device);
|
|
|
|
|
switch(method) {
|
|
|
|
|
case LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS:
|
|
|
|
|
methods[0] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER:
|
|
|
|
|
methods[1] = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prop_click_method_enabled =
|
|
|
|
|
MakeAtom(LIBINPUT_PROP_CLICK_METHOD_ENABLED,
|
|
|
|
|
strlen(LIBINPUT_PROP_CLICK_METHOD_ENABLED),
|
|
|
|
|
TRUE);
|
|
|
|
|
rc = XIChangeDeviceProperty(dev,
|
|
|
|
|
prop_click_method_enabled,
|
|
|
|
|
XA_INTEGER, 8,
|
|
|
|
|
PropModeReplace,
|
|
|
|
|
ARRAY_SIZE(methods),
|
|
|
|
|
&methods, FALSE);
|
|
|
|
|
if (rc != Success)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
XISetDevicePropertyDeletable(dev,
|
|
|
|
|
prop_click_method_enabled,
|
|
|
|
|
FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
LibinputInitProperty(DeviceIntPtr dev)
|
|
|
|
|
{
|
|
|
|
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
|
|
|
struct xf86libinput *driver_data = pInfo->private;
|
|
|
|
|
struct libinput_device *device = driver_data->device;
|
|
|
|
|
const char *device_node;
|
|
|
|
|
CARD32 product[2];
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
prop_float = XIGetKnownProperty("FLOAT");
|
|
|
|
|
|
|
|
|
|
LibinputInitTapProperty(dev, driver_data, device);
|
|
|
|
|
LibinputInitCalibrationProperty(dev, driver_data, device);
|
|
|
|
|
LibinputInitAccelProperty(dev, driver_data, device);
|
|
|
|
|
LibinputInitNaturalScrollProperty(dev, driver_data, device);
|
|
|
|
|
LibinputInitSendEventsProperty(dev, driver_data, device);
|
|
|
|
|
LibinputInitLeftHandedProperty(dev, driver_data, device);
|
|
|
|
|
LibinputInitScrollMethodsProperty(dev, driver_data, device);
|
|
|
|
|
LibinputInitClickMethodsProperty(dev, driver_data, device);
|
|
|
|
|
|
|
|
|
|
/* Device node property, read-only */
|
|
|
|
|
device_node = driver_data->path;
|
|
|
|
|
|