Commit 1e88664d authored by Peter Hutterer's avatar Peter Hutterer

Use the libinput touch count to init the right number of touches

Initial version by Johannes Pointner <h4nn35.work@gmail.com>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent d84e0035
......@@ -47,11 +47,11 @@ XORG_DEFAULT_OPTIONS
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto [inputproto >= 2.2])
PKG_CHECK_MODULES(LIBINPUT, [libinput >= 1.4.901])
AC_MSG_CHECKING([if libinput_device_config_accel_set_curve_point is available])
OLD_LIBS=$LIBS
OLD_CFLAGS=$CFLAGS
LIBS="$LIBS $LIBINPUT_LIBS"
CFLAGS="$CFLAGS $LIBINPUT_CFLAGS"
AC_MSG_CHECKING([if libinput_device_config_accel_set_curve_point is available])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <libinput.h>]],
[[libinput_device_config_accel_set_curve_point(NULL, 0, 0)]])],
......@@ -61,6 +61,16 @@ AC_LINK_IFELSE(
[libinput_have_custom_accel_curve=yes]],
[AC_MSG_RESULT([no])
[libinput_have_custom_accel_curve=no]])
AC_MSG_CHECKING([if libinput_device_touch_get_touch_count is available])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <libinput.h>]],
[[libinput_device_touch_get_touch_count(NULL)]])],
[AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_LIBINPUT_TOUCH_COUNT, [1],
[libinput_device_touch_get_touch_count() is available])
[libinput_have_touch_count=yes]],
[AC_MSG_RESULT([no])
[libinput_have_touch_count=no]])
LIBS=$OLD_LIBS
CFLAGS=$OLD_CFLAGS
......
......@@ -1095,11 +1095,13 @@ xf86libinput_init_touch(InputInfoPtr pInfo)
{
DeviceIntPtr dev = pInfo->dev;
struct xf86libinput *driver_data = pInfo->private;
struct libinput_device *device = driver_data->shared_device->device;
int min, max, res;
unsigned char btnmap[MAX_BUTTONS + 1];
Atom btnlabels[MAX_BUTTONS];
Atom axislabels[TOUCHPAD_NUM_AXES];
int nbuttons = 7;
int ntouches = TOUCH_MAX_SLOTS;
init_button_map(btnmap, ARRAY_SIZE(btnmap));
init_button_labels(btnlabels, ARRAY_SIZE(btnlabels));
......@@ -1123,7 +1125,13 @@ xf86libinput_init_touch(InputInfoPtr pInfo)
xf86InitValuatorAxisStruct(dev, 1,
XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y),
min, max, res * 1000, 0, res * 1000, Absolute);
InitTouchClassDeviceStruct(dev, TOUCH_MAX_SLOTS, XIDirectTouch, 2);
#if HAVE_LIBINPUT_TOUCH_COUNT
ntouches = libinput_device_touch_get_touch_count(device);
if (ntouches == 0) /* unknown - mtdev */
ntouches = TOUCH_MAX_SLOTS;
#endif
InitTouchClassDeviceStruct(dev, ntouches, XIDirectTouch, 2);
}
......
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