xserver: Branch 'master' - 4 commits
Peter Hutterer
whot at kemper.freedesktop.org
Fri Oct 3 00:48:01 PDT 2008
dix/devices.c | 9 +++++++--
dix/getevents.c | 26 +++++++++++++++++---------
hw/xfree86/common/xf86DGA.c | 3 +++
3 files changed, 27 insertions(+), 11 deletions(-)
New commits:
commit 9c8a2be2c73abf06245b1eb7f05f93e104dcfe42
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date: Thu Oct 2 08:55:14 2008 +0930
dix: fix axis scaling.
For two axes [a, b] and [x, y] (inclusive), the formula to scale point P(ab)
to (x,y) is:
(P - a)/(b - a) * (y - x) + x
And the whole end result rounded of course to get the integer we need.
diff --git a/dix/getevents.c b/dix/getevents.c
index f2086e8..ed7bf7f 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -175,8 +175,12 @@ rescaleValuatorAxis(int coord, AxisInfoPtr from, AxisInfoPtr to,
if(fmin == tmin && fmax == tmax)
return coord;
- return (int)(((float)(coord - fmin)) * (tmax - tmin + 1) /
- (fmax - fmin + 1)) + tmin;
+
+ if(fmax == fmin) /* avoid division by 0 */
+ return 0;
+
+ return roundf(((float)(coord - fmin)) * (tmax - tmin) /
+ (fmax - fmin)) + tmin;
}
/**
commit 93ef72fa26b27cf90bf5c64ec19ac295a113aaae
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date: Sun Sep 28 21:47:21 2008 +0930
dix: don't lose subpixel precision when scaling.
Only scale x/y back from screen range if we have crossed screen, otherwise
leave it as it is.
diff --git a/dix/getevents.c b/dix/getevents.c
index 166ab4e..f2086e8 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -919,17 +919,22 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
master->last.valuators[1] = pDev->last.valuators[1];
}
+ /* Crossed screen? Scale back to device coordiantes */
if(cx != pDev->last.valuators[0])
+ {
+ scr = miPointerGetScreen(pDev);
+ x = rescaleValuatorAxis(pDev->last.valuators[0], NULL,
+ pDev->valuator->axes + 0, scr->width);
cx = pDev->last.valuators[0];
+ }
if(cy != pDev->last.valuators[1])
+ {
+ scr = miPointerGetScreen(pDev);
cy = pDev->last.valuators[1];
+ y = rescaleValuatorAxis(pDev->last.valuators[1], NULL,
+ pDev->valuator->axes + 1, scr->height);
+ }
- /* scale x/y back to device coordinates */
- scr = miPointerGetScreen(pDev);
- x = rescaleValuatorAxis(pDev->last.valuators[0], NULL,
- pDev->valuator->axes + 0, scr->width);
- y = rescaleValuatorAxis(pDev->last.valuators[1], NULL,
- pDev->valuator->axes + 1, scr->height);
updateMotionHistory(pDev, ms, first_valuator, num_valuators,
&pDev->last.valuators[first_valuator]);
@@ -938,7 +943,6 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
&pDev->last.valuators[first_valuator]);
/* Update the valuators with the true value sent to the client*/
- /* FIXME: we lose subpixel precision here. */
if(v0) *v0 = x;
if(v1) *v1 = y;
commit 5ef5e89f0e4b9b8820093e072430e295efce32fa
Author: Simon Thum <simon.thum at gmx.de>
Date: Sun Sep 28 22:32:44 2008 +0930
dix: fix non-initialization of pointer accel in master devices.
Init MDs always with PtrAccelNoOp.
Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>
diff --git a/dix/devices.c b/dix/devices.c
index f8ae6da..adb012f 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1262,7 +1262,9 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
}
dev->last.numValuators = numAxes;
- if(!dev->isMaster) /* master devs do not accelerate */
+ if(dev->isMaster) /* master devs do not accelerate */
+ InitPointerAccelerationScheme(dev, PtrAccelNoOp);
+ else
InitPointerAccelerationScheme(dev, PtrAccelDefault);
return TRUE;
}
@@ -1289,9 +1291,12 @@ InitPointerAccelerationScheme(DeviceIntPtr dev,
val = dev->valuator;
- if(!val || dev->isMaster) /* bail out if called for master devs */
+ if(!val)
return FALSE;
+ if(dev->isMaster && (scheme != PtrAccelNoOp))
+ scheme = PtrAccelNoOp; /* no accel for master devices */
+
for(x = 0; pointerAccelerationScheme[x].number >= 0; x++) {
if(pointerAccelerationScheme[x].number == scheme){
i = x;
commit 036d424827726b0c804ae1532109253270744207
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date: Fri Sep 26 17:01:12 2008 +0930
xfree86: don't let DGA steal key events outside of [9,255].
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 4dd31d8..83a1a65 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -922,6 +922,9 @@ DGAStealKeyEvent(DeviceIntPtr dev, int index, int key_code, int is_down)
if(DGAScreenKey == NULL) /* no DGA */
return FALSE;
+ if (key_code < 8 || key_code > 255)
+ return FALSE;
+
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */
More information about the xorg-commit
mailing list