[xorg-x11-server] Add new version of the resolution-based scaling patch - scale y down

Peter Hutterer whot at fedoraproject.org
Mon Jul 22 04:00:51 UTC 2013


commit 045334d639b7c9434965f798a24eb3a27bdeb94f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jul 19 13:26:07 2013 +1000

    Add new version of the resolution-based scaling patch - scale y down
    
      instead of x up. That gives almost the same behaviour as current
      synaptics. Drop the synaptics quirk, this needs to be now removed from the
      driver.

 ...-back-instead-of-x-up-when-pre-scaling-co.patch |   74 ++++++++++++++++++++
 10-quirks.conf                                     |   17 -----
 xorg-x11-server.spec                               |   15 +++-
 3 files changed, 86 insertions(+), 20 deletions(-)
---
diff --git a/0005-dix-scale-y-back-instead-of-x-up-when-pre-scaling-co.patch b/0005-dix-scale-y-back-instead-of-x-up-when-pre-scaling-co.patch
new file mode 100644
index 0000000..2fbb577
--- /dev/null
+++ b/0005-dix-scale-y-back-instead-of-x-up-when-pre-scaling-co.patch
@@ -0,0 +1,74 @@
+From 9d3cf2e519291f1931fb25ef6a3b2c609e48a787 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Fri, 19 Jul 2013 08:56:38 +1000
+Subject: [PATCH] dix: scale y back instead of x up when pre-scaling
+ coordinates
+
+The peculiar way we handle coordinates results in relative coordinates on
+absolute devices being added to the last value, then that value is mapped to
+the screen (taking the device dimensions into account). From that mapped
+value we get the final coordinates, both screen and device coordinates.
+
+To avoid uneven scaling on relative coordinates, they are pre-scaled by
+screen ratio:resolution:device ratio factor before being mapped. This
+ensures that a circle drawn on the device is a circle on the screen.
+
+Previously, we used the ratio to scale x up. Synaptics already does its own
+scaling based on the resolution and that is done by scaling y down by the
+ratio. So we can remove the code from the driver and get approximately the
+same behaviour here.
+
+Minor ABI bump, so we can remove this from synaptics.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ dix/getevents.c                | 6 +++---
+ hw/xfree86/common/xf86Module.h | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/dix/getevents.c b/dix/getevents.c
+index 51d4fd4..f5ab8c4 100644
+--- a/dix/getevents.c
++++ b/dix/getevents.c
+@@ -773,7 +773,7 @@ add_to_scroll_valuator(DeviceIntPtr dev, ValuatorMask *mask, int valuator, doubl
+ static void
+ scale_for_device_resolution(DeviceIntPtr dev, ValuatorMask *mask)
+ {
+-    double x;
++    double y;
+     ValuatorClassPtr v = dev->valuator;
+     int xrange = v->axes[0].max_value - v->axes[0].min_value + 1;
+     int yrange = v->axes[1].max_value - v->axes[1].min_value + 1;
+@@ -783,14 +783,14 @@ scale_for_device_resolution(DeviceIntPtr dev, ValuatorMask *mask)
+     double resolution_ratio = 1.0;
+     double ratio;
+ 
+-    if (!valuator_mask_fetch_double(mask, 0, &x))
++    if (!valuator_mask_fetch_double(mask, 1, &y))
+         return;
+ 
+     if (v->axes[0].resolution != 0 && v->axes[1].resolution != 0)
+         resolution_ratio = 1.0 * v->axes[0].resolution/v->axes[1].resolution;
+ 
+     ratio = device_ratio/resolution_ratio/screen_ratio;
+-    valuator_mask_set_double(mask, 0, x * ratio);
++    valuator_mask_set_double(mask, 1, y / ratio);
+ }
+ 
+ /**
+diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
+index 1393427..e0cec05 100644
+--- a/hw/xfree86/common/xf86Module.h
++++ b/hw/xfree86/common/xf86Module.h
+@@ -81,7 +81,7 @@ typedef enum {
+  */
+ #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
+ #define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(14, 1)
+-#define ABI_XINPUT_VERSION	SET_ABI_VERSION(19, 1)
++#define ABI_XINPUT_VERSION	SET_ABI_VERSION(19, 2)
+ #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(7, 0)
+ #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)
+ 
+-- 
+1.8.2.1
+
diff --git a/10-quirks.conf b/10-quirks.conf
index 63879f8..c9b823c 100644
--- a/10-quirks.conf
+++ b/10-quirks.conf
@@ -52,20 +52,3 @@ Section "InputClass"
         MatchDriver "evdev"
         Option "TypeName" "MOUSE"
 EndSection
-
-# synaptics resolution and axis dimensions are not representative of the
-# actual device dimensions, partially because what the kernel exports as
-# axis range is the what "fingers of typical size are used on TouchPads
-# mounted in typical bezel" produce (synaptics interfacing guide, p 23).
-# Even with the axis ranges corrected to what (my) touchpad actually
-# produces, the values are even further off, essentially stopping Y
-# movement if the server takes resolution into account.
-# So for the sake of my sanity, disable synaptics axis resolution by default
-# so the server can take the resolution from good devices and use that
-# for adjusting movement
-Section "InputClass"
-        Identifier "Synaptics resolution set to 0"
-        MatchDriver "synaptics"
-        Option "VertResolution" "0"
-        Option "HorizResolution" "0"
-EndSection
diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec
index 087660a..05cf1cd 100644
--- a/xorg-x11-server.spec
+++ b/xorg-x11-server.spec
@@ -19,7 +19,7 @@
 %global videodrv_major 14
 %global videodrv_minor 1
 %global xinput_major 19
-%global xinput_minor 1
+%global xinput_minor 2
 %global extension_major 7
 %global extension_minor 0
 %endif
@@ -42,7 +42,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.14.2
-Release:   5%{?gitdate:.%{gitdate}}%{dist}
+Release:   6%{?gitdate:.%{gitdate}}%{dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -105,9 +105,12 @@ Patch7052: 0001-xf86-return-NULL-for-compat-output-if-no-outputs.patch
 # mustard: make the default queue length bigger to calm abrt down
 Patch7064: 0001-mieq-Bump-default-queue-size-to-512.patch
 
+# scale events from abs devices in relative mode to something useful
+Patch8003: 0004-dix-pre-scale-x-by-the-screen-device-resolution-rati.patch
+Patch8004: 0005-dix-scale-y-back-instead-of-x-up-when-pre-scaling-co.patch
+
 # touch-grab-race condition bug backports
 # https://bugs.freedesktop.org/show_bug.cgi?id=56578
-Patch8003: 0004-dix-pre-scale-x-by-the-screen-device-resolution-rati.patch
 Patch8005: 0006-Xi-not-having-an-ownership-mask-does-not-mean-automa.patch
 Patch8006: 0007-dix-don-t-prepend-an-activated-passive-grab-to-the-l.patch
 Patch8007: 0008-Xi-if-we-delivered-a-TouchEnd-to-a-passive-grab-end-.patch
@@ -628,6 +631,12 @@ rm -rf $RPM_BUILD_ROOT
 %{xserver_source_dir}
 
 %changelog
+* Fri Jul 19 2013 Peter Hutterer <peter.hutterer at redhat.com> 1.14.2-6
+- Add new version of the resolution-based scaling patch - scale y down
+  instead of x up. That gives almost the same behaviour as current
+  synaptics. Drop the synaptics quirk, this needs to be now removed from the
+  driver.
+
 * Mon Jul 15 2013 Peter Hutterer <peter.hutterer at redhat.com> 1.14.2-5
 - Fix logspam when trying to free a non-existant grab.
 - Update touch patch to upstream version (from fdo #66720)


More information about the scm-commits mailing list