Compare commits

...

6 Commits

Author SHA1 Message Date
Peter Hutterer
446401bea9 xf86-input-libinput 0.9.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-04-23 12:23:01 +10:00
Peter Hutterer
8d4e03570c Add "libinput something Default" properties
A client or xorg.conf setting may change the property but once changed it
cannot be reset by a client to the original state without knowledge about the
device.

Export the various libinput_...get_default() functions as properties.

https://bugs.freedesktop.org/show_bug.cgi?id=89574

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-18 09:15:40 +10:00
Peter Hutterer
0c5620a29c Add a helper function for making properties
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-18 09:15:40 +10:00
Peter Hutterer
fb50cef700 man: update the property list in the man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-18 09:15:40 +10:00
Peter Hutterer
64a0f870e0 Fix a couple of -Wformat warnings
unsigned int vs int

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-18 09:15:40 +10:00
Peter Hutterer
e362e4dc4c cosmetic: drop duplicate empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-16 10:38:07 +10:00
4 changed files with 271 additions and 134 deletions

View File

@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-input-libinput],
[0.8.0],
[0.9.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[xf86-input-libinput])
AC_CONFIG_SRCDIR([Makefile.am])

View File

@@ -27,15 +27,27 @@
/* Tapping enabled/disabled: BOOL, 1 value */
#define LIBINPUT_PROP_TAP "libinput Tapping Enabled"
/* Tapping default enabled/disabled: BOOL, 1 value, read-only */
#define LIBINPUT_PROP_TAP_DEFAULT "libinput Tapping Enabled Default"
/* Calibration matrix: FLOAT, 9 values of a 3x3 matrix, in rows */
#define LIBINPUT_PROP_CALIBRATION "libinput Calibration Matrix"
/* Calibration matrix: FLOAT, 9 values of a 3x3 matrix, in rows, read-only*/
#define LIBINPUT_PROP_CALIBRATION_DEFAULT "libinput Calibration Matrix Default"
/* Pointer accel speed: FLOAT, 1 value, 32 bit */
#define LIBINPUT_PROP_ACCEL "libinput Accel Speed"
/* Pointer accel speed: FLOAT, 1 value, 32 bit, read-only*/
#define LIBINPUT_PROP_ACCEL_DEFAULT "libinput Accel Speed Default"
/* Natural scrolling: BOOL, 1 value */
#define LIBINPUT_PROP_NATURAL_SCROLL "libinput Natural Scrolling Enabled"
/* Natural scrolling: BOOL, 1 value, read-only */
#define LIBINPUT_PROP_NATURAL_SCROLL_DEFAULT "libinput Natural Scrolling Enabled Default"
/* Send-events mode: BOOL read-only, 2 values in order disabled,
disabled-on-external-mouse */
#define LIBINPUT_PROP_SENDEVENTS_AVAILABLE "libinput Send Events Modes Available"
@@ -44,9 +56,16 @@
disabled-on-external-mouse */
#define LIBINPUT_PROP_SENDEVENTS_ENABLED "libinput Send Events Mode Enabled"
/* Send-events mode: BOOL, 2 values in order disabled,
disabled-on-external-mouse, read-only */
#define LIBINPUT_PROP_SENDEVENTS_ENABLED_DEFAULT "libinput Send Events Mode Enabled Default"
/* Left-handed enabled/disabled: BOOL, 1 value */
#define LIBINPUT_PROP_LEFT_HANDED "libinput Left Handed Enabled"
/* Left-handed enabled/disabled: BOOL, 1 value, read-only */
#define LIBINPUT_PROP_LEFT_HANDED_DEFAULT "libinput Left Handed Enabled Default"
/* Scroll method: BOOL read-only, 3 values in order 2fg, edge, button.
shows available scroll methods */
#define LIBINPUT_PROP_SCROLL_METHODS_AVAILABLE "libinput Scroll Methods Available"
@@ -55,9 +74,16 @@
only one is enabled at a time at max */
#define LIBINPUT_PROP_SCROLL_METHOD_ENABLED "libinput Scroll Method Enabled"
/* Scroll method: BOOL, 3 values in order 2fg, edge, button
only one is enabled at a time at max, read-only */
#define LIBINPUT_PROP_SCROLL_METHOD_ENABLED_DEFAULT "libinput Scroll Method Enabled Default"
/* Scroll button for button scrolling: 32-bit int, 1 value */
#define LIBINPUT_PROP_SCROLL_BUTTON "libinput Button Scrolling Button"
/* Scroll button for button scrolling: 32-bit int, 1 value, read-only */
#define LIBINPUT_PROP_SCROLL_BUTTON_DEFAULT "libinput Button Scrolling Button Default"
/* Click method: BOOL read-only, 2 values in order buttonareas, clickfinger
shows available click methods */
#define LIBINPUT_PROP_CLICK_METHODS_AVAILABLE "libinput Click Methods Available"
@@ -66,4 +92,7 @@
only one enabled at a time at max */
#define LIBINPUT_PROP_CLICK_METHOD_ENABLED "libinput Click Method Enabled"
/* Click method: BOOL, 2 values in order buttonareas, clickfinger
only one enabled at a time at max, read-only */
#define LIBINPUT_PROP_CLICK_METHOD_ENABLED_DEFAULT "libinput Click Method Enabled Default"
#endif /* _LIBINPUT_PROPERTIES_H_ */

