xserver: Branch 'master' - 3 commits

Peter Hutterer whot at kemper.freedesktop.org
Fri Apr 22 04:33:36 UTC 2016


 Xi/exevents.c  |    3 +++
 dix/ptrveloc.c |   48 +++++++++++++++++++++++++++---------------------
 2 files changed, 30 insertions(+), 21 deletions(-)

New commits:
commit 16e4bce9e5257c50c80c66efee0d07c2483619e1
Author: Simon Thum <simon.thum at gmx.de>
Date:   Fri Apr 8 13:24:39 2016 +0200

    dix/ptraccel: Remove float literals
    
    This was fine back when valuators were integer. Device
    properties are float (not double), so some instances remain.
    
    Signed-off-by: Simon Thum <simon.thum at gmx.de>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index 050c12a..727602e 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -794,12 +794,12 @@ ComputeAcceleration(DeviceIntPtr dev,
             BasicComputeAcceleration(dev, vel, vel->last_velocity, threshold,
                                      acc);
         result +=
-            4.0f * BasicComputeAcceleration(dev, vel,
+            4.0 * BasicComputeAcceleration(dev, vel,
                                             (vel->last_velocity +
                                              vel->velocity) / 2,
                                             threshold,
                                             acc);
-        result /= 6.0f;
+        result /= 6.0;
         DebugAccelF("profile average [%.2f ... %.2f] is %.3f\n",
                     vel->velocity, vel->last_velocity, result);
     }
@@ -860,7 +860,7 @@ PowerProfile(DeviceIntPtr dev,
 {
     double vel_dist;
 
-    acc = (acc - 1.0) * 0.1f + 1.0;     /* without this, acc of 2 is unuseable */
+    acc = (acc - 1.0) * 0.1 + 1.0;     /* without this, acc of 2 is unuseable */
 
     if (velocity <= threshold)
         return vel->min_acceleration;
@@ -878,9 +878,9 @@ PowerProfile(DeviceIntPtr dev,
 static inline double
 CalcPenumbralGradient(double x)
 {
-    x *= 2.0f;
-    x -= 1.0f;
-    return 0.5f + (x * sqrt(1.0 - x * x) + asin(x)) / M_PI;
+    x *= 2.0;
+    x -= 1.0;
+    return 0.5 + (x * sqrt(1.0 - x * x) + asin(x)) / M_PI;
 }
 
 /**
@@ -916,23 +916,23 @@ SmoothLinearProfile(DeviceIntPtr dev,
 {
     double res, nv;
 
-    if (acc > 1.0f)
-        acc -= 1.0f;            /*this is so acc = 1 is no acceleration */
+    if (acc > 1.0)
+        acc -= 1.0;            /*this is so acc = 1 is no acceleration */
     else
-        return 1.0f;
+        return 1.0;
 
-    nv = (velocity - threshold) * acc * 0.5f;
+    nv = (velocity - threshold) * acc * 0.5;
 
     if (nv < 0) {
         res = 0;
     }
     else if (nv < 2) {
-        res = CalcPenumbralGradient(nv * 0.25f) * 2.0f;
+        res = CalcPenumbralGradient(nv * 0.25) * 2.0;
     }
     else {
-        nv -= 2.0f;
-        res = nv * 2.0f / M_PI  /* steepness of gradient at 0.5 */
-            + 1.0f;             /* gradient crosses 2|1 */
+        nv -= 2.0;
+        res = nv * 2.0 / M_PI  /* steepness of gradient at 0.5 */
+            + 1.0;             /* gradient crosses 2|1 */
     }
     res += vel->min_acceleration;
     return res;
@@ -949,7 +949,7 @@ SmoothLimitedProfile(DeviceIntPtr dev,
 {
     double res;
 
-    if (velocity >= threshold || threshold == 0.0f)
+    if (velocity >= threshold || threshold == 0.0)
         return acc;
 
     velocity /= threshold;      /* should be [0..1[ now */
@@ -971,7 +971,7 @@ static double
 NoProfile(DeviceIntPtr dev,
           DeviceVelocityPtr vel, double velocity, double threshold, double acc)
 {
-    return 1.0f;
+    return 1.0;
 }
 
 static PointerAccelerationProfileFunc
@@ -1091,7 +1091,7 @@ acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask *val, CARD32 evtime)
         return;
 
     if (velocitydata->statistics.profile_number == AccelProfileNone &&
-        velocitydata->const_acceleration == 1.0f) {
+        velocitydata->const_acceleration == 1.0) {
         return;                 /*we're inactive anyway, so skip the whole thing. */
     }
 
@@ -1119,8 +1119,8 @@ acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask *val, CARD32 evtime)
                                        (double) dev->ptrfeed->ctrl.den);
 
             DebugAccelF("mult is %f\n", mult);
-            if (mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
-                if (mult > 1.0f && soften)
+            if (mult != 1.0 || velocitydata->const_acceleration != 1.0) {
+                if (mult > 1.0 && soften)
                     ApplySoftening(velocitydata, &dx, &dy);
                 ApplyConstantDeceleration(velocitydata, &dx, &dy);
 
commit c8e5fc30575a309c25970fc68b9184c07bb74df4
Author: Simon Thum <simon.thum at gmx.de>
Date:   Tue Apr 5 14:29:47 2016 +0200

    dix/ptraccel: Fix memory leak in InitPredictableAccelerationScheme
    
    This was quite unlikely except in situations where a proper startup
    would have been impossible anyway, but since automated checks don't
    grade likelyhood just fix it.
    
    Detected by Jeremy Huddleston's clang checks.
    
    Signed-off-by: Simon Thum <simon.thum at gmx.de>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index e75300a..050c12a 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -134,13 +134,19 @@ InitPredictableAccelerationScheme(DeviceIntPtr dev,
     scheme = *protoScheme;
     vel = calloc(1, sizeof(DeviceVelocityRec));
     schemeData = calloc(1, sizeof(PredictableAccelSchemeRec));
-    if (!vel || !schemeData)
+    if (!vel || !schemeData) {
+        free(vel);
+        free(schemeData);
         return FALSE;
+    }
     InitVelocityData(vel);
     schemeData->vel = vel;
     scheme.accelData = schemeData;
-    if (!InitializePredictableAccelerationProperties(dev, vel, schemeData))
+    if (!InitializePredictableAccelerationProperties(dev, vel, schemeData)) {
+        free(vel);
+        free(schemeData);
         return FALSE;
+    }
     /* all fine, assign scheme to device */
     dev->valuator->accelScheme = scheme;
     return TRUE;
commit f641ae412287ecb7a3437987e2ba1646a8443aa4
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Mar 9 10:45:48 2016 +1000

    Xi: don't deliver emulated motion events for non-emulating touches
    
    The touchpoint knows whether it should be emulating or not and we have a check
    for that later. Check for this before we generate the event and try to deliver
    it, lest we trigger a bug warning.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1282252
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 74e49ed..5a0b68d 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1379,6 +1379,9 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
     if (!TouchResourceIsOwner(ti, listener->listener))
         return !Success;
 
+    if (!ti->emulate_pointer)
+        return !Success;
+
     nevents = TouchConvertToPointerEvent(ev, &motion, &button);
     BUG_RETURN_VAL(nevents == 0, BadValue);
 


More information about the xorg-commit mailing list