From 336920a8e2db7c83e85b3ef68298c241ba833775 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Magnus=20Vigerl=C3=B6f?= Date: Tue, 8 Jan 2008 21:38:23 +0100 Subject: [PATCH] dix: Do not call clipAxis for relative pointer events Relative events should not have its axis clipped with clipAxis, miPointerSetPosition will do that and change screen for us. --- dix/getevents.c | 39 ++++++++++++++++++++++++++------------- 1 files changed, 26 insertions(+), 13 deletions(-) diff --git a/dix/getevents.c b/dix/getevents.c index d92680e..10cba16 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -587,6 +587,10 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, else y = pDev->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) @@ -625,22 +629,15 @@ 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]; } } - /* 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) @@ -659,9 +656,11 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, if(ax[0].max_value > 0) 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].max_value > 0) 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 @@ -670,8 +669,22 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, miPointerSetPosition(pDev, &x, &y, ms); if (pDev->coreEvents) { - cp->valuator->lastx = x; - cp->valuator->lasty = y; + /* 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->max_value > 0) + pDev->valuator->lastx = (int)((float)(x)*(ax->max_value-ax->min_value+1)/ + scr->height)+ax->min_value; + } + if(y != cp->valuator->lasty) { + AxisInfoPtr ax = &pDev->valuator->axes[1]; + cp->valuator->lasty = pDev->valuator->lasty = y; + if(ax->max_value > 0) + pDev->valuator->lasty = (int)((float)(y)*(ax->max_value-ax->min_value+1)/ + scr->height)+ax->min_value; + } } /* for some reason inputInfo.pointer does not have coreEvents set */ -- 1.5.2.5