View File

@@ -96,7 +96,11 @@ configuration option. For all options, the default value is the one used by
libinput. On configuration failure, the default value is applied.
.SH SUPPORTED PROPERTIES
The following properties are provided by the
.B libinput
exports runtime-configurable options as properties. If a property listed
below is not available, the matching configuration option is not available
on the device. This however does not imply that the feature is not available
on the device. The following properties are provided by the
.B libinput
driver.
.TP 7
@@ -113,9 +117,44 @@ driver.
.BI "libinput Natural Scrolling Enabled"
1 boolean value (8 bit, 0 or 1). 1 enables natural scrolling
.TP 7
.BI "libinput Send Events Mode"
1 32-bit value, defines the sendevent mode. See the libinput documentation
for the allowed values.
.BI "libinput Send Events Modes Available"
2 boolean values (8 bit, 0 or 1), in order "disabled" and
"disabled-on-external-mouse". Indicates which send-event modes are available
on this device.
.TP 7
.BI "libinput Send Events Mode Enabled"
2 boolean values (8 bit, 0 or 1), in order "disabled" and
"disabled-on-external-mouse". Indicates which send-event modes is currently
enabled on this device.
.TP 7
.BI "libinput Left Handed Enabled"
1 boolean value (8 bit, 0 or 1). Indicates if left-handed mode is enabled or
disabled.
.TP 7
.BI "libinput Scroll Methods Available"
3 boolean values (8 bit, 0 or 1), in order "two-finger", "edge", "button".
Indicates which scroll methods are available on this device.
.TP 7
.BI "libinput Scroll Method Enabled"
3 boolean values (8 bit, 0 or 1), in order "two-finger", "edge", "button".
Indicates which scroll method is currently enabled on this device.
.TP 7
.BI "libinput Button Scrolling Button"
1 32-bit value. Sets the button number to use for button scrolling. This
setting is independent of the scroll method, to enable button scrolling the
method must be set to button-scrolling and a valid button must be set.
.TP 7
.BI "libinput Click Methods Available"
2 boolean values (8 bit, 0 or 1), in order "buttonareas", "clickfinger".
Indicates which click methods are available on this device.
.TP 7
.BI "libinput Click Methods Enabled"
2 boolean values (8 bit, 0 or 1), in order "buttonareas", "clickfinger".
Indicates which click methods are enabled on this device.
.PP
The above properties have a
.BI "libinput <property name> Default"
equivalent that indicates the default value for this setting on this device.
.SH AUTHORS
Peter Hutterer

View File

@@ -225,7 +225,7 @@ LibinputApplyConfig(DeviceIntPtr dev)
libinput_device_config_send_events_set_mode(device,
driver_data->options.sendevents) != LIBINPUT_CONFIG_STATUS_SUCCESS)
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set SendEventsMode %d\n",
"Failed to set SendEventsMode %u\n",
driver_data->options.sendevents);
if (libinput_device_config_scroll_has_natural_scroll(device) &&
@@ -289,7 +289,7 @@ LibinputApplyConfig(DeviceIntPtr dev)
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",
"Failed to set ScrollButton to %u\n",
driver_data->options.scroll_button);
}
@@ -1041,7 +1041,7 @@ xf86libinput_parse_options(InputInfoPtr pInfo,
if (libinput_device_config_send_events_set_mode(device, mode) !=
LIBINPUT_CONFIG_STATUS_SUCCESS) {
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set SendEventsMode %d\n", mode);
"Failed to set SendEventsMode %u\n", mode);
mode = libinput_device_config_send_events_get_mode(device);
}
driver_data->options.sendevents = mode;
@@ -1135,7 +1135,7 @@ xf86libinput_parse_options(InputInfoPtr pInfo,
if (libinput_device_config_scroll_set_button(device,
b) != LIBINPUT_CONFIG_STATUS_SUCCESS) {
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set ScrollButton to %d\n",
"Failed to set ScrollButton to %u\n",
scroll_button);
scroll_button = btn_linux2xorg(libinput_device_config_scroll_get_button(device));
}
@@ -1327,17 +1327,26 @@ _X_EXPORT XF86ModuleData libinputModuleData = {
/* libinput-specific properties */
static Atom prop_tap;
static Atom prop_tap_default;
static Atom prop_calibration;
static Atom prop_calibration_default;
static Atom prop_accel;
static Atom prop_accel_default;
static Atom prop_natural_scroll;
static Atom prop_natural_scroll_default;
static Atom prop_sendevents_available;
static Atom prop_sendevents_enabled;
static Atom prop_sendevents_default;
static Atom prop_left_handed;
static Atom prop_left_handed_default;
static Atom prop_scroll_methods_available;
static Atom prop_scroll_method_enabled;
static Atom prop_scroll_method_default;
static Atom prop_scroll_button;
static Atom prop_scroll_button_default;
static Atom prop_click_methods_available;
static Atom prop_click_method_enabled;
static Atom prop_click_method_default;
/* general properties */
static Atom prop_float;
@@ -1355,7 +1364,7 @@ xf86libinput_check_device (DeviceIntPtr dev,
if (device == NULL) {
BUG_WARN(dev->public.on);
xf86IDrvMsg(pInfo, X_INFO,
"SetProperty on %d called but device is disabled.\n"
"SetProperty on %u called but device is disabled.\n"
"This driver cannot change properties on a disabled device\n",
atom);
return FALSE;
@@ -1685,7 +1694,6 @@ LibinputSetPropertyClickMethod(DeviceIntPtr dev,
return Success;
}
static int
LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
BOOL checkonly)
@@ -1717,7 +1725,16 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
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)
else if (atom == prop_device || atom == prop_product_id ||
atom == prop_tap_default ||
atom == prop_calibration_default ||
atom == prop_accel_default ||
atom == prop_natural_scroll_default ||
atom == prop_sendevents_default ||
atom == prop_left_handed_default ||
atom == prop_scroll_method_default ||
atom == prop_scroll_button_default ||
atom == prop_click_method_default)
return BadAccess; /* read-only */
else
return Success;
@@ -1728,23 +1745,52 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
return rc;
}
static Atom
LibinputMakeProperty(DeviceIntPtr dev,
const char *prop_name,
Atom type,
int format,
int len,
void *data)
{
int rc;
Atom prop = MakeAtom(prop_name, strlen(prop_name), TRUE);
rc = XIChangeDeviceProperty(dev, prop, type, format,
PropModeReplace,
len, data, FALSE);
if (rc != Success)
return None;
XISetDevicePropertyDeletable(dev, prop, FALSE);
return prop;
}
static void
LibinputInitTapProperty(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
BOOL tap = driver_data->options.tapping;
int rc;
if (libinput_device_config_tap_get_finger_count(device) == 0)
return;
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)
prop_tap = LibinputMakeProperty(dev,
LIBINPUT_PROP_TAP,
XA_INTEGER,
8,
1,
&tap);
if (!prop_tap)
return;
XISetDevicePropertyDeletable(dev, prop_tap, FALSE);
tap = libinput_device_config_tap_get_default_enabled(device);
prop_tap_default = LibinputMakeProperty(dev,
LIBINPUT_PROP_TAP_DEFAULT,
XA_INTEGER, 8,
1, &tap);
}
static void
@@ -1753,7 +1799,6 @@ LibinputInitCalibrationProperty(DeviceIntPtr dev,
struct libinput_device *device)
{
float calibration[9];
int rc;
if (!libinput_device_config_calibration_has_matrix(device))
return;
@@ -1766,15 +1811,20 @@ LibinputInitCalibrationProperty(DeviceIntPtr dev,
calibration[7] = 0;
calibration[8] = 1;
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)
prop_calibration = LibinputMakeProperty(dev,
LIBINPUT_PROP_CALIBRATION,
prop_float, 32,
9, calibration);
if (!prop_calibration)
return;
XISetDevicePropertyDeletable(dev, prop_calibration, FALSE);
libinput_device_config_calibration_get_default_matrix(device,
calibration);
prop_calibration_default = LibinputMakeProperty(dev,
LIBINPUT_PROP_CALIBRATION_DEFAULT,
prop_float, 32,
9, calibration);
}
static void
@@ -1783,17 +1833,22 @@ LibinputInitAccelProperty(DeviceIntPtr dev,
struct libinput_device *device)
{
float speed = driver_data->options.speed;
int rc;
if (!libinput_device_config_accel_is_available(device))
return;
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)
prop_accel = LibinputMakeProperty(dev,
LIBINPUT_PROP_ACCEL,
prop_float, 32,
1, &speed);
if (!prop_accel)
return;
XISetDevicePropertyDeletable(dev, prop_accel, FALSE);
speed = libinput_device_config_accel_get_default_speed(device);
prop_accel_default = LibinputMakeProperty(dev,
LIBINPUT_PROP_ACCEL_DEFAULT,
prop_float, 32,
1, &speed);
}
static void
@@ -1802,19 +1857,22 @@ LibinputInitNaturalScrollProperty(DeviceIntPtr dev,
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)
prop_natural_scroll = LibinputMakeProperty(dev,
LIBINPUT_PROP_NATURAL_SCROLL,
XA_INTEGER, 8,
1, &natural_scroll);
if (!prop_natural_scroll)
return;
XISetDevicePropertyDeletable(dev, prop_natural_scroll, FALSE);
natural_scroll = libinput_device_config_scroll_get_default_natural_scroll_enabled(device);
prop_natural_scroll_default = LibinputMakeProperty(dev,
LIBINPUT_PROP_NATURAL_SCROLL_DEFAULT,
XA_INTEGER, 8,
1, &natural_scroll);
}
static void
@@ -1825,7 +1883,6 @@ LibinputInitSendEventsProperty(DeviceIntPtr dev,
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)
@@ -1836,15 +1893,12 @@ LibinputInitSendEventsProperty(DeviceIntPtr dev,
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)
prop_sendevents_available = LibinputMakeProperty(dev,
LIBINPUT_PROP_SENDEVENTS_AVAILABLE,
XA_INTEGER, 8,
2, modes);
if (!prop_sendevents_available)
return;
XISetDevicePropertyDeletable(dev, prop_sendevents_available, FALSE);
memset(modes, 0, sizeof(modes));
sendevents = driver_data->options.sendevents;
@@ -1858,15 +1912,25 @@ LibinputInitSendEventsProperty(DeviceIntPtr dev,
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)
prop_sendevents_enabled = LibinputMakeProperty(dev,
LIBINPUT_PROP_SENDEVENTS_ENABLED,
XA_INTEGER, 8,
2, modes);
if (!prop_sendevents_enabled)
return;
XISetDevicePropertyDeletable(dev, prop_sendevents_enabled, FALSE);
memset(modes, 0, sizeof(modes));
sendevent_modes = libinput_device_config_send_events_get_default_mode(device);
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_default = LibinputMakeProperty(dev,
LIBINPUT_PROP_SENDEVENTS_ENABLED_DEFAULT,
XA_INTEGER, 8,
2, modes);
}
static void
@@ -1875,20 +1939,22 @@ LibinputInitLeftHandedProperty(DeviceIntPtr dev,
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)
prop_left_handed = LibinputMakeProperty(dev,
LIBINPUT_PROP_LEFT_HANDED,
XA_INTEGER, 8,
1, &left_handed);
if (!prop_left_handed)
return;
XISetDevicePropertyDeletable(dev, prop_left_handed, FALSE);
left_handed = libinput_device_config_left_handed_get_default(device);
prop_left_handed_default = LibinputMakeProperty(dev,
LIBINPUT_PROP_LEFT_HANDED_DEFAULT,
XA_INTEGER, 8,
1, &left_handed);
}
static void
@@ -1899,7 +1965,6 @@ LibinputInitScrollMethodsProperty(DeviceIntPtr dev,
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)
@@ -1912,21 +1977,13 @@ LibinputInitScrollMethodsProperty(DeviceIntPtr dev,
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)
prop_scroll_methods_available = LibinputMakeProperty(dev,
LIBINPUT_PROP_SCROLL_METHODS_AVAILABLE,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
&methods);
if (!prop_scroll_methods_available)
return;
XISetDevicePropertyDeletable(dev,
prop_scroll_methods_available,
FALSE);
memset(methods, 0, sizeof(methods));
@@ -1945,38 +2002,47 @@ LibinputInitScrollMethodsProperty(DeviceIntPtr dev,
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)
prop_scroll_method_enabled = LibinputMakeProperty(dev,
LIBINPUT_PROP_SCROLL_METHOD_ENABLED,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
&methods);
if (!prop_scroll_method_enabled)
return;
XISetDevicePropertyDeletable(dev,
prop_scroll_method_enabled,
FALSE);
scroll_methods = libinput_device_config_scroll_get_default_method(device);
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;
prop_scroll_method_default = LibinputMakeProperty(dev,
LIBINPUT_PROP_SCROLL_METHOD_ENABLED_DEFAULT,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
&methods);
/* Scroll button */
if (libinput_device_config_scroll_get_methods(device) &
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) {
CARD32 scroll_button = driver_data->options.scroll_button;
prop_scroll_button = MakeAtom(LIBINPUT_PROP_SCROLL_BUTTON,
strlen(LIBINPUT_PROP_SCROLL_BUTTON),
TRUE);
rc = XIChangeDeviceProperty(dev, prop_scroll_button,
XA_CARDINAL, 32,
PropModeReplace, 1,
&scroll_button, FALSE);
if (rc != Success)
prop_scroll_button = LibinputMakeProperty(dev,
LIBINPUT_PROP_SCROLL_BUTTON,
XA_CARDINAL, 32,
1, &scroll_button);
if (!prop_scroll_button)
return;
XISetDevicePropertyDeletable(dev, prop_scroll_button, FALSE);
scroll_button = libinput_device_config_scroll_get_default_button(device);
prop_scroll_button_default = LibinputMakeProperty(dev,
LIBINPUT_PROP_SCROLL_BUTTON_DEFAULT,
XA_CARDINAL, 32,
1, &scroll_button);
}
}
@@ -1988,7 +2054,6 @@ LibinputInitClickMethodsProperty(DeviceIntPtr dev,
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)
@@ -1999,21 +2064,13 @@ LibinputInitClickMethodsProperty(DeviceIntPtr dev,
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)
prop_click_methods_available = LibinputMakeProperty(dev,
LIBINPUT_PROP_CLICK_METHODS_AVAILABLE,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
&methods);
if (!prop_click_methods_available)
return;
XISetDevicePropertyDeletable(dev,
prop_click_methods_available,
FALSE);
memset(methods, 0, sizeof(methods));
@@ -2029,22 +2086,34 @@ LibinputInitClickMethodsProperty(DeviceIntPtr dev,
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)
prop_click_method_enabled = LibinputMakeProperty(dev,
LIBINPUT_PROP_CLICK_METHOD_ENABLED,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
&methods);
if (!prop_click_method_enabled)
return;
XISetDevicePropertyDeletable(dev,
prop_click_method_enabled,
FALSE);
memset(methods, 0, sizeof(methods));
method = libinput_device_config_click_get_default_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_default = LibinputMakeProperty(dev,
LIBINPUT_PROP_CLICK_METHOD_ENABLED_DEFAULT,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
&methods);
}
static void