summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorMagnus Vigerlöf <Magnus.Vigerlof@ipbo.se>2008-02-02 23:03:51 +0100
committerMagnus Vigerlöf <Magnus.Vigerlof@ipbo.se>2008-02-05 21:12:52 +0100
commita0284d577aabea8406b72dd63773e341430ebe56 (patch)
tree5d16821efc4b54b9c19516ef992560a1a00033d0 /dix
parentd9e23c4ff1607a62164b34717ef9afd352ce2b94 (diff)
dix: Skip call to clipAxis for relative core-events
Relative events that generates both core and extention events will have its axis cliped and screen changed by miPointerSetPosition when the events are processed. For absolute and non core-generating relative events the axis must be clipped if we shouldn't end up completely outside the defined ranges (if any).
Diffstat (limited to 'dix')
-rw-r--r--dix/getevents.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index c2736e4a3..bc64d318c 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -609,6 +609,10 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
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)
@@ -647,22 +651,22 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
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];
+
+ if(!coreOnly) {
+ /* 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);
-
/* Drop x and y back into the valuators list, if they were originally
* present. */
if (first_valuator == 0 && num_valuators >= 1)
@@ -695,6 +699,24 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
miPointerSetPosition(pDev, &x, &y, ms);
if (pDev->coreEvents) {
+ /* miPointerSetPosition may have changed screen */
+ scr = miPointerGetScreen(pDev);
+ if(x != cp->valuator->lastx) {
+ int min = pDev->valuator->axes[0].min_value;
+ int max = pDev->valuator->axes[0].max_value;
+ cp->valuator->lastx = pDev->valuator->lastx = x;
+ if(min < max)
+ pDev->valuator->lastx = (int)((float)(x)*(max-min+1)/scr->width)+min;
+ }
+ if(y != cp->valuator->lasty) {
+ int min = pDev->valuator->axes[1].min_value;
+ int max = pDev->valuator->axes[1].max_value;
+ cp->valuator->lasty = pDev->valuator->lasty = y;
+ if(min < max)
+ pDev->valuator->lasty = (int)((float)(y)*(max-min+1)/scr->height)+min;
+ }
+ }
+ else if (coreOnly) {
cp->valuator->lastx = x;
cp->valuator->lasty = y;
}