diff options
author | Magnus Vigerlöf <Magnus.Vigerlof@ipbo.se> | 2008-02-02 23:03:51 +0100 |
---|---|---|
committer | Julien Cristau <jcristau@debian.org> | 2008-05-07 19:22:35 +0200 |
commit | a68d0ef4a65bcd52c52ba54e6925082a9145fad3 (patch) | |
tree | 34063aea2b22d13f32014835916aa95b366d2100 | |
parent | b51ca35a7578b64190f663dc825d7fb551b92e73 (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).
(cherry picked from commit a0284d577aabea8406b72dd63773e341430ebe56)
-rw-r--r-- | dix/getevents.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index e0bc32681..c33371bde 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -607,6 +607,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) @@ -645,22 +649,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) @@ -693,6 +697,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; } |