Commit 7d73602c authored by Olivier Fourdan's avatar Olivier Fourdan Committed by Peter Hutterer

Move properties to a separate header

And install the header as part of the SDK, so that applications interfacing
with the libinput driver do not have to copy paste all the properties' names.
Signed-off-by: 's avatarOlivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 00b96de3
...@@ -21,9 +21,12 @@ ...@@ -21,9 +21,12 @@
DISTCHECK_CONFIGURE_FLAGS = --with-sdkdir='$${includedir}/xorg' DISTCHECK_CONFIGURE_FLAGS = --with-sdkdir='$${includedir}/xorg'
SUBDIRS = src man SUBDIRS = src include man
MAINTAINERCLEANFILES = ChangeLog INSTALL MAINTAINERCLEANFILES = ChangeLog INSTALL
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xorg-libinput.pc
.PHONY: ChangeLog INSTALL .PHONY: ChangeLog INSTALL
INSTALL: INSTALL:
......
...@@ -68,6 +68,8 @@ DRIVER_NAME=libinput ...@@ -68,6 +68,8 @@ DRIVER_NAME=libinput
AC_SUBST([DRIVER_NAME]) AC_SUBST([DRIVER_NAME])
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
include/Makefile
src/Makefile src/Makefile
man/Makefile]) man/Makefile
xorg-libinput.pc])
AC_OUTPUT AC_OUTPUT
sdk_HEADERS = libinput-properties.h
/*
* Copyright © 2015 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of Red Hat
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission. Red
* Hat makes no representations about the suitability of this software
* for any purpose. It is provided "as is" without express or implied
* warranty.
*
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _LIBINPUT_PROPERTIES_H_
#define _LIBINPUT_PROPERTIES_H_
/* Tapping enabled/disabled: BOOL, 1 value */
#define LIBINPUT_PROP_TAP "libinput Tapping Enabled"
/* Calibration matrix: FLOAT, 9 values of a 3x3 matrix, in rows */
#define LIBINPUT_PROP_CALIBRATION "libinput Calibration Matrix"
/* Pointer accel speed: FLOAT, 1 value, 32 bit */
#define LIBINPUT_PROP_ACCEL "libinput Accel Speed"
/* Natural scrolling: BOOL, 1 value */
#define LIBINPUT_PROP_NATURAL_SCROLL "libinput Natural Scrolling Enabled"
/* 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"
/* Send-events mode: BOOL, 2 values in order disabled,
disabled-on-external-mouse */
#define LIBINPUT_PROP_SENDEVENTS_ENABLED "libinput Send Events Mode Enabled"
/* Left-handed enabled/disabled: BOOL, 1 value */
#define LIBINPUT_PROP_LEFT_HANDED "libinput Left Handed Enabled"
/* 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"
/* Scroll method: BOOL, 3 values in order 2fg, edge, button
only one is enabled at a time at max */
#define LIBINPUT_PROP_SCROLL_METHOD_ENABLED "libinput Scroll Method Enabled"
/* Scroll button for button scrolling: 32-bit int, 1 value */
#define LIBINPUT_PROP_SCROLL_BUTTON "libinput Button Scrolling Button"
#endif /* _LIBINPUT_PROPERTIES_H_ */
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include "libinput-properties.h"
#ifndef XI86_SERVER_FD #ifndef XI86_SERVER_FD
#define XI86_SERVER_FD 0x20 #define XI86_SERVER_FD 0x20
#endif #endif
...@@ -57,31 +59,6 @@ ...@@ -57,31 +59,6 @@
*/ */
#define TOUCH_AXIS_MAX 0xffff #define TOUCH_AXIS_MAX 0xffff
/* Tapping enabled/disabled: BOOL, 1 value */
#define PROP_TAP "libinput Tapping Enabled"
/* Calibration matrix: FLOAT, 9 values of a 3x3 matrix, in rows */
#define PROP_CALIBRATION "libinput Calibration Matrix"
/* Pointer accel speed: FLOAT, 1 value, 32 bit */
#define PROP_ACCEL "libinput Accel Speed"
/* Natural scrolling: BOOL, 1 value */
#define PROP_NATURAL_SCROLL "libinput Natural Scrolling Enabled"
/* Send-events mode: BOOL read-only, 2 values in order disabled,
disabled-on-external-mouse */
#define PROP_SENDEVENTS_AVAILABLE "libinput Send Events Modes Available"
/* Send-events mode: BOOL, 2 values in order disabled,
disabled-on-external-mouse */
#define PROP_SENDEVENTS_ENABLED "libinput Send Events Mode Enabled"
/* Left-handed enabled/disabled: BOOL, 1 value */
#define PROP_LEFT_HANDED "libinput Left Handed Enabled"
/* Scroll method: BOOL read-only, 3 values in order 2fg, edge, button.
shows available scroll methods */
#define PROP_SCROLL_METHODS_AVAILABLE "libinput Scroll Methods Available"
/* Scroll method: BOOL, 3 values in order 2fg, edge, button
only one is enabled at a time at max */
#define PROP_SCROLL_METHOD_ENABLED "libinput Scroll Method Enabled"
/* Scroll button for button scrolling: 32-bit int, 1 value */
#define PROP_SCROLL_BUTTON "libinput Button Scrolling Button"
struct xf86libinput_driver { struct xf86libinput_driver {
struct libinput *libinput; struct libinput *libinput;
int device_enabled_count; int device_enabled_count;
...@@ -1618,7 +1595,7 @@ LibinputInitProperty(DeviceIntPtr dev) ...@@ -1618,7 +1595,7 @@ LibinputInitProperty(DeviceIntPtr dev)
if (libinput_device_config_tap_get_finger_count(device) > 0) { if (libinput_device_config_tap_get_finger_count(device) > 0) {
BOOL tap = driver_data->options.tapping; BOOL tap = driver_data->options.tapping;
prop_tap = MakeAtom(PROP_TAP, strlen(PROP_TAP), TRUE); prop_tap = MakeAtom(LIBINPUT_PROP_TAP, strlen(LIBINPUT_PROP_TAP), TRUE);
rc = XIChangeDeviceProperty(dev, prop_tap, XA_INTEGER, 8, rc = XIChangeDeviceProperty(dev, prop_tap, XA_INTEGER, 8,
PropModeReplace, 1, &tap, FALSE); PropModeReplace, 1, &tap, FALSE);
if (rc != Success) if (rc != Success)
...@@ -1636,8 +1613,8 @@ LibinputInitProperty(DeviceIntPtr dev) ...@@ -1636,8 +1613,8 @@ LibinputInitProperty(DeviceIntPtr dev)
calibration[7] = 0; calibration[7] = 0;
calibration[8] = 1; calibration[8] = 1;
prop_calibration = MakeAtom(PROP_CALIBRATION, prop_calibration = MakeAtom(LIBINPUT_PROP_CALIBRATION,
strlen(PROP_CALIBRATION), strlen(LIBINPUT_PROP_CALIBRATION),
TRUE); TRUE);
rc = XIChangeDeviceProperty(dev, prop_calibration, prop_float, 32, rc = XIChangeDeviceProperty(dev, prop_calibration, prop_float, 32,
...@@ -1650,7 +1627,7 @@ LibinputInitProperty(DeviceIntPtr dev) ...@@ -1650,7 +1627,7 @@ LibinputInitProperty(DeviceIntPtr dev)
if (libinput_device_config_accel_is_available(device)) { if (libinput_device_config_accel_is_available(device)) {
float speed = driver_data->options.speed; float speed = driver_data->options.speed;
prop_accel = MakeAtom(PROP_ACCEL, strlen(PROP_ACCEL), TRUE); prop_accel = MakeAtom(LIBINPUT_PROP_ACCEL, strlen(LIBINPUT_PROP_ACCEL), TRUE);
rc = XIChangeDeviceProperty(dev, prop_accel, prop_float, 32, rc = XIChangeDeviceProperty(dev, prop_accel, prop_float, 32,
PropModeReplace, 1, &speed, FALSE); PropModeReplace, 1, &speed, FALSE);
if (rc != Success) if (rc != Success)
...@@ -1661,8 +1638,8 @@ LibinputInitProperty(DeviceIntPtr dev) ...@@ -1661,8 +1638,8 @@ LibinputInitProperty(DeviceIntPtr dev)
if (libinput_device_config_scroll_has_natural_scroll(device)) { if (libinput_device_config_scroll_has_natural_scroll(device)) {
BOOL natural_scroll = driver_data->options.natural_scrolling; BOOL natural_scroll = driver_data->options.natural_scrolling;
prop_natural_scroll = MakeAtom(PROP_NATURAL_SCROLL, prop_natural_scroll = MakeAtom(LIBINPUT_PROP_NATURAL_SCROLL,
strlen(PROP_NATURAL_SCROLL), strlen(LIBINPUT_PROP_NATURAL_SCROLL),
TRUE); TRUE);
rc = XIChangeDeviceProperty(dev, prop_natural_scroll, XA_INTEGER, 8, rc = XIChangeDeviceProperty(dev, prop_natural_scroll, XA_INTEGER, 8,
PropModeReplace, 1, &natural_scroll, FALSE); PropModeReplace, 1, &natural_scroll, FALSE);
...@@ -1681,8 +1658,8 @@ LibinputInitProperty(DeviceIntPtr dev) ...@@ -1681,8 +1658,8 @@ LibinputInitProperty(DeviceIntPtr dev)
if (sendevent_modes & LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE) if (sendevent_modes & LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE)
modes[1] = TRUE; modes[1] = TRUE;
prop_sendevents_available = MakeAtom(PROP_SENDEVENTS_AVAILABLE, prop_sendevents_available = MakeAtom(LIBINPUT_PROP_SENDEVENTS_AVAILABLE,
strlen(PROP_SENDEVENTS_AVAILABLE), strlen(LIBINPUT_PROP_SENDEVENTS_AVAILABLE),
TRUE); TRUE);
rc = XIChangeDeviceProperty(dev, prop_sendevents_available, rc = XIChangeDeviceProperty(dev, prop_sendevents_available,
XA_INTEGER, 8, XA_INTEGER, 8,
...@@ -1703,8 +1680,8 @@ LibinputInitProperty(DeviceIntPtr dev) ...@@ -1703,8 +1680,8 @@ LibinputInitProperty(DeviceIntPtr dev)
break; break;
} }
prop_sendevents_enabled = MakeAtom(PROP_SENDEVENTS_ENABLED, prop_sendevents_enabled = MakeAtom(LIBINPUT_PROP_SENDEVENTS_ENABLED,
strlen(PROP_SENDEVENTS_ENABLED), strlen(LIBINPUT_PROP_SENDEVENTS_ENABLED),
TRUE); TRUE);
rc = XIChangeDeviceProperty(dev, prop_sendevents_enabled, rc = XIChangeDeviceProperty(dev, prop_sendevents_enabled,
XA_INTEGER, 8, XA_INTEGER, 8,
...@@ -1718,8 +1695,8 @@ LibinputInitProperty(DeviceIntPtr dev) ...@@ -1718,8 +1695,8 @@ LibinputInitProperty(DeviceIntPtr dev)
if (libinput_device_config_left_handed_is_available(device)) { if (libinput_device_config_left_handed_is_available(device)) {
BOOL left_handed = driver_data->options.left_handed; BOOL left_handed = driver_data->options.left_handed;
prop_left_handed = MakeAtom(PROP_LEFT_HANDED, prop_left_handed = MakeAtom(LIBINPUT_PROP_LEFT_HANDED,
strlen(PROP_LEFT_HANDED), strlen(LIBINPUT_PROP_LEFT_HANDED),
TRUE); TRUE);
rc = XIChangeDeviceProperty(dev, prop_left_handed, rc = XIChangeDeviceProperty(dev, prop_left_handed,
XA_INTEGER, 8, XA_INTEGER, 8,
...@@ -1742,8 +1719,8 @@ LibinputInitProperty(DeviceIntPtr dev) ...@@ -1742,8 +1719,8 @@ LibinputInitProperty(DeviceIntPtr dev)
methods[2] = TRUE; methods[2] = TRUE;
prop_scroll_methods_available = prop_scroll_methods_available =
MakeAtom(PROP_SCROLL_METHODS_AVAILABLE, MakeAtom(LIBINPUT_PROP_SCROLL_METHODS_AVAILABLE,
strlen(PROP_SCROLL_METHODS_AVAILABLE), strlen(LIBINPUT_PROP_SCROLL_METHODS_AVAILABLE),
TRUE); TRUE);
rc = XIChangeDeviceProperty(dev, rc = XIChangeDeviceProperty(dev,
prop_scroll_methods_available, prop_scroll_methods_available,
...@@ -1775,8 +1752,8 @@ LibinputInitProperty(DeviceIntPtr dev) ...@@ -1775,8 +1752,8 @@ LibinputInitProperty(DeviceIntPtr dev)
} }
prop_scroll_method_enabled = prop_scroll_method_enabled =
MakeAtom(PROP_SCROLL_METHOD_ENABLED, MakeAtom(LIBINPUT_PROP_SCROLL_METHOD_ENABLED,
strlen(PROP_SCROLL_METHOD_ENABLED), strlen(LIBINPUT_PROP_SCROLL_METHOD_ENABLED),
TRUE); TRUE);
rc = XIChangeDeviceProperty(dev, rc = XIChangeDeviceProperty(dev,
prop_scroll_method_enabled, prop_scroll_method_enabled,
...@@ -1796,8 +1773,8 @@ LibinputInitProperty(DeviceIntPtr dev) ...@@ -1796,8 +1773,8 @@ LibinputInitProperty(DeviceIntPtr dev)
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) { LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) {
CARD32 scroll_button = driver_data->options.scroll_button; CARD32 scroll_button = driver_data->options.scroll_button;
prop_scroll_button = MakeAtom(PROP_SCROLL_BUTTON, prop_scroll_button = MakeAtom(LIBINPUT_PROP_SCROLL_BUTTON,
strlen(PROP_SCROLL_BUTTON), strlen(LIBINPUT_PROP_SCROLL_BUTTON),
TRUE); TRUE);
rc = XIChangeDeviceProperty(dev, prop_scroll_button, rc = XIChangeDeviceProperty(dev, prop_scroll_button,
XA_CARDINAL, 32, XA_CARDINAL, 32,
......
sdkdir=@sdkdir@
Name: xorg-libinput
Description: X.Org libinput input driver.
Version: @PACKAGE_VERSION@
Cflags: -I${sdkdir}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment