summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@XPS-SUSE.site>2008-11-02 06:12:59 +0900
committerSam Spilsbury <Sam@XPS-SUSE.site>2008-11-02 06:12:59 +0900
commitc7429140196ac02cb76cf8e053ca07dd34430b8f (patch)
treef99c677047e7262bb6de7961d105cd7d0ac54f02
parent19091353d114c7e7889dc2d90b18633c1af596ab (diff)
downloadcompiz-mpx-ir-c7429140196ac02cb76cf8e053ca07dd34430b8f.tar.gz
compiz-mpx-ir-c7429140196ac02cb76cf8e053ca07dd34430b8f.tar.bz2
Added patch for older xservers
-rw-r--r--xorg/xserver/64ebeeb5265a4c425b9397fdc86a6d81521a856e /0001-Add-IR-and-Driver-Workarounds.patch924
-rw-r--r--xorg/xserver/master/0001-XTriangle-Input-Mesh-Redirection-Support.patch (renamed from xorg/xserver/0001-XTriangle-Input-Mesh-Redirection-Support.patch)0
-rw-r--r--xorg/xserver/master/0002-Proprietary-Driver-Workarounds.patch (renamed from xorg/xserver/0002-Proprietary-Driver-Workarounds.patch)0
3 files changed, 924 insertions, 0 deletions
diff --git a/xorg/xserver/64ebeeb5265a4c425b9397fdc86a6d81521a856e /0001-Add-IR-and-Driver-Workarounds.patch b/xorg/xserver/64ebeeb5265a4c425b9397fdc86a6d81521a856e /0001-Add-IR-and-Driver-Workarounds.patch
new file mode 100644
index 0000000..c47d1a6
--- /dev/null
+++ b/xorg/xserver/64ebeeb5265a4c425b9397fdc86a6d81521a856e /0001-Add-IR-and-Driver-Workarounds.patch
@@ -0,0 +1,924 @@
+From 10a2c0e9b64590c8c0fd2abbd9de9c6775f6d68b Mon Sep 17 00:00:00 2001
+From: Sam Spilsbury <Sam@XPS-SUSE.site>
+Date: Sun, 2 Nov 2008 05:54:05 +0900
+Subject: [PATCH] Add IR and Driver Workarounds
+
+---
+ Xext/xvmain.c | 4 +-
+ composite/compalloc.c | 1 +
+ composite/compint.h | 51 +++++++
+ composite/compwindow.c | 336 +++++++++++++++++++++++++++++++++++++++++++
+ dix/events.c | 187 ++++++++++++++++++++----
+ dix/selection.c | 6 +-
+ hw/xfree86/common/xf86DGA.c | 4 +-
+ include/dix.h | 1 -
+ mi/miexpose.c | 4 +-
+ 9 files changed, 556 insertions(+), 38 deletions(-)
+
+diff --git a/Xext/xvmain.c b/Xext/xvmain.c
+index e92a248..56e7e94 100644
+--- a/Xext/xvmain.c
++++ b/Xext/xvmain.c
+@@ -541,7 +541,7 @@ int reason;
+ event.u.videoNotify.drawable = pDraw->id;
+ event.u.videoNotify.port = pPort->id;
+ event.u.videoNotify.reason = reason;
+- TryClientEvents(pn->client, NULL, (xEventPtr)&event, 1,
++ TryClientEvents(pn->client, (xEventPtr)&event, 1,
+ NoEventMask, NoEventMask, NullGrab);
+ }
+ pn = pn->next;
+@@ -573,7 +573,7 @@ XvdiSendPortNotify(
+ event.u.portNotify.port = pPort->id;
+ event.u.portNotify.attribute = attribute;
+ event.u.portNotify.value = value;
+- TryClientEvents(pn->client, NULL, (xEventPtr)&event, 1,
++ TryClientEvents(pn->client, (xEventPtr)&event, 1,
+ NoEventMask, NoEventMask, NullGrab);
+ }
+ pn = pn->next;
+diff --git a/composite/compalloc.c b/composite/compalloc.c
+index 19c7db0..1336bac 100644
+--- a/composite/compalloc.c
++++ b/composite/compalloc.c
+@@ -140,6 +140,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
+ cw->oldy = COMP_ORIGIN_INVALID;
+ cw->damageRegistered = FALSE;
+ cw->damaged = FALSE;
++ cw->pInputMesh = NULL;
+ dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
+ }
+ ccw->next = cw->clients;
+diff --git a/composite/compint.h b/composite/compint.h
+index 1c19ccd..6ff4c9c 100644
+--- a/composite/compint.h
++++ b/composite/compint.h
+@@ -84,6 +84,21 @@ typedef struct _CompClientWindow {
+ int update;
+ } CompClientWindowRec, *CompClientWindowPtr;
+
++typedef struct _CompTriangle {
++ xTriangle tri;
++ xFixed_48_16 area;
++} CompTriangle;
++
++typedef struct _CompTriangleMap {
++ CompTriangle parent;
++ CompTriangle child;
++} CompTriangleMap;
++
++typedef struct _CompTriangularMesh {
++ CompTriangleMap *map;
++ int nMap;
++} CompTriangularMeshRec, *CompTriangularMeshPtr;
++
+ typedef struct _CompWindow {
+ RegionRec borderClip;
+ DamagePtr damage; /* for automatic update mode */
+@@ -95,6 +110,7 @@ typedef struct _CompWindow {
+ int oldy;
+ PixmapPtr pOldPixmap;
+ int borderClipX, borderClipY;
++ CompTriangularMeshPtr pInputMesh;
+ } CompWindowRec, *CompWindowPtr;
+
+ #define COMP_ORIGIN_INVALID 0x80000000
+@@ -319,4 +335,39 @@ CompositeRealChildHead (WindowPtr pWin);
+ int
+ DeleteWindowNoInputDevices(pointer value, XID wid);
+
++Bool
++CompositeXYParentToChild (WindowPtr pChild,
++ int parentX,
++ int parentY,
++ int *childX,
++ int *childY);
++
++Bool
++CompositeXYChildToParent (WindowPtr pChild,
++ int childX,
++ int childY,
++ int *parentX,
++ int *parentY);
++
++void
++CompositeXYScreenToWindowRootCoordinate (WindowPtr pWin,
++ int x,
++ int y,
++ int *rootX,
++ int *rootY);
++
++void
++CompositeXYScreenFromWindowRootCoordinate (WindowPtr pWin,
++ int x,
++ int y,
++ int *screenX,
++ int *screenY);
++
++int
++CompositeSetTriangularCoordinateMesh (ClientPtr pClient,
++ WindowPtr pWin,
++ int n,
++ xTriangle *tri);
++
++
+ #endif /* _COMPINT_H_ */
+diff --git a/composite/compwindow.c b/composite/compwindow.c
+index c1657bd..6c5ac8f 100644
+--- a/composite/compwindow.c
++++ b/composite/compwindow.c
+@@ -45,6 +45,7 @@
+ #endif
+
+ #include "compint.h"
++//#include "inputstr.h"
+
+ #ifdef COMPOSITE_DEBUG
+ static int
+@@ -821,3 +822,338 @@ CompositeRealChildHead (WindowPtr pWin)
+ return pChildBefore;
+ }
+ }
++
++
++static int
++Orientation (xPointFixed *v1,
++ xPointFixed *v2,
++ xPointFixed *p)
++{
++ xFixed_48_16 a, b, c;
++
++ a = (xFixed_48_16) (v2->x - v1->x) * (p->y - v1->y);
++ b = (xFixed_48_16) (p->x - v1->x) * (v2->y - v1->y);
++
++ c = a - b;
++
++ return (c > 0) ? 1 : (c < 0) ? -1 : 0;
++}
++
++static Bool
++PointInTriangle (xTriangle *triangle,
++ xPointFixed *p)
++{
++ int o1, o2, o3;
++
++ o1 = Orientation (&triangle->p1, &triangle->p2, p);
++ o2 = Orientation (&triangle->p2, &triangle->p3, p);
++ o3 = Orientation (&triangle->p3, &triangle->p1, p);
++
++ /*
++ * 0 orientation means point is on the edge and we allow that as it is
++ * better that two triangles with coincident edges overlap than that
++ * there is a gap between them.
++ */
++ if (o2 == 0)
++ o2 = o3;
++ if (o1 == 0)
++ o1 = o2;
++
++ /*
++ * Point is in triangle if edge orientation relative to opposite point is
++ * the same for all edges.
++ */
++ return (o1 == o2) && (o2 == o3);
++}
++
++static Bool
++XYInTriangle (xTriangle *triangle,
++ int x,
++ int y)
++{
++ xPointFixed p;
++
++ p.x = IntToxFixed (x);
++ p.y = IntToxFixed (y);
++
++ return PointInTriangle (triangle, &p);
++}
++
++static xFixed_48_16
++TriangleArea (xPointFixed *p1,
++ xPointFixed *p2,
++ xPointFixed *p3)
++{
++ return (((xFixed_48_16) p3->x - p2->x) *
++ ((xFixed_48_16) p3->y - p1->y) -
++ ((xFixed_48_16) p3->y - p2->y) *
++ ((xFixed_48_16) p3->x - p1->x)) >> 16;
++}
++
++/*
++ * Inverse mapping of point P located in triangle.
++ */
++static void
++MapPoint (CompTriangle *from,
++ CompTriangle *to,
++ xPointFixed *p,
++ xPointFixed *result)
++{
++ xFixed_48_16 u, v, w;
++ xFixed_48_16 x, y;
++
++ u = (TriangleArea (&from->tri.p1, &from->tri.p2, p) << 16) / from->area;
++ v = (TriangleArea (&from->tri.p3, &from->tri.p1, p) << 16) / from->area;
++ w = (TriangleArea (&from->tri.p2, &from->tri.p3, p) << 16) / from->area;
++
++ x = to->tri.p3.x * u + to->tri.p2.x * v + to->tri.p1.x * w;
++ y = to->tri.p3.y * u + to->tri.p2.y * v + to->tri.p1.y * w;
++
++ result->x = x >> 16;
++ result->y = y >> 16;
++}
++
++static void
++XYMapPoint (CompTriangle *from,
++ CompTriangle *to,
++ int fromX,
++ int fromY,
++ int *toX,
++ int *toY)
++{
++ xPointFixed in, out;
++
++ in.x = IntToxFixed (fromX);
++ in.y = IntToxFixed (fromY);
++
++ MapPoint (from, to, &in, &out);
++
++ *toX = xFixedToInt (out.x + xFixed1 / 2);
++ *toY = xFixedToInt (out.y + xFixed1 / 2);
++}
++
++Bool
++CompositeXYParentToChild (WindowPtr pChild,
++ int parentX,
++ int parentY,
++ int *childX,
++ int *childY)
++{
++ CompWindowPtr cw = GetCompWindow (pChild);
++
++ if (cw && cw->pInputMesh)
++ {
++ CompTriangleMap *map = cw->pInputMesh->map;
++ int nMap = cw->pInputMesh->nMap;
++
++ while (nMap--)
++ {
++ if (!map->parent.area)
++ continue;
++
++ if (XYInTriangle (&map->parent.tri, parentX, parentY))
++ {
++ XYMapPoint (&map->parent, &map->child,
++ parentX, parentY,
++ childX, childY);
++ /* Credit to Joel Bosveld for this little bit,
++ * it is a hack, but it fixes the problem where
++ * the mesh could only end up in the top left corner
++ */
++ *childX += pChild->drawable.x;
++ *childY += pChild->drawable.y;
++ return TRUE;
++ }
++
++ map++;
++ }
++ }
++
++ *childX = parentX;
++ *childY = parentY;
++
++ /* No input mesh, handle input as normal */
++
++ if (!cw || !cw->pInputMesh)
++ return TRUE;
++
++ if (cw && cw->pInputMesh)
++ return FALSE;
++
++ return FALSE;
++}
++
++Bool
++CompositeXYChildToParent (WindowPtr pChild,
++ int childX,
++ int childY,
++ int *parentX,
++ int *parentY)
++{
++ CompWindowPtr cw = GetCompWindow (pChild);
++
++ if (cw && cw->pInputMesh)
++ {
++ CompTriangleMap *map = cw->pInputMesh->map;
++ int nMap = cw->pInputMesh->nMap;
++
++ while (nMap--)
++ {
++ if (!map->child.area)
++ continue;
++
++ if (XYInTriangle (&map->child.tri, childX, childY))
++ {
++ XYMapPoint (&map->child, &map->parent,
++ childX, childY,
++ parentX, parentY);
++
++ return TRUE;
++ }
++
++ map++;
++ }
++ }
++
++ *parentX = childX;
++ *parentY = childY;
++
++ /* No input mesh, handle input as normal */
++
++ if (!cw || !cw->pInputMesh)
++ return TRUE;
++
++ if (cw && cw->pInputMesh)
++ return FALSE;
++
++ return FALSE;
++}
++
++void
++CompositeXYScreenToWindowRootCoordinate (WindowPtr pWin,
++ int x,
++ int y,
++ int *rootX,
++ int *rootY)
++{
++ if (!pWin->parent)
++ {
++ *rootX = x;
++ *rootY = y;
++ }
++ else
++ {
++ CompositeXYScreenToWindowRootCoordinate (pWin->parent, x, y, &x, &y);
++ CompositeXYParentToChild (pWin, x, y, rootX, rootY);
++ }
++}
++
++void
++CompositeXYScreenFromWindowRootCoordinate (WindowPtr pWin,
++ int x,
++ int y,
++ int *screenX,
++ int *screenY)
++{
++ if (!pWin->parent)
++ {
++ *screenX = x;
++ *screenY = y;
++ }
++ else
++ {
++ CompositeXYChildToParent (pWin, x, y, &x, &y);
++ CompositeXYScreenFromWindowRootCoordinate (pWin->parent,
++ x, y, screenX, screenY);
++ }
++}
++
++int
++CompositeSetTriangularCoordinateMesh (ClientPtr pClient,
++ WindowPtr pWin,
++ int n,
++ xTriangle *tri)
++{
++ CompSubwindowsPtr csw = GetCompSubwindows (pWin->parent);
++ CompWindowPtr cw = GetCompWindow (pWin);
++ CompClientWindowPtr ccw;
++ WindowPtr pSpriteWin;
++
++ /*
++ * sub-window must be Manual update
++ */
++ if (!csw || csw->update != CompositeRedirectManual)
++ return BadAccess;
++
++ /*
++ * must be Manual update client
++ */
++ for (ccw = csw->clients; ccw; ccw = ccw->next)
++ if (ccw->update == CompositeRedirectManual &&
++ CLIENT_ID (ccw->id) != pClient->index)
++ return BadAccess;
++
++ if (n)
++ {
++ CompTriangularMeshPtr mesh;
++ int i;
++
++ mesh = xalloc (sizeof (CompTriangularMeshRec) +
++ sizeof (CompTriangleMap) * n / 2);
++ if (!mesh)
++ return FALSE;
++
++ mesh->map = (CompTriangleMap *) (mesh + 1);
++ mesh->nMap = n / 2;
++
++ for (i = 0; i < n; i += 2)
++ {
++ mesh->map[i / 2].parent.tri = tri[i];
++ mesh->map[i / 2].parent.area =
++ TriangleArea (&tri[i].p1, &tri[i].p2, &tri[i].p3);
++
++ mesh->map[i / 2].child.tri = tri[i + 1];
++ mesh->map[i / 2].child.area =
++ TriangleArea (&tri[i + 1].p1, &tri[i + 1].p2, &tri[i + 1].p3);
++ }
++
++ if (cw->pInputMesh)
++ xfree (cw->pInputMesh);
++
++ cw->pInputMesh = mesh;
++ }
++ else
++ {
++ if (cw->pInputMesh)
++ {
++ xfree (cw->pInputMesh);
++ cw->pInputMesh = NULL;
++ }
++ }
++
++ /*pSpriteWin = GetSpriteWindow (inputInfo.devices);
++ while (pSpriteWin)
++ {
++ if (pSpriteWin == pWin->parent)
++ {
++ xEvent xE;
++ int x, y;
++
++ GetSpritePosition (inputInfo.devices, &x, &y);
++
++ xE.u.keyButtonPointer.rootX = x;
++ xE.u.keyButtonPointer.rootY = y;
++ xE.u.keyButtonPointer.time = currentTime.milliseconds;
++ xE.u.u.type = MotionNotify;
++
++ (*inputInfo.pointer->public.processInputProc) (&xE,
++ inputInfo.pointer,
++ 1);
++ break;
++ }
++
++ pSpriteWin = pSpriteWin->parent;
++ }*/
++
++ return 0;
++}
+diff --git a/dix/events.c b/dix/events.c
+index d6b3ecb..7e3b0b5 100644
+--- a/dix/events.c
++++ b/dix/events.c
+@@ -133,6 +133,9 @@ of the copyright holder.
+ #include "panoramiX.h"
+ #include "panoramiXsrv.h"
+ #endif
++#ifdef COMPOSITE
++#include "compint.h"
++#endif
+ #include "globals.h"
+
+ #ifdef XKB
+@@ -1962,7 +1965,7 @@ ReleaseActiveGrabs(ClientPtr client)
+ * client.
+ */
+ _X_EXPORT int
+-TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
++TryClientEvents (ClientPtr client, xEvent *pEvents,
+ int count, Mask mask, Mask filter, GrabPtr grab)
+ {
+ int i;
+@@ -1982,15 +1985,6 @@ TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
+ {
+ if (mask & PointerMotionHintMask)
+ {
+- if (WID(dev->valuator->motionHintWindow) ==
+- pEvents->u.keyButtonPointer.event)
+- {
+-#ifdef DEBUG_EVENTS
+- ErrorF("[dix] \n");
+- ErrorF("[dix] motionHintWindow == keyButtonPointer.event\n");
+-#endif
+- return 1; /* don't send, but pretend we did */
+- }
+ pEvents->u.u.detail = NotifyHint;
+ }
+ else
+@@ -2092,7 +2086,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
+
+ if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count))
+ /* do nothing */;
+- else if ( (attempt = TryClientEvents(wClient(pWin), pDev, pEvents,
++ else if ( (attempt = TryClientEvents(wClient(pWin), pEvents,
+ count, pWin->eventMask,
+ filter, grab)) )
+ {
+@@ -2131,7 +2125,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
+ if (XaceHook(XACE_RECEIVE_ACCESS, rClient(gmask), pWin,
+ pEvents, count))
+ /* do nothing */;
+- else if (TryClientEvents(rClient(gmask), pDev,
++ else if (TryClientEvents(rClient(gmask),
+ pEvents, count,
+ gmask->eventMask[GEEXTIDX(pEvents)],
+ filter, grab) > 0)
+@@ -2166,7 +2160,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
+ if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin,
+ pEvents, count))
+ /* do nothing */;
+- else if ( (attempt = TryClientEvents(rClient(other), pDev,
++ else if ( (attempt = TryClientEvents(rClient(other),
+ pEvents, count,
+ other->mask[mskidx],
+ filter, grab)) )
+@@ -2295,7 +2289,7 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
+ #endif
+ if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count))
+ return 1; /* don't send, but pretend we did */
+- return TryClientEvents(wClient(pWin), NULL, pEvents, count,
++ return TryClientEvents(wClient(pWin), pEvents, count,
+ pWin->eventMask, filter, NullGrab);
+ }
+ for (other = wOtherClients(pWin); other; other = other->next)
+@@ -2312,7 +2306,7 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
+ if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents,
+ count))
+ return 1; /* don't send, but pretend we did */
+- return TryClientEvents(rClient(other), NULL, pEvents, count,
++ return TryClientEvents(rClient(other), pEvents, count,
+ other->mask, filter, NullGrab);
+ }
+ }
+@@ -2602,10 +2596,12 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
+ * @returns the window at the given coordinates.
+ */
+ static WindowPtr
+-XYToWindow(DeviceIntPtr pDev, int x, int y)
++XYToWindow(DeviceIntPtr pDev, int rootX, int rootY)
+ {
+ WindowPtr pWin;
++ Bool shouldHandle = TRUE;;
+ BoxRec box;
++ int x, y;
+ SpritePtr pSprite;
+
+ pSprite = pDev->spriteInfo->sprite;
+@@ -2613,7 +2609,33 @@ XYToWindow(DeviceIntPtr pDev, int x, int y)
+ pWin = RootWindow(pDev)->firstChild;
+ while (pWin)
+ {
+- if ((pWin->mapped) &&
++ x = rootX;
++ y = rootY;
++
++#ifdef COMPOSITE
++ /*
++ * Transform from parent to child.
++ */
++ if (pWin->mapped)
++ {
++ if (pWin->parent)
++ {
++ x = rootX - pWin->parent->drawable.x;
++ y = rootY - pWin->parent->drawable.y;
++ }
++
++ shouldHandle = CompositeXYParentToChild (pWin, x, y, &x, &y);
++
++ if (pWin->parent)
++ {
++ x += pWin->parent->drawable.x;
++ y += pWin->parent->drawable.y;
++ }
++ }
++#endif
++
++
++ if ((pWin->mapped) && (shouldHandle) &&
+ (x >= pWin->drawable.x - wBorderWidth (pWin)) &&
+ (x < pWin->drawable.x + (int)pWin->drawable.width +
+ wBorderWidth(pWin)) &&
+@@ -2649,6 +2671,8 @@ XYToWindow(DeviceIntPtr pDev, int x, int y)
+ Must_have_memory = FALSE; /* XXX */
+ }
+ pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin;
++ rootX = x;
++ rootY = y;
+ pWin = pWin->firstChild;
+ }
+ else
+@@ -3456,7 +3480,7 @@ CheckPassiveGrabsOnWindow(
+
+ FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
+
+- (void) TryClientEvents(rClient(grab), device, xE, count,
++ (void) TryClientEvents(rClient(grab), xE, count,
+ filters[device->id][xE->u.u.type],
+ filters[device->id][xE->u.u.type], grab);
+
+@@ -3704,7 +3728,7 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
+
+ if (GEEventFill(xE))
+ GEEventFill(xE)(ge, thisDev, grab->window, grab);
+- deliveries = TryClientEvents(rClient(grab), thisDev, xE,
++ deliveries = TryClientEvents(rClient(grab), xE,
+ count, gemask->eventMask[GEEXTIDX(ge)],
+ generic_filters[GEEXTIDX(ge)][ge->evtype],
+ grab);
+@@ -3729,7 +3753,7 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
+ else if (!IsInterferingGrab(rClient(grab), thisDev,
+ &core))
+ {
+- deliveries = TryClientEvents(rClient(grab), thisDev,
++ deliveries = TryClientEvents(rClient(grab),
+ &core, 1, mask,
+ filters[thisDev->id][core.u.u.type],
+ grab);
+@@ -3756,7 +3780,7 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
+ else
+ {
+ deliveries =
+- TryClientEvents(rClient(grab), thisDev,
++ TryClientEvents(rClient(grab),
+ xE, count,
+ mask,
+ filters[thisDev->id][xE->u.u.type],
+@@ -4454,7 +4478,7 @@ EnterLeaveEvent(
+ if ((mask & filters[mouse->id][type]) && sendevent)
+ {
+ if (grab)
+- TryClientEvents(rClient(grab), mouse, &event, 1, mask,
++ TryClientEvents(rClient(grab), &event, 1, mask,
+ filters[mouse->id][type], grab);
+ else
+ DeliverEventsToWindow(mouse, pWin, &event, 1,
+@@ -4482,7 +4506,7 @@ EnterLeaveEvent(
+ inputMasks->deliverableEvents[mskidx]))
+ {
+ if (devgrab)
+- (void)TryClientEvents(rClient(devgrab), mouse,
++ (void)TryClientEvents(rClient(devgrab),
+ (xEvent*)devEnterLeave, 1,
+ mask, filters[mouse->id][devEnterLeave->type],
+ devgrab);
+@@ -4504,7 +4528,7 @@ EnterLeaveEvent(
+
+ ke.type = KeymapNotify;
+ if (grab)
+- (void)TryClientEvents(rClient(grab), keybd, (xEvent *)&ke, 1,
++ (void)TryClientEvents(rClient(grab), (xEvent *)&ke, 1,
+ mask, KeymapStateMask, grab);
+ else
+ (void)DeliverEventsToWindow(mouse, pWin, (xEvent *)&ke, 1,
+@@ -5399,6 +5423,7 @@ ProcQueryPointer(ClientPtr client)
+ DeviceIntPtr mouse = PickPointer(client);
+ SpritePtr pSprite;
+ int rc;
++ int rootX, rootY;
+ REQUEST(xResourceReq);
+ REQUEST_SIZE_MATCH(xResourceReq);
+
+@@ -5417,14 +5442,30 @@ ProcQueryPointer(ClientPtr client)
+ rep.mask = mouse->button->state | inputInfo.keyboard->key->state;
+ rep.length = 0;
+ rep.root = (RootWindow(mouse))->drawable.id;
+- rep.rootX = pSprite->hot.x;
+- rep.rootY = pSprite->hot.y;
++ //rep.rootX = pSprite->hot.x;
++ //rep.rootY = pSprite->hot.y;
+ rep.child = None;
++
++#ifdef COMPOSITE
++ /*
++ * Return coordinates in windows root coordinate space.
++ */
++ CompositeXYScreenToWindowRootCoordinate (pWin,
++ pSprite->hot.x, pSprite->hot.y,
++ &rootX, &rootY);
++ rep.rootX = rootX;
++ rep.rootY = rootY;
++#else
++ rep.rootX = rootX = pSprite->hot.x;
++ rep.rootY = rootY = pSprite->hot.y;
++#endif
++
++
+ if (pSprite->hot.pScreen == pWin->drawable.pScreen)
+ {
+ rep.sameScreen = xTrue;
+- rep.winX = pSprite->hot.x - pWin->drawable.x;
+- rep.winY = pSprite->hot.y - pWin->drawable.y;
++ rep.winX = rootX - pWin->drawable.x;
++ rep.winY = rootY - pWin->drawable.y;
+ for (t = pSprite->win; t; t = t->parent)
+ if (t->parent == pWin)
+ {
+@@ -6089,12 +6130,96 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
+ xEvent *eventTo, *eventFrom;
+ int i,
+ eventlength = sizeof(xEvent);
++#ifdef COMPOSITE
++ xEvent stackCopy;
++ xEvent *compEventCopy = &stackCopy;
++#endif
+
+ #ifdef XKB
+ if ((!noXkbExtension)&&(!XkbFilterEvents(pClient, count, events)))
+ return;
+ #endif
+
++#ifdef COMPOSITE
++ if (count > 1)
++ {
++ Must_have_memory = TRUE; /* XXX */
++ compEventCopy = xalloc (count * sizeof (xEvent));
++ Must_have_memory = FALSE; /* XXX */
++ }
++
++ memcpy (compEventCopy, events, count * sizeof (xEvent));
++ events = compEventCopy;
++
++ for (i = 0; i < count; i++)
++ {
++ deviceKeyButtonPointer *deviceEvent;
++ WindowPtr pWin;
++ int x, y, dx, dy;
++
++ switch (events[i].u.u.type) {
++ case MotionNotify:
++ case ButtonPress:
++ case ButtonRelease:
++ case KeyPress:
++ case KeyRelease:
++ case EnterNotify:
++ case LeaveNotify:
++ pWin = LookupIDByType (events[i].u.keyButtonPointer.event,
++ RT_WINDOW);
++ if (pWin)
++ {
++ x = events[i].u.keyButtonPointer.rootX;
++ y = events[i].u.keyButtonPointer.rootY;
++
++ /*
++ * rootX and rootY are in screen coordinate space.
++ * Transform to windows root coordinate space before writing
++ * events to client.
++ */
++ CompositeXYScreenToWindowRootCoordinate (pWin, x, y, &x, &y);
++
++ dx = x - events[i].u.keyButtonPointer.rootX;
++ dy = y - events[i].u.keyButtonPointer.rootY;
++
++ events[i].u.keyButtonPointer.rootX += dx;
++ events[i].u.keyButtonPointer.rootY += dy;
++ events[i].u.keyButtonPointer.eventX += dx;
++ events[i].u.keyButtonPointer.eventY += dy;
++ }
++ break;
++ default:
++ if (events[i].u.u.type == DeviceMotionNotify ||
++ events[i].u.u.type == DeviceButtonPress ||
++ events[i].u.u.type == DeviceButtonRelease ||
++ events[i].u.u.type == DeviceKeyPress ||
++ events[i].u.u.type == DeviceKeyRelease)
++ {
++ deviceEvent = (deviceKeyButtonPointer *) &events[i];
++
++ pWin = LookupIDByType (deviceEvent->event, RT_WINDOW);
++ if (pWin)
++ {
++ x = deviceEvent->root_x;
++ y = deviceEvent->root_y;
++
++ CompositeXYScreenToWindowRootCoordinate (pWin, x, y,
++ &x, &y);
++
++ dx = x - deviceEvent->root_x;
++ dy = y - deviceEvent->root_y;
++
++ deviceEvent->root_x += dx;
++ deviceEvent->root_y += dy;
++ deviceEvent->event_x += dx;
++ deviceEvent->event_y += dy;
++ }
++ }
++ break;
++ }
++ }
++#endif
++
+ #ifdef PANORAMIX
+ if(!noPanoramiXExtension &&
+ (panoramiXdataPtr[0].x || panoramiXdataPtr[0].y))
+@@ -6194,6 +6319,12 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
+ * matter. And we're all set. Woohoo. */
+ (void)WriteToClient(pClient, count * eventlength, (char *) events);
+ }
++
++#ifdef COMPOSITE
++ if (compEventCopy != &stackCopy)
++ xfree (compEventCopy);
++#endif
++
+ }
+
+ /*
+diff --git a/dix/selection.c b/dix/selection.c
+index c5427e0..6a9198e 100644
+--- a/dix/selection.c
++++ b/dix/selection.c
+@@ -189,7 +189,7 @@ ProcSetSelectionOwner(ClientPtr client)
+ event.u.selectionClear.time = time.milliseconds;
+ event.u.selectionClear.window = pSel->window;
+ event.u.selectionClear.atom = pSel->selection;
+- TryClientEvents(pSel->client, NULL, &event, 1, NoEventMask,
++ TryClientEvents(pSel->client, &event, 1, NoEventMask,
+ NoEventMask /* CantBeFiltered */, NullGrab);
+ }
+ }
+@@ -294,7 +294,7 @@ ProcConvertSelection(ClientPtr client)
+ event.u.selectionRequest.selection = stuff->selection;
+ event.u.selectionRequest.target = stuff->target;
+ event.u.selectionRequest.property = stuff->property;
+- if (TryClientEvents(pSel->client, NULL, &event, 1, NoEventMask,
++ if (TryClientEvents(pSel->client, &event, 1, NoEventMask,
+ NoEventMask /* CantBeFiltered */, NullGrab))
+ return client->noClientException;
+ }
+@@ -305,7 +305,7 @@ ProcConvertSelection(ClientPtr client)
+ event.u.selectionNotify.selection = stuff->selection;
+ event.u.selectionNotify.target = stuff->target;
+ event.u.selectionNotify.property = None;
+- TryClientEvents(client, NULL, &event, 1, NoEventMask,
++ TryClientEvents(client, &event, 1, NoEventMask,
+ NoEventMask /* CantBeFiltered */, NullGrab);
+ return client->noClientException;
+ }
+diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
+index a7e24a6..01eb32c 100644
+--- a/hw/xfree86/common/xf86DGA.c
++++ b/hw/xfree86/common/xf86DGA.c
+@@ -1052,7 +1052,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr keybd)
+ if (pScreenPriv->client)
+ {
+ /* If the DGA client has selected input, then deliver based on the usual filter */
+- TryClientEvents (pScreenPriv->client, keybd, (xEvent *) de, 1,
++ TryClientEvents (pScreenPriv->client, (xEvent *) de, 1,
+ filters[coreEquiv], pScreenPriv->input, 0);
+ }
+ else
+@@ -1099,7 +1099,7 @@ DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse)
+ if (pScreenPriv->client)
+ {
+ /* If the DGA client has selected input, then deliver based on the usual filter */
+- TryClientEvents (pScreenPriv->client, mouse, (xEvent *) de, 1,
++ TryClientEvents (pScreenPriv->client, (xEvent *) de, 1,
+ filters[coreEquiv], pScreenPriv->input, 0);
+ }
+ else
+diff --git a/include/dix.h b/include/dix.h
+index 4b8a96e..82bead9 100644
+--- a/include/dix.h
++++ b/include/dix.h
+@@ -492,7 +492,6 @@ extern void WriteEventsToClient(
+
+ extern int TryClientEvents(
+ ClientPtr /*client*/,
+- DeviceIntPtr /* device */,
+ xEventPtr /*pEvents*/,
+ int /*count*/,
+ Mask /*mask*/,
+diff --git a/mi/miexpose.c b/mi/miexpose.c
+index 7da1324..79cde61 100644
+--- a/mi/miexpose.c
++++ b/mi/miexpose.c
+@@ -371,7 +371,7 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
+ pe->u.graphicsExposure.majorEvent = major;
+ pe->u.graphicsExposure.minorEvent = minor;
+ }
+- TryClientEvents(client, NULL, pEvent, numRects,
++ TryClientEvents(client, pEvent, numRects,
+ (Mask)0, NoEventMask, NullGrab);
+ xfree(pEvent);
+ }
+@@ -382,7 +382,7 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
+ event.u.noExposure.drawable = drawable;
+ event.u.noExposure.majorEvent = major;
+ event.u.noExposure.minorEvent = minor;
+- TryClientEvents(client, NULL, &event, 1,
++ TryClientEvents(client, &event, 1,
+ (Mask)0, NoEventMask, NullGrab);
+ }
+ }
+--
+1.5.6
+
diff --git a/xorg/xserver/0001-XTriangle-Input-Mesh-Redirection-Support.patch b/xorg/xserver/master/0001-XTriangle-Input-Mesh-Redirection-Support.patch
index d5c55fc..d5c55fc 100644
--- a/xorg/xserver/0001-XTriangle-Input-Mesh-Redirection-Support.patch
+++ b/xorg/xserver/master/0001-XTriangle-Input-Mesh-Redirection-Support.patch
diff --git a/xorg/xserver/0002-Proprietary-Driver-Workarounds.patch b/xorg/xserver/master/0002-Proprietary-Driver-Workarounds.patch
index 4ff1bab..4ff1bab 100644
--- a/xorg/xserver/0002-Proprietary-Driver-Workarounds.patch
+++ b/xorg/xserver/master/0002-Proprietary-Driver-Workarounds.patch