Skip to content
Commits on Source (13)
......@@ -2,7 +2,7 @@ xf86-input-libinput - a libinput-based X driver
===============================================
The official repository for this driver is
http://cgit.freedesktop.org/xorg/driver/xf86-input-libinput/
https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput
This is an X driver based on libinput. It is a thin wrapper around libinput,
so while it does provide all features that libinput supports it does little
......@@ -20,10 +20,10 @@ xorg-x11-server-devel package or similar) and libinput (check your
distribution for libinput-devel or similar).
To get libinput from source, see:
http://www.freedesktop.org/wiki/Software/libinput/
https://www.freedesktop.org/wiki/Software/libinput/
To build the X server from source:
http://www.x.org/wiki/Building_the_X_Window_System/
https://www.x.org/wiki/Building_the_X_Window_System/
Building
--------
......@@ -48,8 +48,8 @@ This will assign this driver to *all* devices. Use with caution.
Bugs
----
Bugs in libinput go to the "libinput" component of wayland:
https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland
Bugs in libinput go to the Issues section of the libinput gitlab project:
https://gitlab.freedesktop.org/libinput/libinput/issues
Bugs in this driver go to the "Input/libinput" component of xorg:
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
Bugs in this driver go to the Issues section of its gitlab project:
https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/issues
# Match on all types of devices but joysticks
#
# If you want to configure your devices, do not copy this file.
# Instead, use a config snippet that contains something like this:
#
# Section "InputClass"
# Identifier "something or other"
# MatchDriver "libinput"
#
# MatchIsTouchpad "on"
# ... other Match directives ...
# Option "someoption" "value"
# EndSection
#
# This applies the option any libinput device also matched by the other
# directives. See the xorg.conf(5) man page for more info on
# matching devices.
Section "InputClass"
Identifier "libinput pointer catchall"
MatchIsPointer "on"
......
......@@ -23,8 +23,8 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-input-libinput],
[0.28.1],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[0.28.2],
[https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/issues],
[xf86-input-libinput])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
......
xserver-xorg-input-libinput (0.28.2-1) unstable; urgency=medium
* New upstream release.
* control: Bump policy to 4.3.0, no changes.
* control: Update vcs urls.
-- Timo Aaltonen <tjaalton@debian.org> Mon, 04 Feb 2019 10:48:58 +0200
xserver-xorg-input-libinput (0.28.1-1) unstable; urgency=medium
* New upstream release.
......
......@@ -13,10 +13,10 @@ Build-Depends:
x11proto-input-dev (>= 2.2),
xserver-xorg-dev (>= 2:1.15.99),
xutils-dev,
Standards-Version: 3.9.8
Standards-Version: 4.3.0
Homepage: https://www.x.org
Vcs-Git: https://anonscm.debian.org/git/pkg-xorg/driver/xserver-xorg-input-libinput.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-xorg/driver/xserver-xorg-input-libinput.git
Vcs-Git: https://salsa.debian.org/xorg-team/driver/xserver-xorg-input-libinput.git
Vcs-Browser: https://salsa.debian.org/xorg-team/driver/xserver-xorg-input-libinput
Package: xserver-xorg-input-libinput
Architecture: linux-any
......
......@@ -128,11 +128,10 @@ struct xf86libinput {
uint32_t capabilities;
struct {
int vdist;
int hdist;
double vdist_fraction;
double hdist_fraction;
struct scroll_axis {
int dist;
double fraction;
} v, h;
} scroll;
struct {
......@@ -398,7 +397,7 @@ xf86libinput_shared_disable(struct xf86libinput_device *shared_device)
libinput_device_set_user_data(device, NULL);
libinput_path_remove_device(device);
device = libinput_device_unref(device);
libinput_device_unref(device);
shared_device->device = NULL;
}
......@@ -936,8 +935,8 @@ xf86libinput_init_pointer(InputInfoPtr pInfo)
XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y),
min, max, res * 1000, 0, res * 1000, Relative);
SetScrollValuator(dev, 2, SCROLL_TYPE_HORIZONTAL, driver_data->scroll.hdist, 0);
SetScrollValuator(dev, 3, SCROLL_TYPE_VERTICAL, driver_data->scroll.vdist, 0);
SetScrollValuator(dev, 2, SCROLL_TYPE_HORIZONTAL, driver_data->scroll.h.dist, 0);
SetScrollValuator(dev, 3, SCROLL_TYPE_VERTICAL, driver_data->scroll.v.dist, 0);
return Success;
}
......@@ -984,8 +983,8 @@ xf86libinput_init_pointer_absolute(InputInfoPtr pInfo)
XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y),
min, max, res * 1000, 0, res * 1000, Absolute);
SetScrollValuator(dev, 2, SCROLL_TYPE_HORIZONTAL, driver_data->scroll.hdist, 0);
SetScrollValuator(dev, 3, SCROLL_TYPE_VERTICAL, driver_data->scroll.vdist, 0);
SetScrollValuator(dev, 2, SCROLL_TYPE_HORIZONTAL, driver_data->scroll.h.dist, 0);
SetScrollValuator(dev, 3, SCROLL_TYPE_VERTICAL, driver_data->scroll.v.dist, 0);
driver_data->has_abs = TRUE;
......@@ -1565,40 +1564,58 @@ xf86libinput_handle_key(InputInfoPtr pInfo, struct libinput_event_keyboard *even
* e.g. a 2 degree click angle requires 8 clicks before a legacy event is
* sent, but each of those clicks will send XI2.1 smooth scroll data for
* compatible clients.
*
* Starting with kernel v5.0 we should get REL_WHEEL_HI_RES from those
* devices for the fine-grained scrolling and REL_WHEEL for the normal one,
* so the use-case above shouldn't matter anymore.
*/
static inline double
get_scroll_fraction(struct xf86libinput *driver_data,
get_wheel_scroll_value(struct xf86libinput *driver_data,
struct libinput_event_pointer *event,
enum libinput_pointer_axis axis)
{
double *fraction;
struct scroll_axis *s;
double f;
double angle;
int discrete;
switch (axis) {
case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
fraction = &driver_data->scroll.hdist_fraction;
s = &driver_data->scroll.h;
break;
case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
fraction = &driver_data->scroll.vdist_fraction;
s = &driver_data->scroll.v;
break;
default:
return 0.0;
}
if (*fraction != 0.0)
return *fraction;
/* Calculate the angle per single scroll event */
angle = libinput_event_pointer_get_axis_value(event, axis);
discrete = libinput_event_pointer_get_axis_value_discrete(event, axis);
/* We only need to guess the fraction on the first set of
* scroll events until a discrete value arrives. Once known, we
* re-use the fraction until the device goes away.
*/
if (s->fraction != 0.0)
goto out;
/* if we get a discrete of 0, assume REL_WHEEL_HI_RES exists and
* normal scroll events are sent correctly, so skip all the
* guesswork.
*/
if (discrete == 0) {
s->fraction = 1.0;
goto out;
}
/* Calculate the angle per single scroll event */
angle /= discrete;
/* We only do magic for click angles smaller than 10 degrees */
if (angle >= 10) {
*fraction = 1.0;
return 1.0;
s->fraction = 1.0;
goto out;
}
/* Figure out something that gets close to 15 degrees (the general
......@@ -1609,9 +1626,10 @@ get_scroll_fraction(struct xf86libinput *driver_data,
*/
f = round(15.0/angle);
*fraction = f;
s->fraction = f;
return f;
out:
return s->dist/s->fraction * discrete;
}
static inline bool
......@@ -1628,11 +1646,7 @@ calculate_axis_value(struct xf86libinput *driver_data,
source = libinput_event_pointer_get_axis_source(event);
if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL) {
double scroll_fraction;
value = libinput_event_pointer_get_axis_value_discrete(event, axis);
scroll_fraction = get_scroll_fraction(driver_data, event, axis);
value *= driver_data->scroll.vdist/scroll_fraction;
value = get_wheel_scroll_value(driver_data, event, axis);
} else {
value = libinput_event_pointer_get_axis_value(event, axis);
}
......@@ -3401,8 +3415,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.vdist = 15;
driver_data->scroll.hdist = 15;
driver_data->scroll.v.dist = 15;
driver_data->scroll.h.dist = 15;
if (!is_subdevice) {
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER))
......@@ -3624,7 +3638,7 @@ update_mode_prop_cb(ClientPtr client, pointer closure)
groups[idx] = mode;
driver_data->allow_mode_group_updates = true;
rc = XIChangeDeviceProperty(pInfo->dev,
XIChangeDeviceProperty(pInfo->dev,
prop_mode_groups,
XA_INTEGER, 8,
PropModeReplace,
......