[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'ubuntu'



 debian/changelog                              |    8 
 debian/patches/148_dix_touchscreen_fixes.diff |  243 ++++++++++++++++++++++++++
 debian/patches/series                         |    1 
 3 files changed, 252 insertions(+)

New commits:
commit 0691c04606cd7d994463bf4391897a6388688f0a
Author: Bryce Harrington <bryce@bryce@bryceharrington.org>
Date:   Fri Feb 8 16:48:36 2008 -0800

    Adding patch from StevenK to fix touchscreen issues for ubuntu-mobile

diff --git a/debian/changelog b/debian/changelog
index b4d8132..a8bba1a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+xorg-server (2:1.4.1~git20080131-1ubuntu2) hardy; urgency=low
+
+    * Add patch 148_dix_touchscreen_fixes.diff from Matthew Garrett to fix
+      touchscreen issues with DIX.
+      http://lists.freedesktop.org/archives/xorg-commit/2008-February/014648.html
+
+ -- Steve Kowalik <stevenk@ubuntu.com>  Fri, 08 Feb 2008 10:30:04 +1100
+
 xorg-server (2:1.4.1~git20080131-1ubuntu1) hardy; urgency=low
 
   [ Timo Aaltonen ]
diff --git a/debian/patches/148_dix_touchscreen_fixes.diff b/debian/patches/148_dix_touchscreen_fixes.diff
new file mode 100644
index 0000000..cc46fae
--- /dev/null
+++ b/debian/patches/148_dix_touchscreen_fixes.diff
@@ -0,0 +1,243 @@
+Index: xorg-server-1.4.1~git20080131/dix/getevents.c
+===================================================================
+--- xorg-server-1.4.1~git20080131.orig/dix/getevents.c	2008-02-08 09:27:11.000000000 +1100
++++ xorg-server-1.4.1~git20080131/dix/getevents.c	2008-02-08 09:27:36.000000000 +1100
+@@ -306,10 +306,13 @@
+ {
+     AxisInfoPtr axes = pDev->valuator->axes + axisNum;
+ 
+-    if (*val < axes->min_value)
+-        *val = axes->min_value;
+-    if (axes->max_value >= 0 && *val > axes->max_value)
+-        *val = axes->max_value;
++    /* No clipping if the value-range <= 0 */
++    if(axes->min_value < axes->min_value) {
++        if (*val < axes->min_value)
++            *val = axes->min_value;
++        if (*val > axes->max_value)
++            *val = axes->max_value;
++    }
+ }
+ 
+ /**
+@@ -523,12 +526,10 @@
+     int num_events = 0, final_valuator = 0;
+     CARD32 ms = 0;
+     deviceKeyButtonPointer *kbp = NULL;
+-    /* Thanks to a broken lib, we _always_ have to chase DeviceMotionNotifies
+-     * with DeviceValuators. */
+-    Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
+     DeviceIntPtr cp = inputInfo.pointer;
+     int x = 0, y = 0;
+     Bool coreOnly = (pDev == inputInfo.pointer);
++    ScreenPtr scr = miPointerGetScreen(pDev);
+ 
+     /* Sanity checks. */
+     if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
+@@ -551,7 +552,7 @@
+         return 0;
+ 
+     /* Do we need to send a DeviceValuator event? */
+-    if (!coreOnly && sendValuators) {
++    if (!coreOnly && num_valuators) {
+         if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
+             num_valuators = MAX_VALUATOR_EVENTS * 6;
+         num_events += ((num_valuators - 1) / 6) + 1;
+@@ -572,21 +573,44 @@
+             x = valuators[0];
+         }
+         else {
+-            if (pDev->coreEvents)
+-                x = cp->valuator->lastx;
+-            else
+-                x = pDev->valuator->lastx;
++            /* If we're sending core events but didn't provide a value,
++             * translate the core value (but use the device coord if
++             * it translates to the same coord to preserve sub-pixel
++             * coord information). If we're not sending core events use
++             * whatever value we have */
++            x = pDev->valuator->lastx;
++            if(pDev->coreEvents) {
++                int min = pDev->valuator->axes[0].min_value;
++                int max = pDev->valuator->axes[0].max_value;
++                if(min < max) {
++                    if((int)((float)(x-min)*scr->width/(max-min+1)) != cp->valuator->lastx)
++                        x = (int)((float)(cp->valuator->lastx)*(max-min+1)/scr->width)+min;
++                }
++                else
++                    x = cp->valuator->lastx;
++            }
+         }
+ 
+         if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
+             y = valuators[1 - first_valuator];
+         }
+         else {
+-            if (pDev->coreEvents)
+-                y = cp->valuator->lasty;
+-            else
+-                y = pDev->valuator->lasty;
+-        }
++            y = pDev->valuator->lasty;
++            if(pDev->coreEvents) {
++                int min = pDev->valuator->axes[1].min_value;
++                int max = pDev->valuator->axes[1].max_value;
++                if(min < max) {
++                    if((int)((float)(y-min)*scr->height/(max-min+1)) != cp->valuator->lasty)
++                        y = (int)((float)(cp->valuator->lasty)*(max-min+1)/scr->height)+min;
++                }
++                else
++                    y = cp->valuator->lasty;
++            }
++        }
++
++        /* Clip both x and y to the defined limits (usually co-ord space limit). */
++        clipAxis(pDev, 0, &x);
++        clipAxis(pDev, 1, &y);
+     }
+     else {
+         if (flags & POINTER_ACCELERATE)
+@@ -594,53 +618,104 @@
+                               valuators);
+ 
+         if (pDev->coreEvents) {
+-            if (first_valuator == 0 && num_valuators >= 1)
+-                x = cp->valuator->lastx + valuators[0];
++            /* Get and convert the core pointer coordinate space into
++             * device coordinates. Use the device coords if it translates
++             * into the same position as the core to preserve relative sub-
++             * pixel movements from the device. */
++            int min = pDev->valuator->axes[0].min_value;
++            int max = pDev->valuator->axes[0].max_value;
++            if(min < max) {
++                x = pDev->valuator->lastx;
++                if((int)((float)(x-min)*scr->width/(max-min+1)) != cp->valuator->lastx)
++                    x = (int)((float)(cp->valuator->lastx)*(max-min+1)/scr->width)+min;
++            }
+             else
+                 x = cp->valuator->lastx;
+ 
+-            if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
+-                y = cp->valuator->lasty + valuators[1 - first_valuator];
++            min = pDev->valuator->axes[1].min_value;
++            max = pDev->valuator->axes[1].max_value;
++            if(min < max) {
++                y = pDev->valuator->lasty;
++                if((int)((float)(y-min)*scr->height/(max-min+1)) != cp->valuator->lasty)
++                    y = (int)((float)(cp->valuator->lasty)*(max-min+1)/scr->height)+min;
++            }
+             else
+                 y = cp->valuator->lasty;
++
++            /* Add relative movement */
++            if (first_valuator == 0 && num_valuators >= 1)
++                x += valuators[0];
++            if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
++                y += valuators[1 - first_valuator];
+         }
+         else {
++            x = pDev->valuator->lastx;
++            y = pDev->valuator->lasty;
+             if (first_valuator == 0 && num_valuators >= 1)
+-                x = pDev->valuator->lastx + valuators[0];
+-            else
+-                x = pDev->valuator->lastx;
+-
++                x += valuators[0];
+             if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
+-                y = pDev->valuator->lasty + valuators[1 - first_valuator];
+-            else
+-                y = pDev->valuator->lasty;
++                y += valuators[1 - first_valuator];
++
++            /* Since we're not sending core-events we must clip both x and y
++             * to the defined limits so we don't run outside the box. */
++            clipAxis(pDev, 0, &x);
++            clipAxis(pDev, 1, &y);
+         }
+     }
+ 
+-    /* Clip both x and y to the defined limits (usually co-ord space limit). */
+-    clipAxis(pDev, 0, &x);
+-    clipAxis(pDev, 1, &y);
++    pDev->valuator->lastx = x;
++    pDev->valuator->lasty = y;
++    /* Convert the dev coord back to screen coord if we're
++     * sending core events */
++    if (pDev->coreEvents) {
++        AxisInfoPtr ax = pDev->valuator->axes;
++        if(ax[0].min_value < ax[0].max_value)
++            x = (int)((float)(x-ax[0].min_value)*scr->width/
++                  (ax[0].max_value-ax[0].min_value+1));
++        cp->valuator->lastx = x;
++        if(ax[1].min_value < ax[1].max_value)
++            y = (int)((float)(y-ax[1].min_value)*scr->height/
++                  (ax[1].max_value-ax[1].min_value+1));
++        cp->valuator->lasty = y;
++    }
+ 
+     /* This takes care of crossing screens for us, as well as clipping
+      * to the current screen.  Right now, we only have one history buffer,
+      * so we don't set this for both the device and core.*/
+     miPointerSetPosition(pDev, &x, &y, ms);
+ 
++    if (pDev->coreEvents) {
++        /* miPointerSetPosition may have changed screen */
++        scr = miPointerGetScreen(pDev);
++        if(x != cp->valuator->lastx) {
++            AxisInfoPtr ax = &pDev->valuator->axes[0];
++            cp->valuator->lastx = pDev->valuator->lastx = x;
++            if(ax->min_value < ax->max_value)
++                pDev->valuator->lastx = (int)((float)(x)*(ax->max_value-ax->min_value+1)/
++                                       scr->width)+ax->min_value;
++        }
++        if(y != cp->valuator->lasty) {
++            AxisInfoPtr ax = &pDev->valuator->axes[1];
++            cp->valuator->lasty = pDev->valuator->lasty = y;
++            if(ax->min_value < ax->max_value)
++                pDev->valuator->lasty = (int)((float)(y)*(ax->max_value-ax->min_value+1)/
++                                       scr->height)+ax->min_value;
++        }
++    }
++    else if (coreOnly) {
++        cp->valuator->lastx = x;
++        cp->valuator->lasty = y;
++    }
++
+     /* Drop x and y back into the valuators list, if they were originally
+      * present. */
+     if (first_valuator == 0 && num_valuators >= 1)
+-        valuators[0] = x;
++        valuators[0] = pDev->valuator->lastx;
+     if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
+-        valuators[1 - first_valuator] = y;
++        valuators[1 - first_valuator] = pDev->valuator->lasty;
+ 
+-    updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
+-
+-    if (pDev->coreEvents) {
+-        cp->valuator->lastx = x;
+-        cp->valuator->lasty = y;
+-    }
+-    pDev->valuator->lastx = x;
+-    pDev->valuator->lasty = y;
++    if (type == MotionNotify)
++        updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
+ 
+     /* for some reason inputInfo.pointer does not have coreEvents set */
+     if (coreOnly || pDev->coreEvents) {
+@@ -678,11 +753,11 @@
+             kbp->detail = pDev->button->map[buttons];
+         }
+ 
+-        kbp->root_x = x;
+-        kbp->root_y = y;
++        kbp->root_x = pDev->valuator->lastx;
++        kbp->root_y = pDev->valuator->lasty;
+ 
+         events++;
+-        if (sendValuators) {
++        if (num_valuators) {
+             kbp->deviceid |= MORE_EVENTS;
+             clipValuators(pDev, first_valuator, num_valuators, valuators);
+             events = getValuatorEvents(events, pDev, first_valuator,
diff --git a/debian/patches/series b/debian/patches/series
index 1b3439d..93e3aea 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -41,3 +41,4 @@
 144_fedora_xserver-1.3.0-xnest-exposures.patch
 146_X86EMU-added-blacklist-for-I-O-port-in-0-0xFF-range.patch
 147_X86EMU-pass-the-correct-bus-dev-fn-tag-to-pci-emula.patch
+148_dix_touchscreen_fixes.diff


Reply to: