From 75777672a060da36ee290fc0d3479b38fbc4dc9a Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 18 May 2017 14:52:31 +1000 Subject: [PATCH] Add a new option to provide a workaround for the slow pointer movement on hidpi displays (#1413306) . That's a fedora-only patch for now, no idea what the permanent upstream solution will be here. --- ...ctor-option-as-temporary-solution-to.patch | 99 +++++++++++++++++++ xorg-x11-drv-libinput.spec | 13 ++- 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 0001-Add-a-DPIScaleFactor-option-as-temporary-solution-to.patch diff --git a/0001-Add-a-DPIScaleFactor-option-as-temporary-solution-to.patch b/0001-Add-a-DPIScaleFactor-option-as-temporary-solution-to.patch new file mode 100644 index 0000000..da7eda4 --- /dev/null +++ b/0001-Add-a-DPIScaleFactor-option-as-temporary-solution-to.patch @@ -0,0 +1,99 @@ +From 013e55c3a89fd33e5071059bb321a6fb5c8c84a4 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Thu, 18 May 2017 14:45:18 +1000 +Subject: [PATCH xf86-input-libinput] Add a DPIScaleFactor option as temporary + solution to the hidpi issue + +https://bugzilla.redhat.com/show_bug.cgi?id=1413306 +--- + man/libinput.man | 22 ++++++++++++++++++++++ + src/xf86libinput.c | 26 ++++++++++++++++++++++++++ + 2 files changed, 48 insertions(+) + +diff --git a/man/libinput.man b/man/libinput.man +index 2725390..bd09ffe 100644 +--- a/man/libinput.man ++++ b/man/libinput.man +@@ -381,6 +381,28 @@ it takes left-handed-ness into account. + .TP + This feature is provided by this driver, not by libinput. + ++.SH BUGS ++This driver does not know about the display pixel density and submits motion ++events assuming an approximate display density of 96dpi. On high-dpi ++screens this results in a slower physical motion of the cursor (a one-pixel ++movement is a smaller physical movement on the screen). This can make ++interaction with the desktop difficult. ++.PP ++.TP 7 ++.BI "Option \*qDPIScaleFactor\*q float ++This is a ++.B temporary ++solution. The factor should be set to the approximate ratio of the host display ++compared to the default 96dpi. For example, a display with 200dpi should set ++a factor of 2.0. ++.PP ++If set, x/y motion will be unconditionally multiplied by this factor, ++resulting in faster movement of the cursor. Note that this may make some ++pixels unadressable and should be used with caution. ++.PP ++.B This option is a temporary solution. ++It may be removed in any future update of this driver. ++ + .SH AUTHORS + Peter Hutterer + .SH "SEE ALSO" +diff --git a/src/xf86libinput.c b/src/xf86libinput.c +index 8e63fd6..a529385 100644 +--- a/src/xf86libinput.c ++++ b/src/xf86libinput.c +@@ -194,6 +194,8 @@ struct xf86libinput { + struct scale_factor { + double x, y; + } area_scale_factor; ++ ++ double dpi_scale_factor; /* Fedora hack */ + }; + + enum event_handling { +@@ -1313,6 +1315,11 @@ xf86libinput_handle_motion(InputInfoPtr pInfo, struct libinput_event_pointer *ev + x = libinput_event_pointer_get_dx(event); + y = libinput_event_pointer_get_dy(event); + ++ if (driver_data->dpi_scale_factor > 0.0) { ++ x *= driver_data->dpi_scale_factor; ++ y *= driver_data->dpi_scale_factor; ++ } ++ + valuator_mask_zero(mask); + + #if HAVE_VMASK_UNACCEL +@@ -3268,6 +3275,25 @@ xf86libinput_pre_init(InputDriverPtr drv, + + xf86libinput_parse_options(pInfo, driver_data, device); + ++ /* XXX: ++ Fedora hack for bug https://bugzilla.redhat.com/show_bug.cgi?id=1413306 ++ This is temporary only, but at least makes it work for now. ++ */ ++ ++ if (xf86CheckRealOption(pInfo->options, "DPIScaleFactor", 0.0) != 0.0) { ++ xf86IDrvMsg(pInfo, X_WARNING, ++ "\n" ++ "******************** WARNING ********************\n" ++ "* DPIScaleFactor option is a temporary solution *\n" ++ "* and may cease to work without warning! *\n" ++ "******************** WARNING ********************\n"); ++ driver_data->dpi_scale_factor = xf86SetRealOption(pInfo->options, "DPIScaleFactor", 0.0); ++ if (driver_data->dpi_scale_factor < 0.0) { ++ xf86IDrvMsg(pInfo, X_ERROR, "Invalid DPIScaleFactor, ignoring value\n"); ++ driver_data->dpi_scale_factor = 0.0; ++ } ++ } ++ + /* Device is both keyboard and pointer. Drop the keyboard cap from + * this device, create a separate device instead */ + if (!is_subdevice && +-- +2.13.0 + diff --git a/xorg-x11-drv-libinput.spec b/xorg-x11-drv-libinput.spec index 34f3355..0e8c6a5 100644 --- a/xorg-x11-drv-libinput.spec +++ b/xorg-x11-drv-libinput.spec @@ -8,7 +8,7 @@ Summary: Xorg X11 libinput input driver Name: xorg-x11-drv-libinput Version: 0.25.1 -Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} +Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} URL: http://www.x.org License: MIT @@ -19,6 +19,10 @@ Source0: ftp://ftp.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2 %endif Source1: 71-libinput-overrides-wacom.conf +# Fedora-only hack for hidpi screens +# https://bugzilla.redhat.com/show_bug.cgi?id=1413306 +Patch01: 0001-Add-a-DPIScaleFactor-option-as-temporary-solution-to.patch + ExcludeArch: s390 s390x BuildRequires: autoconf automake libtool @@ -40,6 +44,7 @@ supporting all devices. %prep %setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}} +%patch01 -p1 %build autoreconf --force -v --install || exit 1 @@ -75,6 +80,12 @@ Xorg X11 libinput input driver development files. %{_includedir}/xorg/libinput-properties.h %changelog +* Thu May 18 2017 Peter Hutterer 0.25.1-2 +- Add a new option to provide a workaround for the slow pointer movement on + hidpi displays (#1413306) . + That's a fedora-only patch for now, no idea what the permanent upstream + solution will be here. + * Fri May 05 2017 Peter Hutterer 0.25.1-1 - xorg-x11-drv-libinput 0.25.1