summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@XPS-SUSE.site>2008-11-20 12:08:48 +0900
committerSam Spilsbury <Sam@XPS-SUSE.site>2008-11-20 12:08:48 +0900
commit7d35ef86384f0e8d85f1aaadaf2eeab6fcbf768b (patch)
treef346eae7268c80f5c9cd80fae6e6ae3bfbf1816d
parent49bb8e0f88f7896e4dffb2d493ccd00c353c7f78 (diff)
downloadcompiz-mpx-ir-7d35ef86384f0e8d85f1aaadaf2eeab6fcbf768b.tar.gz
compiz-mpx-ir-7d35ef86384f0e8d85f1aaadaf2eeab6fcbf768b.tar.bz2
Fix a number of bugs, including input being cut off at the edges and input not updating on window position sync
-rw-r--r--compiz/0003-XComposite-Triangular-Mesh-Input-Redirection-in-core.patch948
-rw-r--r--compiz/0004-CompMesh-based-Input-Redirection-support-in-plugins.patch746
-rw-r--r--compiz/0005-MPX-and-IR-Decoration-Support.patch210
3 files changed, 0 insertions, 1904 deletions
diff --git a/compiz/0003-XComposite-Triangular-Mesh-Input-Redirection-in-core.patch b/compiz/0003-XComposite-Triangular-Mesh-Input-Redirection-in-core.patch
deleted file mode 100644
index 548eea9..0000000
--- a/compiz/0003-XComposite-Triangular-Mesh-Input-Redirection-in-core.patch
+++ /dev/null
@@ -1,948 +0,0 @@
-From d4756c89fcb29afd8c2305ebac3a2a7f971e8f6f Mon Sep 17 00:00:00 2001
-From: Sam Spilsbury <Sam@XPS-SUSE.site>
-Date: Fri, 7 Nov 2008 23:38:13 +0900
-Subject: [PATCH] XComposite Triangular Mesh Input Redirection in core
-
----
- include/compiz-core.h | 131 ++++++++++++++------
- src/display.c | 47 ++++---
- src/event.c | 324 +++++++++++++++++++++++++++++++++++++++++++++++++
- src/paint.c | 164 +++++++++++++++++++++++++
- src/screen.c | 3 +
- src/window.c | 14 ++
- 6 files changed, 627 insertions(+), 56 deletions(-)
-
-diff --git a/include/compiz-core.h b/include/compiz-core.h
-index 709f2ac..62038e1 100644
---- a/include/compiz-core.h
-+++ b/include/compiz-core.h
-@@ -48,6 +48,7 @@
-
- #include <GL/gl.h>
- #include <GL/glx.h>
-+#include <GL/glu.h>
-
- COMPIZ_BEGIN_DECLS
-
-@@ -81,7 +82,9 @@ typedef struct _CompCursor CompCursor;
- typedef struct _CompMatch CompMatch;
- typedef struct _CompOutput CompOutput;
- typedef struct _CompWalker CompWalker;
-+typedef struct _CompMesh CompMesh;
- typedef struct _CompDevice CompDevice;
-+typedef struct _CompTransform CompTransform;
-
- /* virtual modifiers */
-
-@@ -806,7 +809,10 @@ removeFileWatch (CompFileWatchHandle handle);
- #define COMP_DISPLAY_OPTION_RUN_TERMINAL_KEY 63
- #define COMP_DISPLAY_OPTION_PING_DELAY 64
- #define COMP_DISPLAY_OPTION_EDGE_DELAY 65
--#define COMP_DISPLAY_OPTION_NUM 66
-+#define COMP_DISPLAY_OPTION_MESH_MAX 66
-+#define COMP_DISPLAY_OPTION_MESH_MIN 67
-+#define COMP_DISPLAY_OPTION_REDIRECT_INPUT 68
-+#define COMP_DISPLAY_OPTION_NUM 69
-
- typedef void (*HandleEventProc) (CompDisplay *display,
- XEvent *event);
-@@ -1271,6 +1277,13 @@ findCursorAtDisplay (CompDisplay *display);
-
- /* event.c */
-
-+typedef int32_t pixman_fixed_16_16_t;
-+typedef pixman_fixed_16_16_t pixman_fixed_t;
-+#define pixman_int_to_fixed(i) ((pixman_fixed_t) ((i) << 16))
-+#define pixman_fixed_to_int(f) ((int) ((f) >> 16))
-+#define xFixedToInt(f) pixman_fixed_to_int(f)
-+#define IntToxFixed(i) pixman_int_to_fixed(i)
-+
- typedef struct _CompDelayedEdgeSettings
- {
- CompDisplay *d;
-@@ -1282,6 +1295,19 @@ typedef struct _CompDelayedEdgeSettings
- unsigned int nOption;
- } CompDelayedEdgeSettings;
-
-+struct _CompMesh
-+{
-+ XTriangle *triangles;
-+ int width;
-+ int height;
-+};
-+
-+typedef void (*TransformMeshProc) (CompWindow *window,
-+ CompTransform *transform,
-+ CompMesh *mesh,
-+ int meshIter,
-+ Bool needsProjection);
-+
- void
- handleEvent (CompDisplay *display,
- XEvent *event);
-@@ -1310,6 +1336,32 @@ void
- clearTargetOutput (CompDisplay *display,
- unsigned int mask);
-
-+void
-+transformMesh (CompWindow *w,
-+ CompTransform *transform,
-+ CompMesh *mesh,
-+ int meshIter,
-+ Bool needsProjection);
-+
-+void
-+updateMesh (CompWindow *w);
-+
-+void
-+setMeshMin (CompWindow *w,
-+ int newMin,
-+ Bool override);
-+
-+void
-+setMeshMax (CompWindow *w,
-+ int newMax,
-+ Bool override);
-+
-+int
-+incrementMesh (CompWindow *w);
-+
-+void
-+decrementMesh (CompWindow *w, int meshIter);
-+
- /* paint.c */
-
- #define MULTIPLY_USHORT(us1, us2) \
-@@ -1320,9 +1372,9 @@ clearTargetOutput (CompDisplay *display,
-
- #define DEG2RAD (M_PI / 180.0f)
-
--typedef struct _CompTransform {
-+struct _CompTransform {
- float m[16];
--} CompTransform;
-+};
-
- typedef union _CompVector {
- float v[4];
-@@ -1459,7 +1511,7 @@ struct _CompWalker {
- #define PAINT_WINDOW_OCCLUSION_DETECTION_MASK (1 << 1)
-
- /*
-- this flag indicates that the window ist painted with
-+ this flag indicates that the window is painted with
- an offset
- */
- #define PAINT_WINDOW_WITH_OFFSET_MASK (1 << 2)
-@@ -2236,6 +2288,8 @@ struct _CompScreen {
- OutputChangeNotifyProc outputChangeNotify;
-
- InitWindowWalkerProc initWindowWalker;
-+
-+ TransformMeshProc transformMesh;
- };
-
- #define GET_CORE_SCREEN(object) ((CompScreen *) (object))
-@@ -2695,10 +2749,46 @@ struct _CompWindow {
- int texCoordSize;
- int indexCount;
-
-+ /* Input mesh parameters */
-+
-+ int nMesh;
-+ int meshMin;
-+ int meshMax;
-+
- /* must be set by addWindowGeometry */
- DrawWindowGeometryProc drawWindowGeometry;
- };
-
-+struct _CompDevice {
-+ XDevice *dev;
-+ int id;
-+ int use;
-+ int paired;
-+ XEventClass cls_btpress;
-+ XEventClass cls_btrelease;
-+ XEventClass cls_motion;
-+ XEventClass cls_enter;
-+ XEventClass cls_leave;
-+ XEventClass cls_kpress;
-+ XEventClass cls_krelease;
-+ XEventClass cls_focusin;
-+ XEventClass cls_focusout;
-+
-+ CompGrab *grabs;
-+ int grabSize;
-+ int maxGrab;
-+
-+ CompButtonGrab *buttonGrab;
-+ int nButtonGrab;
-+ CompKeyGrab *keyGrab;
-+ int nKeyGrab;
-+
-+ int pointerX;
-+ int pointerY;
-+ int lastPointerX;
-+ int lastPointerY;
-+};
-+
- #define GET_CORE_WINDOW(object) ((CompWindow *) (object))
- #define CORE_WINDOW(object) CompWindow *w = GET_CORE_WINDOW (object)
-
-@@ -3507,37 +3597,8 @@ compReadXmlChunkFromMetadataOptionInfo (const CompMetadataOptionInfo *info,
- char *buffer,
- int length);
-
-+/* XInput device-related stuff */
- /* devices.c */
--struct _CompDevice {
-- XDevice *dev;
-- int id;
-- int use;
-- int paired;
-- XEventClass cls_btpress;
-- XEventClass cls_btrelease;
-- XEventClass cls_motion;
-- XEventClass cls_enter;
-- XEventClass cls_leave;
-- XEventClass cls_kpress;
-- XEventClass cls_krelease;
-- XEventClass cls_focusin;
-- XEventClass cls_focusout;
--
-- CompGrab *grabs;
-- int grabSize;
-- int maxGrab;
--
-- CompButtonGrab *buttonGrab;
-- int nButtonGrab;
-- CompKeyGrab *keyGrab;
-- int nKeyGrab;
--
-- int pointerX;
-- int pointerY;
-- int lastPointerX;
-- int lastPointerY;
--};
--
- Bool
- compInitDeviceList (CompDisplay *display);
-
-@@ -3574,8 +3635,6 @@ otherDeviceGrabExist (CompDevice *dev,
- void
- compRegisterXIEvents(CompDisplay *d,
- Window w);
--
--
- COMPIZ_END_DECLS
-
- #endif
-diff --git a/src/display.c b/src/display.c
-index 5cd29ad..119ed65 100644
---- a/src/display.c
-+++ b/src/display.c
-@@ -681,7 +681,10 @@ const CompMetadataOptionInfo coreDisplayOptionInfo[COMP_DISPLAY_OPTION_NUM] = {
- { "command_terminal", "string", 0, 0, 0 },
- { "run_command_terminal_key", "key", 0, runCommandTerminal, 0 },
- { "ping_delay", "int", "<min>1000</min>", 0, 0 },
-- { "edge_delay", "int", "<min>0</min>", 0, 0 }
-+ { "edge_delay", "int", "<min>0</min>", 0, 0 },
-+ { "mesh_max", "int", 0, 0, 0 },
-+ { "mesh_min", "int", 0, 0, 0 },
-+ { "redirect_input", "bool", 0, 0, 0}
- };
-
- CompOption *
-@@ -1476,8 +1479,8 @@ eventLoop (void)
- CompDisplay *d;
- CompScreen *s;
- CompWindow *w;
-- CompTimeout *t;
- CompDevice *dev;
-+ CompTimeout *t;
- int time, timeToNextRedraw = 0;
- unsigned int damageMask, mask;
-
-@@ -1585,12 +1588,14 @@ eventLoop (void)
- compRemoveDevice(d, pev->deviceid);
- }
-
-- lastPointerX = pointerX;
-- lastPointerY = pointerY;
-- for (dev = d->devices; dev->id != -1; dev++)
-+ if (dev)
- {
- dev->lastPointerX = dev->pointerX;
- dev->lastPointerY = dev->pointerY;
-+ } else
-+ {
-+ lastPointerX = pointerX;
-+ lastPointerY = pointerY;
- }
- }
- }
-@@ -2065,6 +2070,8 @@ addDisplay (const char *name)
-
- snprintf (d->displayString, 255, "DISPLAY=%s", DisplayString (dpy));
-
-+ compInitDeviceList(d);
-+
- #ifdef DEBUG
- XSynchronize (dpy, TRUE);
- #endif
-@@ -2350,8 +2357,6 @@ addDisplay (const char *name)
-
- addDisplayToCore (d);
-
-- compInitDeviceList (d);
--
- /* TODO: bailout properly when objectInitPlugins fails */
- assert (objectInitPlugins (&d->base));
-
-@@ -2525,19 +2530,21 @@ addDisplay (const char *name)
- ExposureMask);
- compRegisterXIEvents(d, XRootWindow(dpy, i));
- } else
-- XSelectInput (dpy, XRootWindow (dpy, i),
-- SubstructureRedirectMask |
-- SubstructureNotifyMask |
-- StructureNotifyMask |
-- PropertyChangeMask |
-- LeaveWindowMask |
-- EnterWindowMask |
-- KeyPressMask |
-- KeyReleaseMask |
-- ButtonPressMask |
-- ButtonReleaseMask |
-- FocusChangeMask |
-- ExposureMask);
-+ {
-+ XSelectInput (dpy, XRootWindow (dpy, i),
-+ SubstructureRedirectMask |
-+ SubstructureNotifyMask |
-+ StructureNotifyMask |
-+ PropertyChangeMask |
-+ LeaveWindowMask |
-+ EnterWindowMask |
-+ KeyPressMask |
-+ KeyReleaseMask |
-+ ButtonPressMask |
-+ ButtonReleaseMask |
-+ FocusChangeMask |
-+ ExposureMask);
-+ }
-
- if (compCheckForError (dpy))
- {
-diff --git a/src/event.c b/src/event.c
-index 4dbcc1b..909b708 100644
---- a/src/event.c
-+++ b/src/event.c
-@@ -2588,3 +2588,327 @@ handleEvent (CompDisplay *d,
- break;
- }
- }
-+
-+static CompMesh *
-+createMesh (CompWindow *win,
-+ int offX,
-+ int offY,
-+ int width,
-+ int height)
-+{
-+ CompMesh *mesh;
-+ int i;
-+ int w, h;
-+ int nTriangle = 0;
-+
-+ mesh = calloc (1, sizeof (CompMesh));
-+ if (!mesh)
-+ return FALSE;
-+
-+ mesh->width = MIN (win->meshMin, width);
-+ mesh->height = MIN (win->meshMin, height);
-+ mesh->triangles = NULL;
-+ mesh->triangles = calloc (1, ((mesh->width * mesh->height) * 2) * sizeof(XTriangle));
-+
-+ for (h = 0; h < mesh->height; h++)
-+ {
-+ for (w = 0; w < mesh->width; w++)
-+ {
-+ for (i = 1; i <= 2; i++)
-+ {
-+ int x1, x2, y1, y2;
-+ x1 = (int) offX + (width / mesh->width) * w;
-+ x2 = (int) offX + (width / mesh->width) * (w + 1);
-+ y1 = (int) offY + (height / mesh->height) * h;
-+ y2 = (int) offY + (height / mesh->height) * (h + 1);
-+ switch (i)
-+ {
-+ case 1: /* Triangle is right-side up (first triangle in rectangle) */
-+ mesh->triangles[nTriangle].p1.x = IntToxFixed (x1);
-+ mesh->triangles[nTriangle].p1.y = IntToxFixed (y1);
-+ mesh->triangles[nTriangle].p2.x = IntToxFixed (x1);
-+ mesh->triangles[nTriangle].p2.y = IntToxFixed (y2);
-+ mesh->triangles[nTriangle].p3.x = IntToxFixed (x2);
-+ mesh->triangles[nTriangle].p3.y = IntToxFixed (y2);
-+
-+ nTriangle++;
-+
-+ break;
-+ case 2: /* Triangle is right-side up (first triangle in rectangle) */
-+ mesh->triangles[nTriangle].p1.x = IntToxFixed (x1);
-+ mesh->triangles[nTriangle].p1.y = IntToxFixed (y1);
-+ mesh->triangles[nTriangle].p2.x = IntToxFixed (x2);
-+ mesh->triangles[nTriangle].p2.y = IntToxFixed (y1);
-+ mesh->triangles[nTriangle].p3.x = IntToxFixed (x2);
-+ mesh->triangles[nTriangle].p3.y = IntToxFixed (y2);
-+
-+ nTriangle++;
-+
-+ break;
-+ default:
-+ break;
-+ }
-+ }
-+ }
-+ }
-+
-+ return mesh;
-+}
-+
-+static CompMesh *
-+getDefaultChildMesh (CompWindow *w)
-+{
-+ return createMesh (w, 0, 0, w->serverWidth, w->serverHeight);
-+}
-+
-+static CompMesh *
-+getDefaultParentMesh (CompWindow *w)
-+{
-+ return createMesh (w, w->serverX, w->serverY, w->serverWidth, w->serverHeight);
-+}
-+
-+static void
-+combineMeshes (CompMesh *combined, CompMesh *child, CompMesh *parent)
-+{
-+ int iTriangle;
-+ int iParent = 0;
-+ int iChild = 0;
-+ int nTriangles = parent->width * parent->height * 4;
-+
-+ combined->width = parent->width;
-+ combined->height = parent->height;
-+ combined->triangles = NULL;
-+ combined->triangles = calloc (1, ((combined->width * combined->height) * 4) * sizeof(XTriangle));
-+
-+ for (iTriangle = 0; iTriangle < nTriangles; )
-+ {
-+ memcpy(&combined->triangles[iTriangle], &parent->triangles[iParent], sizeof (XTriangle));
-+ iParent++;
-+ iTriangle++;
-+ memcpy(&combined->triangles[iTriangle], &child->triangles[iChild], sizeof (XTriangle));
-+ iChild++;
-+ iTriangle++;
-+ }
-+
-+ free (child->triangles);
-+ free (parent->triangles);
-+ free (child);
-+ free (parent);
-+}
-+
-+static CompMesh *
-+combineMeshArray (CompMesh *combinedArray, int nMesh)
-+{
-+ CompMesh *total;
-+ int i;
-+ int iTriangle;
-+ int triangleOffset = 0, nTriangles = 0;
-+ int totalWidth = 0, totalHeight = 0;
-+
-+ total = calloc (1, sizeof (CompMesh));
-+
-+ if (!total)
-+ return NULL;
-+
-+ for (i = 0; i < nMesh; i++)
-+ {
-+ totalWidth += combinedArray[i].width;
-+ totalHeight += combinedArray[i].height;
-+ }
-+
-+ total->width = (int) (totalWidth / nMesh);
-+ total->height = (int) (totalHeight / nMesh);
-+
-+ total->triangles = calloc (1, ((totalWidth * totalHeight * 4) * nMesh * sizeof (XTriangle)));
-+ if (!total->triangles)
-+ return NULL;
-+
-+ for (i = 0; i < nMesh; i++)
-+ {
-+ nTriangles = combinedArray[i].width * combinedArray[i].height * 4;
-+ for (iTriangle = 0; iTriangle < nTriangles; iTriangle++)
-+ {
-+ memcpy(&total->triangles[triangleOffset + iTriangle], &combinedArray[i].triangles[iTriangle], sizeof (XTriangle));
-+ }
-+ triangleOffset += nTriangles;
-+ }
-+
-+ return total;
-+}
-+
-+static void
-+projectVector (CompScreen *s,
-+ CompTransform *transform,
-+ CompVector *vector)
-+{
-+ GLdouble resultX, resultY, resultZ;
-+
-+ matrixMultiplyVector(vector, vector, transform);
-+
-+ GLint viewport[4]; // Viewport
-+ GLdouble modelview[16]; // Modelview Matrix
-+ GLdouble projection[16]; // Projection Matrix
-+
-+ glGetIntegerv (GL_VIEWPORT, viewport);
-+ glGetDoublev (GL_MODELVIEW_MATRIX, modelview);
-+ glGetDoublev (GL_PROJECTION_MATRIX, projection);
-+
-+ gluProject (vector->x, vector->y, vector->z,
-+ modelview, projection, viewport,
-+ &resultX, &resultY, &resultZ);
-+
-+ /* Y must be negated */
-+ resultY = s->height - resultY;
-+
-+ vector->x = resultX;
-+ vector->y = resultY;
-+ vector->z = resultZ;
-+}
-+
-+void
-+transformMesh (CompWindow *w,
-+ CompTransform *transform,
-+ CompMesh *parent,
-+ int meshIter,
-+ Bool needsProjection)
-+{
-+ int nTriangles = parent->width * parent->height * 2;
-+ int i;
-+
-+ for (i = 0; i < nTriangles; i++)
-+ {
-+ CompVector t1Point = { .v = { xFixedToInt(parent->triangles[i].p1.x), xFixedToInt(parent->triangles[i].p1.y), 0.0f, 1.0f } };
-+ CompVector t2Point = { .v = { xFixedToInt(parent->triangles[i].p2.x), xFixedToInt(parent->triangles[i].p2.y), 0.0f, 1.0f } };
-+ CompVector t3Point = { .v = { xFixedToInt(parent->triangles[i].p3.x), xFixedToInt(parent->triangles[i].p3.y), 0.0f, 1.0f } };
-+
-+ if (needsProjection)
-+ projectVector (w->screen, transform, &t1Point);
-+ else
-+ matrixMultiplyVector(&t1Point, &t1Point, transform);
-+
-+ parent->triangles[i].p1.x = IntToxFixed((int) t1Point.x);
-+ parent->triangles[i].p1.y = IntToxFixed((int) t1Point.y);
-+
-+ if (needsProjection)
-+ projectVector (w->screen, transform, &t2Point);
-+ else
-+ matrixMultiplyVector(&t2Point, &t2Point, transform);
-+
-+ parent->triangles[i].p2.x = IntToxFixed((int) t2Point.x);
-+ parent->triangles[i].p2.y = IntToxFixed((int) t2Point.y);
-+
-+ if (needsProjection)
-+ projectVector (w->screen, transform, &t3Point);
-+ else
-+ matrixMultiplyVector(&t3Point, &t3Point, transform);
-+
-+ parent->triangles[i].p3.x = IntToxFixed((int) t3Point.x);
-+ parent->triangles[i].p3.y = IntToxFixed((int) t3Point.y);
-+ }
-+}
-+
-+void
-+setMeshMin (CompWindow *w,
-+ int newMin,
-+ Bool override)
-+{
-+ if (newMin < w->screen->display->opt[COMP_DISPLAY_OPTION_MESH_MIN].value.i)
-+ return;
-+
-+ if (newMin > w->meshMax)
-+ return;
-+
-+ if (newMin < w->meshMin && !override)
-+ return;
-+
-+ w->meshMin = newMin;
-+}
-+
-+void
-+setMeshMax (CompWindow *w,
-+ int newMax,
-+ Bool override)
-+{
-+ if (newMax > w->screen->display->opt[COMP_DISPLAY_OPTION_MESH_MAX].value.i)
-+ return;
-+
-+ if (newMax < w->meshMin)
-+ return;
-+
-+ if (newMax < w->meshMax && !override)
-+ return;
-+
-+ w->meshMax = newMax;
-+}
-+
-+int
-+incrementMesh (CompWindow *w)
-+{
-+ w->nMesh = w->nMesh + 1;
-+
-+ return w->nMesh;
-+}
-+
-+void
-+decrementMesh (CompWindow *w, int meshIter)
-+{
-+
-+ /* TODO: Need to implement something like screenGrabs */
-+
-+ w->nMesh = w->nMesh - 1;
-+
-+ if (w->nMesh < 1)
-+ w->nMesh = 1;
-+}
-+void
-+updateMesh (CompWindow *w)
-+{
-+ CompTransform transform;
-+ CompMesh *mesh, *child, combinedArray[w->nMesh], *total;
-+ int i;
-+ int nTriangles;
-+ matrixGetIdentity (&transform);
-+
-+ if (!w->screen->display->opt[COMP_DISPLAY_OPTION_REDIRECT_INPUT].value.b)
-+ return;
-+
-+ if (w->meshMin < 2 || w->meshMin > w->screen->display->opt[COMP_DISPLAY_OPTION_MESH_MAX].value.i)
-+ w->meshMin = w->screen->display->opt[COMP_DISPLAY_OPTION_MESH_MIN].value.i;
-+
-+ if (w->meshMax < 2 || w->meshMax > w->screen->display->opt[COMP_DISPLAY_OPTION_MESH_MIN].value.i)
-+ w->meshMax = w->screen->display->opt[COMP_DISPLAY_OPTION_MESH_MAX].value.i;
-+
-+ for (i = 0; i < w->nMesh; i++)
-+ {
-+
-+ mesh = getDefaultParentMesh (w);
-+
-+ if (!mesh || !mesh->triangles)
-+ return;
-+
-+ (*w->screen->transformMesh) (w, &transform, mesh, i, FALSE);
-+
-+ child = getDefaultChildMesh (w);
-+ combineMeshes (&combinedArray[i], child, mesh);
-+
-+ }
-+
-+ total = combineMeshArray (combinedArray, w->nMesh);
-+
-+ if (!total)
-+ return;
-+
-+ nTriangles = total->width * total->height * 4 * w->nMesh;
-+
-+ XCompositeSetTriangularCoordinateMesh (w->screen->display->display,
-+ w->id,
-+ total->triangles,
-+ nTriangles);
-+
-+ for (i = 0; i < w->nMesh; i++)
-+ free (combinedArray[i].triangles);
-+
-+ free (total->triangles);
-+ free (total);
-+
-+}
-diff --git a/src/paint.c b/src/paint.c
-index 59be51f..138bd75 100644
---- a/src/paint.c
-+++ b/src/paint.c
-@@ -29,6 +29,7 @@
-
- #include <compiz-core.h>
-
-+
- ScreenPaintAttrib defaultScreenPaintAttrib = {
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -DEFAULT_Z_CAMERA
- };
-@@ -407,6 +408,7 @@ paintOutputRegion (CompScreen *screen,
- }
- }
-
-+
- if (walk.fini)
- (*walk.fini) (screen, &walk);
-
-@@ -1245,6 +1247,166 @@ paintWindow (CompWindow *w,
- return TRUE;
- }
-
-+ /* The window was repainted, we need to recalculate it's input
-+ * mesh. The mesh accuracy is taken from core options
-+ * TODO: Needs to be an option */
-+
-+ /* The window is divided up into portions, depending on the mesh
-+ * accuracy - createMesh is wrappable so plugins can use the base
-+ * mesh and adjust it. Once the mesh is adjusted, it is applied
-+ * through X.
-+ */
-+
-+ /* 2 Triangles per portion of the window */
-+
-+ /* ------------ *
-+ * |\ | *
-+ * | \ | *
-+ * | \ t1 | *
-+ * | \ | *
-+ * | \ | *
-+ * | \ | *
-+ * | \ | *
-+ * | t2 \ | *
-+ * | \ | *
-+ * | \| *
-+ * ------------ */
-+
-+ /* Create a parent mesh first */
-+
-+ /*CompMesh parent;
-+ int i;
-+ int width, height;
-+ int nTriangle = 0;
-+
-+ parent.width = MIN (32, w->serverWidth);
-+ parent.height = MIN (32, w->serverHeight);
-+ parent.triangles = NULL;
-+ parent.triangles = realloc (parent.triangles, ((parent.width * parent.height) * 2) * sizeof(XTriangle));
-+ for (height = 0; height < parent.height; height++)
-+ {
-+ for (width = 0; width < parent.width; width++)
-+ {
-+ for (i = 1; i <= 2; i++)
-+ {
-+ int x1, x2, y1, y2;
-+ x1 = (int) w->serverX + (w->serverWidth / parent.width) * width;
-+ x2 = (int) w->serverX + (w->serverWidth / parent.width) * (width + 1);
-+ y1 = (int) w->serverY + (w->serverHeight / parent.height) * height;
-+ y2 = (int) w->serverY + (w->serverHeight / parent.height) * (height + 1);
-+ switch (i)
-+ {
-+ case 1:
-+ parent.triangles[nTriangle].p1.x = IntToxFixed (x1);
-+ parent.triangles[nTriangle].p1.y = IntToxFixed (y1);
-+ parent.triangles[nTriangle].p2.x = IntToxFixed (x1);
-+ parent.triangles[nTriangle].p2.y = IntToxFixed (y2);
-+ parent.triangles[nTriangle].p3.x = IntToxFixed (x2);
-+ parent.triangles[nTriangle].p3.y = IntToxFixed (y2);
-+
-+ nTriangle++;
-+
-+ break;
-+ case 2:
-+ parent.triangles[nTriangle].p1.x = IntToxFixed (x1);
-+ parent.triangles[nTriangle].p1.y = IntToxFixed (y1);
-+ parent.triangles[nTriangle].p2.x = IntToxFixed (x2);
-+ parent.triangles[nTriangle].p2.y = IntToxFixed (y1);
-+ parent.triangles[nTriangle].p3.x = IntToxFixed (x2);
-+ parent.triangles[nTriangle].p3.y = IntToxFixed (y2);
-+
-+ nTriangle++;
-+
-+ break;
-+ default:
-+ break;
-+ }
-+ }
-+ }
-+ }
-+
-+ (*w->screen->createMesh) (w, &parent);
-+
-+ CompMesh child;
-+ nTriangle = 0;
-+
-+ child.width = MIN (32, w->serverWidth);
-+ child.height = MIN (32, w->serverHeight);
-+ child.triangles = NULL;
-+ child.triangles = realloc (child.triangles, ((child.width * child.height) * 2) * sizeof(XTriangle));
-+ for (height = 0; height < child.height; height++)
-+ {
-+ for (width = 0; width < child.width; width++)
-+ {
-+ for (i = 1; i <= 2; i++)
-+ {
-+ int x1, x2, y1, y2;
-+ x1 = (int) (w->serverWidth / child.width) * width;
-+ x2 = (int) (w->serverWidth / child.width) * (width + 1);
-+ y1 = (int) (w->serverHeight / child.height) * height;
-+ y2 = (int) (w->serverHeight / child.height) * (height + 1);
-+ switch (i)
-+ {
-+ case 1:
-+ child.triangles[nTriangle].p1.x = IntToxFixed (x1);
-+ child.triangles[nTriangle].p1.y = IntToxFixed (y1);
-+ child.triangles[nTriangle].p2.x = IntToxFixed (x1);
-+ child.triangles[nTriangle].p2.y = IntToxFixed (y2);
-+ child.triangles[nTriangle].p3.x = IntToxFixed (x2);
-+ child.triangles[nTriangle].p3.y = IntToxFixed (y2);
-+
-+ nTriangle++;
-+
-+ break;
-+ case 2:
-+ child.triangles[nTriangle].p1.x = IntToxFixed (x1);
-+ child.triangles[nTriangle].p1.y = IntToxFixed (y1);
-+ child.triangles[nTriangle].p2.x = IntToxFixed (x2);
-+ child.triangles[nTriangle].p2.y = IntToxFixed (y1);
-+ child.triangles[nTriangle].p3.x = IntToxFixed (x2);
-+ child.triangles[nTriangle].p3.y = IntToxFixed (y2);
-+
-+ nTriangle++;
-+
-+ break;
-+ default:
-+ break;
-+ }
-+ }
-+ }
-+ }
-+
-+ int iChild = 0, iParent = 0, iTriangle = 0;
-+ int nTriangles = child.width * child.height * 4;
-+
-+ CompMesh combined;
-+
-+ combined.width = MIN (32, w->serverWidth);
-+ combined.height = MIN (32, w->serverHeight);
-+ combined.triangles = NULL;
-+ combined.triangles = realloc (combined.triangles, ((combined.width * combined.height) * 4) * sizeof(XTriangle));
-+
-+ for (iTriangle = 0; iTriangle < nTriangles; )
-+ {
-+ combined.triangles[iTriangle] = parent.triangles[iParent];
-+ iParent++;
-+ iTriangle++;
-+ combined.triangles[iTriangle] = child.triangles[iChild];
-+ iChild++;
-+ iTriangle++;
-+ }
-+
-+
-+ XCompositeSetTriangularCoordinateMesh (w->screen->display->display,
-+ w->id,
-+ combined.triangles,
-+ nTriangles);
-+
-+
-+ free (parent.triangles);
-+ free (child.triangles);
-+ free (combined.triangles);*/
-+
- if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK)
- return TRUE;
-
-@@ -1263,5 +1425,7 @@ paintWindow (CompWindow *w,
- mask & PAINT_WINDOW_WITH_OFFSET_MASK)
- glPopMatrix ();
-
-+
-+
- return status;
- }
-diff --git a/src/screen.c b/src/screen.c
-index b9d7e43..0c3866b 100644
---- a/src/screen.c
-+++ b/src/screen.c
-@@ -1793,6 +1793,8 @@ addScreen (CompDisplay *display,
-
- s->initWindowWalker = initWindowWalker;
-
-+ s->transformMesh = transformMesh;
-+
- s->getProcAddress = 0;
-
- if (!XGetWindowAttributes (dpy, s->root, &s->attrib))
-@@ -2687,6 +2689,7 @@ pushScreenGrab (CompScreen *s,
- Cursor cursor,
- const char *name)
- {
-+
- if (s->maxGrab == 0)
- {
- int status;
-diff --git a/src/window.c b/src/window.c
-index afb26b6..c53e745 100644
---- a/src/window.c
-+++ b/src/window.c
-@@ -2110,6 +2110,12 @@ addWindow (CompScreen *screen,
-
- w->saveMask = 0;
-
-+ /* Input Meshing */
-+
-+ w->nMesh = 1;
-+ w->meshMin = 0;
-+ w->meshMax = 0;
-+
- XSelectInput (d->display, id,
- PropertyChangeMask |
- EnterWindowMask |
-@@ -2138,6 +2144,8 @@ addWindow (CompScreen *screen,
- ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
- GrabModeSync, GrabModeSync, None, None);
-
-+
-+
- w->inputHint = TRUE;
- w->alpha = (w->attrib.depth == 32);
- w->wmType = 0;
-@@ -2305,6 +2313,8 @@ addWindow (CompScreen *screen,
-
- (*core.objectAdd) (&screen->base, &w->base);
-
-+ updateMesh (w);
-+
- recalcWindowActions (w);
- updateIconGeometry (w);
-
-@@ -2947,6 +2957,7 @@ windowResizeNotify (CompWindow *w,
- int dwidth,
- int dheight)
- {
-+ updateMesh (w);
- }
-
- void
-@@ -2955,6 +2966,7 @@ windowMoveNotify (CompWindow *w,
- int dy,
- Bool immediate)
- {
-+ updateMesh (w);
- }
-
- void
-@@ -3458,6 +3470,8 @@ reconfigureXWindow (CompWindow *w,
- if (w->frame && (valueMask & (CWSibling | CWStackMode)))
- XConfigureWindow (w->screen->display->display, w->frame,
- valueMask & (CWSibling | CWStackMode), xwc);
-+
-+ updateMesh (w);
- }
-
- static Bool
---
-1.5.6
-
diff --git a/compiz/0004-CompMesh-based-Input-Redirection-support-in-plugins.patch b/compiz/0004-CompMesh-based-Input-Redirection-support-in-plugins.patch
deleted file mode 100644
index bad5319..0000000
--- a/compiz/0004-CompMesh-based-Input-Redirection-support-in-plugins.patch
+++ /dev/null
@@ -1,746 +0,0 @@
-From b23abba8efd8a7a6afef8636654f72ee92f5012e Mon Sep 17 00:00:00 2001
-From: Sam Spilsbury <Sam@XPS-SUSE.site>
-Date: Fri, 7 Nov 2008 23:39:07 +0900
-Subject: [PATCH] CompMesh based Input Redirection support in plugins
-
----
- include/compiz-scale.h | 31 ++++---
- plugins/Makefile.am | 2 +-
- plugins/annotate.c | 212 ++++++++++++++++++++++++++++++++++++++----------
- plugins/move.c | 4 +
- plugins/scale.c | 146 ++++++++++++++++++++++++++++++---
- 5 files changed, 326 insertions(+), 69 deletions(-)
-
-diff --git a/include/compiz-scale.h b/include/compiz-scale.h
-index 118c27d..1611d4b 100644
---- a/include/compiz-scale.h
-+++ b/include/compiz-scale.h
-@@ -57,6 +57,14 @@ typedef struct _SlotArea {
- XRectangle workArea;
- } SlotArea;
-
-+typedef struct _ScaleDevice {
-+ CompDevice *dev;
-+ int grabIndex;
-+ Window hoveredWindow;
-+ Window selectedWindow;
-+ struct _ScaleDevice *next;
-+} ScaleDevice;
-+
- #define SCALE_DISPLAY_OPTION_ABI 0
- #define SCALE_DISPLAY_OPTION_INDEX 1
- #define SCALE_DISPLAY_OPTION_INITIATE_EDGE 2
-@@ -73,17 +81,10 @@ typedef struct _SlotArea {
- #define SCALE_DISPLAY_OPTION_INITIATE_OUTPUT_KEY 13
- #define SCALE_DISPLAY_OPTION_SHOW_DESKTOP 14
- #define SCALE_DISPLAY_OPTION_RELAYOUT 15
--#define SCALE_DISPLAY_OPTION_KEY_BINDINGS_TOGGLE 16
--#define SCALE_DISPLAY_OPTION_BUTTON_BINDINGS_TOGGLE 17
--#define SCALE_DISPLAY_OPTION_NUM 18
--
--typedef struct _ScaleDevice {
-- CompDevice *dev;
-- int grabIndex;
-- Window hoveredWindow;
-- Window selectedWindow;
-- struct _ScaleDevice *next;
--} ScaleDevice;
-+#define SCALE_DISPLAY_OPTION_DOUBLE_CLICK_TIME 16
-+#define SCALE_DISPLAY_OPTION_KEY_BINDINGS_TOGGLE 17
-+#define SCALE_DISPLAY_OPTION_BUTTON_BINDINGS_TOGGLE 18
-+#define SCALE_DISPLAY_OPTION_NUM 19
-
- typedef struct _ScaleDisplay {
- int screenPrivateIndex;
-@@ -140,6 +141,7 @@ typedef struct _ScaleScreen {
- PaintOutputProc paintOutput;
- PaintWindowProc paintWindow;
- DamageWindowRectProc damageWindowRect;
-+ TransformMeshProc transformMesh;
-
- ScaleLayoutSlotsAndAssignWindowsProc layoutSlotsAndAssignWindows;
- ScaleSetScaledPaintAttributesProc setScaledPaintAttributes;
-@@ -158,19 +160,22 @@ typedef struct _ScaleScreen {
- int state;
- int moreAdjust;
-
-+ int clickTime;
-+ Bool doubleClick;
-+
- Cursor cursor;
-
- ScaleSlot *slots;
- int slotsSize;
- int nSlots;
-
-+ ScaleDevice *devices;
-+
- /* only used for sorting */
- CompWindow **windows;
- int windowsSize;
- int nWindows;
-
-- ScaleDevice *devices;
--
- GLushort opacity;
-
- ScaleType type;
-diff --git a/plugins/Makefile.am b/plugins/Makefile.am
-index 66e4ed7..139e143 100644
---- a/plugins/Makefile.am
-+++ b/plugins/Makefile.am
-@@ -51,7 +51,7 @@ libpng_la_SOURCES = png.c
-
- libblur_la_DEPENDENCIES = $(top_builddir)/libdecoration/libdecoration.la
- libblur_la_LDFLAGS = -module -avoid-version -no-undefined
--libblur_la_LIBADD = $(top_builddir)/libdecoration/libdecoration.la -lGLU
-+libblur_la_LIBADD = $(top_builddir)/libdecoration/libdecoration.la
- libblur_la_SOURCES = blur.c
-
- libregex_la_LDFLAGS = -module -avoid-version -no-undefined
-diff --git a/plugins/annotate.c b/plugins/annotate.c
-index 6271260..4827bcf 100644
---- a/plugins/annotate.c
-+++ b/plugins/annotate.c
-@@ -34,9 +34,6 @@ static CompMetadata annoMetadata;
-
- static int displayPrivateIndex;
-
--static int annoLastPointerX = 0;
--static int annoLastPointerY = 0;
--
- #define ANNO_DISPLAY_OPTION_INITIATE_BUTTON 0
- #define ANNO_DISPLAY_OPTION_DRAW_BUTTON 1
- #define ANNO_DISPLAY_OPTION_ERASE_BUTTON 2
-@@ -48,24 +45,33 @@ static int annoLastPointerY = 0;
- #define ANNO_DISPLAY_OPTION_STROKE_WIDTH 8
- #define ANNO_DISPLAY_OPTION_NUM 9
-
-+typedef struct _AnnoDevice {
-+ CompDevice *dev;
-+ int grabIndex;
-+ int annoLastPointerX;
-+ int annoLastPointerY;
-+
-+ Bool eraseMode;
-+} AnnoDevice;
-+
- typedef struct _AnnoDisplay {
- int screenPrivateIndex;
- HandleEventProc handleEvent;
-
- CompOption opt[ANNO_DISPLAY_OPTION_NUM];
-+
-+ AnnoDevice *devices;
-+ int ndevices;
- } AnnoDisplay;
-
- typedef struct _AnnoScreen {
- PaintOutputProc paintOutput;
-- int grabIndex;
-
- Pixmap pixmap;
- CompTexture texture;
- cairo_surface_t *surface;
- cairo_t *cairo;
- Bool content;
--
-- Bool eraseMode;
- } AnnoScreen;
-
- #define GET_ANNO_DISPLAY(d) \
-@@ -85,6 +91,16 @@ typedef struct _AnnoScreen {
-
- #define NUM_TOOLS (sizeof (tools) / sizeof (tools[0]))
-
-+static AnnoDevice*
-+annoGetDeviceByDev (AnnoDisplay *d, CompDevice* dev)
-+{
-+ int i = 0;
-+ for (i = 0; i < d->ndevices; i ++)
-+ if (d->devices[i].dev == dev)
-+ return &d->devices[i];
-+ return NULL;
-+}
-+
- static void
- annoCairoClear (CompScreen *s,
- cairo_t *cr)
-@@ -458,13 +474,47 @@ annoInitiate (CompDisplay *d,
- s = findScreenAtDisplay (d, xid);
- if (s)
- {
-- ANNO_SCREEN (s);
-+ int id;
-+ CompDevice *dev;
-+ AnnoDevice *adev;
-+ ANNO_DISPLAY(d);
-+
-+ id = getIntOptionNamed(option, nOption, "device", -1);
-+ dev = compFindDeviceById(d, id);
-+ adev = annoGetDeviceByDev(ad, dev);
-+
-+ if (dev && otherDeviceGrabExist(dev, 0))
-+ return FALSE;
-+ else if (!dev && otherScreenGrabExist (s, 0))
-+ return FALSE;
-
-- if (otherScreenGrabExist (s, 0))
-+ ad->ndevices++;
-+ ad->devices = realloc(ad->devices, ad->ndevices * sizeof(AnnoDevice));
-+ if (!ad->devices)
- return FALSE;
-
-- if (!as->grabIndex)
-- as->grabIndex = pushScreenGrab (s, None, "annotate");
-+ adev = &ad->devices[ad->ndevices - 1];
-+ adev->dev = dev;
-+ adev->grabIndex = 0;
-+ adev->eraseMode = FALSE;
-+
-+ if (dev)
-+ {
-+ adev->annoLastPointerX = dev->pointerX;
-+ adev->annoLastPointerY = dev->pointerY;
-+ } else
-+ {
-+ adev->annoLastPointerX = pointerX;
-+ adev->annoLastPointerY = pointerY;
-+ }
-+
-+ if (!adev->grabIndex) /* XXX */
-+ {
-+ if (dev)
-+ adev->grabIndex = pushDeviceGrab (s, dev, None, "annotate");
-+ else
-+ adev->grabIndex = pushScreenGrab (s, None, "annotate");
-+ }
-
- if (state & CompActionStateInitButton)
- action->state |= CompActionStateTermButton;
-@@ -472,10 +522,6 @@ annoInitiate (CompDisplay *d,
- if (state & CompActionStateInitKey)
- action->state |= CompActionStateTermKey;
-
-- annoLastPointerX = pointerX;
-- annoLastPointerY = pointerY;
--
-- as->eraseMode = FALSE;
- }
-
- return TRUE;
-@@ -490,25 +536,47 @@ annoTerminate (CompDisplay *d,
- {
- CompScreen *s;
- Window xid;
-+ int id;
-+ CompDevice *dev;
-+ AnnoDevice *adev;
-+ ANNO_DISPLAY(d);
-
- xid = getIntOptionNamed (option, nOption, "root", 0);
-+ id = getIntOptionNamed(option, nOption, "device", -1);
-+ dev = compFindDeviceById(d, id);
-+ adev = annoGetDeviceByDev(ad, dev);
-
- for (s = d->screens; s; s = s->next)
- {
-- ANNO_SCREEN (s);
--
- if (xid && s->root != xid)
- continue;
-
-- if (as->grabIndex)
-+ if (adev && adev->grabIndex)
- {
-- removeScreenGrab (s, as->grabIndex, NULL);
-- as->grabIndex = 0;
-+ int i;
-+
-+ if (dev)
-+ removeDeviceGrab(s, dev, adev->grabIndex, NULL);
-+ else
-+ removeScreenGrab (s, adev->grabIndex, NULL);
-+ adev->grabIndex = 0;
-+
-+
-+ ad->ndevices--;
-+ for (i = 0; i < ad->ndevices; i++)
-+ {
-+ if (adev == &ad->devices[i])
-+ {
-+ memmove(adev, adev + 1, ad->ndevices - i);
-+ break;
-+ }
-+ }
-+ ad->devices = realloc(ad->devices, ad->ndevices * sizeof(AnnoDevice));
-+ if (!ad->devices)
-+ action->state &= ~(CompActionStateTermKey | CompActionStateTermButton);
- }
- }
-
-- action->state &= ~(CompActionStateTermKey | CompActionStateTermButton);
--
- return FALSE;
- }
-
-@@ -527,24 +595,55 @@ annoEraseInitiate (CompDisplay *d,
- s = findScreenAtDisplay (d, xid);
- if (s)
- {
-- ANNO_SCREEN (s);
-+ int id;
-+ CompDevice *dev;
-+ AnnoDevice *adev;
-+
-+ ANNO_DISPLAY(d);
-+
-+ id = getIntOptionNamed(option, nOption, "device", -1);
-+ dev = compFindDeviceById(d, id);
-+ adev = annoGetDeviceByDev(ad, dev);
-
-- if (otherScreenGrabExist (s, 0))
-+ if (dev && otherDeviceGrabExist(dev, 0))
- return FALSE;
-+ else if (!dev && otherScreenGrabExist (s, 0))
-+ return FALSE;
-+
-+ ad->ndevices++;
-+ ad->devices = realloc(ad->devices, ad->ndevices * sizeof(AnnoDevice));
-+ if (!ad->devices)
-+ return FALSE;
-+
-+ adev = &ad->devices[ad->ndevices - 1];
-+ adev->dev = dev;
-+ adev->grabIndex = 0;
-+ adev->eraseMode = TRUE;
-+
-+ if (dev)
-+ {
-+ adev->annoLastPointerX = dev->pointerX;
-+ adev->annoLastPointerY = dev->pointerY;
-+ } else
-+ {
-+ adev->annoLastPointerX = pointerX;
-+ adev->annoLastPointerY = pointerY;
-+ }
-+
-+ if (!adev->grabIndex) /* XXX */
-+ {
-+ if (dev)
-+ adev->grabIndex = pushDeviceGrab (s, dev, None, "annotate");
-+ else
-+ adev->grabIndex = pushScreenGrab (s, None, "annotate");
-+ }
-
-- if (!as->grabIndex)
-- as->grabIndex = pushScreenGrab (s, None, "annotate");
-
- if (state & CompActionStateInitButton)
- action->state |= CompActionStateTermButton;
-
- if (state & CompActionStateInitKey)
- action->state |= CompActionStateTermKey;
--
-- annoLastPointerX = pointerX;
-- annoLastPointerY = pointerY;
--
-- as->eraseMode = TRUE;
- }
-
- return FALSE;
-@@ -652,35 +751,36 @@ annoPaintOutput (CompScreen *s,
-
- static void
- annoHandleMotionEvent (CompScreen *s,
-+ CompDevice *dev,
- int xRoot,
- int yRoot)
- {
-- ANNO_SCREEN (s);
-+ AnnoDevice *adev;
-+ ANNO_DISPLAY(s->display);
-
-- if (as->grabIndex)
-+ adev = annoGetDeviceByDev(ad, dev);
-+ if (adev && adev->grabIndex)
- {
-- if (as->eraseMode)
-+ if (adev->eraseMode)
- {
- static unsigned short color[] = { 0, 0, 0, 0 };
-
- annoDrawLine (s,
-- annoLastPointerX, annoLastPointerY,
-+ adev->annoLastPointerX, adev->annoLastPointerY,
- xRoot, yRoot,
- 20.0, color);
- }
- else
- {
-- ANNO_DISPLAY(s->display);
--
- annoDrawLine (s,
-- annoLastPointerX, annoLastPointerY,
-+ adev->annoLastPointerX, adev->annoLastPointerY,
- xRoot, yRoot,
- ad->opt[ANNO_DISPLAY_OPTION_LINE_WIDTH].value.f,
- ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR].value.c);
- }
-
-- annoLastPointerX = xRoot;
-- annoLastPointerY = yRoot;
-+ adev->annoLastPointerX = xRoot;
-+ adev->annoLastPointerY = yRoot;
- }
- }
-
-@@ -696,14 +796,39 @@ annoHandleEvent (CompDisplay *d,
- case MotionNotify:
- s = findScreenAtDisplay (d, event->xmotion.root);
- if (s)
-- annoHandleMotionEvent (s, pointerX, pointerY);
-+ annoHandleMotionEvent (s, NULL, pointerX, pointerY);
- break;
- case EnterNotify:
- case LeaveNotify:
- s = findScreenAtDisplay (d, event->xcrossing.root);
- if (s)
-- annoHandleMotionEvent (s, pointerX, pointerY);
-+ annoHandleMotionEvent (s, NULL, pointerX, pointerY);
- default:
-+ if (event->type == d->xi_motion)
-+ {
-+ CompDevice *dev;
-+ XDeviceMotionEvent *mev = (XDeviceMotionEvent*)event;
-+ s = findScreenAtDisplay (d, mev->root);
-+ if (s)
-+ {
-+ dev = compFindDeviceById (d, mev->deviceid);
-+ annoHandleMotionEvent (s, dev, dev->pointerX, dev->pointerY);
-+ }
-+ break;
-+ }
-+
-+ if (event->type == d->xi_enter || event->type == d->xi_leave)
-+ {
-+ CompDevice *dev;
-+ XDeviceCrossingEvent *crev = (XDeviceCrossingEvent*)event;
-+ s = findScreenAtDisplay (d, crev->root);
-+ if (s)
-+ {
-+ dev = compFindDeviceById (d, crev->deviceid);
-+ annoHandleMotionEvent (s, dev, dev->pointerX, dev->pointerY);
-+ }
-+ break;
-+ }
- break;
- }
-
-@@ -783,6 +908,9 @@ annoInitDisplay (CompPlugin *p,
- return FALSE;
- }
-
-+ ad->devices = NULL;
-+ ad->ndevices = 0;
-+
- WRAP (ad, d, handleEvent, annoHandleEvent);
-
- d->base.privates[displayPrivateIndex].ptr = ad;
-@@ -802,6 +930,7 @@ annoFiniDisplay (CompPlugin *p,
-
- compFiniDisplayOptions (d, ad->opt, ANNO_DISPLAY_OPTION_NUM);
-
-+ free (ad->devices);
- free (ad);
- }
-
-@@ -817,7 +946,6 @@ annoInitScreen (CompPlugin *p,
- if (!as)
- return FALSE;
-
-- as->grabIndex = 0;
- as->surface = NULL;
- as->pixmap = None;
- as->cairo = NULL;
-diff --git a/plugins/move.c b/plugins/move.c
-index 4c77239..f74d477 100644
---- a/plugins/move.c
-+++ b/plugins/move.c
-@@ -697,6 +697,10 @@ moveHandleMotionEvent (CompScreen *s,
-
- if (dx || dy)
- {
-+ moveWindow (w,
-+ wX + dx - w->attrib.x,
-+ wY + dy - w->attrib.y,
-+ TRUE, FALSE);
-
- if (md->opt[MOVE_DISPLAY_OPTION_LAZY_POSITIONING].value.b)
- {
-diff --git a/plugins/scale.c b/plugins/scale.c
-index 841c30d..935c5dd 100644
---- a/plugins/scale.c
-+++ b/plugins/scale.c
-@@ -155,6 +155,41 @@ isScaleWin (CompWindow *w)
- /* Device Management */
-
- static Bool
-+scaleUpdateHoveredWindows (CompScreen *s)
-+{
-+ Window root_return;
-+ Window child_return;
-+ int rootX, rootY;
-+ int winX, winY;
-+ unsigned int maskReturn;
-+ Bool status;
-+ ScaleDevice *dev;
-+
-+ SCALE_SCREEN (s);
-+
-+ for (dev = ss->devices; dev; dev = dev->next)
-+ {
-+
-+ status = XQueryDevicePointer (s->display->display, dev->dev->dev, s->root,
-+ &root_return, &child_return,
-+ &rootX, &rootY, &winX, &winY, &maskReturn);
-+
-+ if (!status || rootX > s->width || rootY > s->height ||
-+ s->root != root_return)
-+ return FALSE;
-+
-+
-+ scaleSelectWindowAt (s,
-+ dev->dev,
-+ rootX,
-+ rootY,
-+ FALSE);
-+
-+ }
-+ return TRUE;
-+}
-+
-+static Bool
- scaleGrabDevice (CompScreen *s,
- ScaleDevice *sDev)
- {
-@@ -585,6 +620,8 @@ scalePaintWindow (CompWindow *w,
- sw->ty / sw->scale - w->attrib.y,
- 0.0f);
-
-+ updateMesh (w);
-+
- glPushMatrix ();
- glLoadMatrixf (wTransform.m);
-
-@@ -1047,6 +1084,8 @@ scalePaintOutput (CompScreen *s,
- if (ss->state != SCALE_STATE_NONE)
- mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
-
-+ scaleUpdateHoveredWindows (s);
-+
- UNWRAP (ss, s, paintOutput);
- status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
- WRAP (ss, s, paintOutput, scalePaintOutput);
-@@ -1189,6 +1228,7 @@ sendDndStatusMessage (CompScreen *s,
-
- XSendEvent (s->display->display, source, FALSE, 0, &xev);
- }
-+
- static Bool
- scaleActionShouldToggle (CompDisplay *d,
- CompAction *action,
-@@ -1241,6 +1281,7 @@ scaleTerminate (CompDisplay *d,
-
- SCALE_SCREEN (s);
-
-+ if (!d->opt[COMP_DISPLAY_OPTION_REDIRECT_INPUT].value.b)
- for (sDev = ss->devices; sDev; sDev = sDev->next)
- {
- removeDeviceGrab (s, sDev->dev, sDev->grabIndex, NULL);
-@@ -1386,6 +1427,7 @@ scaleInitiateCommon (CompScreen *s,
- }
- scaleCheckList (s);
-
-+ if (!s->display->opt[COMP_DISPLAY_OPTION_REDIRECT_INPUT].value.b)
- for (sDev = ss->devices; sDev; sDev = sDev->next)
- {
- ss->grab = scaleGrabDevice (s, sDev);
-@@ -1890,7 +1932,6 @@ scaleHoverTimeout (void *closure)
- return FALSE;
- }
-
--
- static void
- scaleHandleEvent (CompDisplay *d,
- XEvent *event)
-@@ -1907,7 +1948,7 @@ scaleHandleEvent (CompDisplay *d,
- {
- SCALE_SCREEN (s);
-
-- if (ss->grabIndex)
-+ if (ss->grabIndex && !d->opt[COMP_DISPLAY_OPTION_REDIRECT_INPUT].value.b)
- {
- if (event->xkey.keycode == sd->leftKeyCode)
- {
-@@ -1942,7 +1983,23 @@ scaleHandleEvent (CompDisplay *d,
-
- SCALE_SCREEN (s);
-
-- if (ss->grabIndex && ss->state != SCALE_STATE_IN)
-+ if (ss->clickTime == 0)
-+ {
-+ ss->clickTime = event->xbutton.time;
-+ }
-+ else if ((event->xbutton.time - ss->clickTime) <=
-+ sd->opt[SCALE_DISPLAY_OPTION_DOUBLE_CLICK_TIME].value.i)
-+ {
-+
-+ ss->doubleClick = TRUE;
-+ }
-+ else
-+ {
-+ ss->clickTime = event->xbutton.time;
-+ ss->doubleClick = FALSE;
-+ }
-+
-+ if (ss->grabIndex && ss->state != SCALE_STATE_IN && (ss->doubleClick))
- {
- CompOption o;
-
-@@ -2110,16 +2167,28 @@ scaleHandleEvent (CompDisplay *d,
- {
- SCALE_SCREEN (s);
-
-- if (ss->grab)
-+ if (ss->grab && !d->opt[COMP_DISPLAY_OPTION_REDIRECT_INPUT].value.b)
- {
-- if (kev->keycode == sd->leftKeyCode)
-- scaleMoveFocusWindow (s, dev, -1, 0);
-- else if (kev->keycode == sd->rightKeyCode)
-- scaleMoveFocusWindow (s, dev, 1, 0);
-- else if (kev->keycode == sd->upKeyCode)
-- scaleMoveFocusWindow (s, dev, 0, -1);
-- else if (kev->keycode == sd->downKeyCode)
-- scaleMoveFocusWindow (s, dev, 0, 1);
-+ if (event->xkey.keycode == sd->leftKeyCode)
-+ {
-+ scaleMoveFocusWindow (s, NULL, -1, 0);
-+ consumeEvent = TRUE;
-+ }
-+ else if (event->xkey.keycode == sd->rightKeyCode)
-+ {
-+ scaleMoveFocusWindow (s, NULL, 1, 0);
-+ consumeEvent = TRUE;
-+ }
-+ else if (event->xkey.keycode == sd->upKeyCode)
-+ {
-+ scaleMoveFocusWindow (s, NULL, 0, -1);
-+ consumeEvent = TRUE;
-+ }
-+ else if (event->xkey.keycode == sd->downKeyCode)
-+ {
-+ scaleMoveFocusWindow (s, NULL, 0, 1);
-+ consumeEvent = TRUE;
-+ }
- }
- }
- }
-@@ -2136,7 +2205,22 @@ scaleHandleEvent (CompDisplay *d,
-
- SCALE_SCREEN (s);
-
-- if (ss->grab && ss->state != SCALE_STATE_IN)
-+ if (ss->clickTime == 0)
-+ {
-+ ss->clickTime = event->xbutton.time;
-+ }
-+ else if (bev->time - ss->clickTime <=
-+ sd->opt[SCALE_DISPLAY_OPTION_DOUBLE_CLICK_TIME].value.i)
-+ {
-+ ss->doubleClick = TRUE;
-+ }
-+ else
-+ {
-+ ss->clickTime = bev->time;
-+ ss->doubleClick = FALSE;
-+ }
-+
-+ if (ss->grab && ss->state != SCALE_STATE_IN && ss->doubleClick)
- {
- int nOption = 0;
- CompOption o[2];
-@@ -2279,6 +2363,36 @@ scaleDamageWindowRect (CompWindow *w,
- return status;
- }
-
-+static void
-+scaleTransformMesh (CompWindow *w,
-+ CompTransform *transform,
-+ CompMesh *mesh,
-+ int meshIter,
-+ Bool needsProjection)
-+{
-+ SCALE_SCREEN (w->screen);
-+ CompTransform scaleTransform = *transform;
-+
-+ if (TRUE)
-+ {
-+ SCALE_WINDOW (w);
-+
-+ if (sw->slot)
-+ {
-+ matrixTranslate (&scaleTransform, w->attrib.x, w->attrib.y, 0.0f);
-+ matrixScale (&scaleTransform, sw->scale, sw->scale, 1.0f);
-+ matrixTranslate (&scaleTransform,
-+ sw->tx / sw->scale - w->attrib.x,
-+ sw->ty / sw->scale - w->attrib.y,
-+ 0.0f);
-+ }
-+ }
-+
-+ UNWRAP (ss, w->screen, transformMesh);
-+ (*w->screen->transformMesh) (w, &scaleTransform, mesh, meshIter, needsProjection);
-+ WRAP (ss, w->screen, transformMesh, scaleTransformMesh);
-+}
-+
- static CompOption *
- scaleGetDisplayOptions (CompPlugin *plugin,
- CompDisplay *display,
-@@ -2335,6 +2449,7 @@ static const CompMetadataOptionInfo scaleDisplayOptionInfo[] = {
- { "initiate_output_key", "key", 0, scaleInitiateOutput, scaleTerminate },
- { "show_desktop", "bool", 0, 0, 0 },
- { "relayout_slots", "action", 0, scaleRelayoutSlots, 0 },
-+ { "double_click_time", "int", 0, 0, 0 },
- { "key_bindings_toggle", "bool", 0, 0, 0 },
- { "button_bindings_toggle", "bool", 0, 0, 0 }
- };
-@@ -2466,6 +2581,9 @@ scaleInitScreen (CompPlugin *p,
- ss->opacity =
- (OPAQUE * ss->opt[SCALE_SCREEN_OPTION_OPACITY].value.i) / 100;
-
-+ ss->clickTime = 0;
-+ ss->doubleClick = FALSE;
-+
- matchInit (&ss->match);
-
- ss->layoutSlotsAndAssignWindows = layoutSlotsAndAssignWindows;
-@@ -2478,6 +2596,7 @@ scaleInitScreen (CompPlugin *p,
- WRAP (ss, s, paintOutput, scalePaintOutput);
- WRAP (ss, s, paintWindow, scalePaintWindow);
- WRAP (ss, s, damageWindowRect, scaleDamageWindowRect);
-+ WRAP (ss, s, transformMesh, scaleTransformMesh);
-
- ss->cursor = XCreateFontCursor (s->display->display, XC_left_ptr);
-
-@@ -2497,6 +2616,7 @@ scaleFiniScreen (CompPlugin *p,
- UNWRAP (ss, s, paintOutput);
- UNWRAP (ss, s, paintWindow);
- UNWRAP (ss, s, damageWindowRect);
-+ UNWRAP (ss, s, transformMesh);
-
- matchFini (&ss->match);
-
---
-1.5.6
-
diff --git a/compiz/0005-MPX-and-IR-Decoration-Support.patch b/compiz/0005-MPX-and-IR-Decoration-Support.patch
deleted file mode 100644
index a36c4a6..0000000
--- a/compiz/0005-MPX-and-IR-Decoration-Support.patch
+++ /dev/null
@@ -1,210 +0,0 @@
-From fce0601cd64902860dda01ace4024143738b38a5 Mon Sep 17 00:00:00 2001
-From: Sam Spilsbury <Sam@XPS-SUSE.site>
-Date: Sat, 8 Nov 2008 12:50:18 +0900
-Subject: [PATCH] MPX and IR Decoration Support
-
----
- plugins/move.c | 17 ++++++++++++--
- plugins/resize.c | 2 -
- src/event.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++----
- src/window.c | 2 -
- 4 files changed, 68 insertions(+), 12 deletions(-)
-
-diff --git a/plugins/move.c b/plugins/move.c
-index f74d477..f527cea 100644
---- a/plugins/move.c
-+++ b/plugins/move.c
-@@ -169,10 +169,11 @@ moveFindDeviceAt(CompDisplay *d, CompWindow *w, int xRoot, int yRoot,
- XQueryDevicePointer(d->display, dev->dev, w->screen->root,
- &root, &child,
- &rx, &ry, &winx, &winy, &mask);
-- if (mask != mods)
-- continue;
-
-- if (!closest)
-+ /* We should check for mods here, but it appears that there is
-+ * a mismatch in the current line of servers */
-+
-+ if (!closest)
- {
- closest = dev;
- delta = abs(xRoot - rx) + abs(yRoot - ry);
-@@ -799,6 +800,8 @@ moveHandleEvent (CompDisplay *d,
- {
- CompWindow *w;
-
-+ fprintf(stderr, "got event\n");
-+
- if (event->xclient.data.l[2] == WmMoveResizeMove ||
- event->xclient.data.l[2] == WmMoveResizeMoveKeyboard)
- {
-@@ -813,6 +816,8 @@ moveHandleEvent (CompDisplay *d,
- o[0].name = "window";
- o[0].value.i = event->xclient.window;
-
-+ fprintf(stderr, "window found\n");
-+
- if (event->xclient.data.l[2] == WmMoveResizeMoveKeyboard)
- {
- option = MOVE_DISPLAY_OPTION_INITIATE_KEY;
-@@ -829,6 +834,8 @@ moveHandleEvent (CompDisplay *d,
- CompDevice *dev = NULL;
- int initMove = FALSE;
-
-+ fprintf (stderr, "getting device\n");
-+
- option = MOVE_DISPLAY_OPTION_INITIATE_BUTTON;
-
- if (!d->devices)
-@@ -846,6 +853,9 @@ moveHandleEvent (CompDisplay *d,
- * message and try to find the device closest to
- * the coordinates with button 1 down. This is our
- * candidate. */
-+
-+ fprintf(stderr, "xroot is %i, yroot is %i\n", event->xclient.data.l[0], event->xclient.data.l[1]);
-+
- xRoot = event->xclient.data.l[0];
- yRoot = event->xclient.data.l[1];
- dev = moveFindDeviceAt(d, w,
-@@ -857,6 +867,7 @@ moveHandleEvent (CompDisplay *d,
-
- if (initMove)
- {
-+ fprintf(stderr, "initMove\n");
- o[1].type = CompOptionTypeInt;
- o[1].name = "modifiers";
- o[1].value.i = mods;
-diff --git a/plugins/resize.c b/plugins/resize.c
-index 75a8569..36dfd25 100644
---- a/plugins/resize.c
-+++ b/plugins/resize.c
-@@ -217,8 +217,6 @@ resizeFindDeviceAt(CompDisplay *d, CompWindow *w, int xRoot, int yRoot,
- XQueryDevicePointer(d->display, dev->dev, w->screen->root,
- &root, &child,
- &rx, &ry, &winx, &winy, &mask);
-- if (mask != mods)
-- continue;
-
- if (!closest)
- {
-diff --git a/src/event.c b/src/event.c
-index 909b708..49de107 100644
---- a/src/event.c
-+++ b/src/event.c
-@@ -2608,11 +2608,11 @@ createMesh (CompWindow *win,
- mesh->width = MIN (win->meshMin, width);
- mesh->height = MIN (win->meshMin, height);
- mesh->triangles = NULL;
-- mesh->triangles = calloc (1, ((mesh->width * mesh->height) * 2) * sizeof(XTriangle));
-+ mesh->triangles = calloc (1, (((mesh->width + 1) * (mesh->height + 1)) * 2) * sizeof(XTriangle));
-
-- for (h = 0; h < mesh->height; h++)
-+ for (h = 0; h <= mesh->height; h++)
- {
-- for (w = 0; w < mesh->width; w++)
-+ for (w = 0; w <= mesh->width; w++)
- {
- for (i = 1; i <= 2; i++)
- {
-@@ -2621,6 +2621,7 @@ createMesh (CompWindow *win,
- x2 = (int) offX + (width / mesh->width) * (w + 1);
- y1 = (int) offY + (height / mesh->height) * h;
- y2 = (int) offY + (height / mesh->height) * (h + 1);
-+
- switch (i)
- {
- case 1: /* Triangle is right-side up (first triangle in rectangle) */
-@@ -2678,7 +2679,7 @@ combineMeshes (CompMesh *combined, CompMesh *child, CompMesh *parent)
- combined->width = parent->width;
- combined->height = parent->height;
- combined->triangles = NULL;
-- combined->triangles = calloc (1, ((combined->width * combined->height) * 4) * sizeof(XTriangle));
-+ combined->triangles = calloc (1, (((combined->width + 2) * (combined->height + 2)) * 4) * sizeof(XTriangle));
-
- for (iTriangle = 0; iTriangle < nTriangles; )
- {
-@@ -2719,7 +2720,7 @@ combineMeshArray (CompMesh *combinedArray, int nMesh)
- total->width = (int) (totalWidth / nMesh);
- total->height = (int) (totalHeight / nMesh);
-
-- total->triangles = calloc (1, ((totalWidth * totalHeight * 4) * nMesh * sizeof (XTriangle)));
-+ total->triangles = calloc (1, (((totalWidth + nMesh * 2) * (totalHeight + nMesh * 2) * 4) * nMesh * sizeof (XTriangle)));
- if (!total->triangles)
- return NULL;
-
-@@ -2878,6 +2879,8 @@ updateMesh (CompWindow *w)
- if (w->meshMax < 2 || w->meshMax > w->screen->display->opt[COMP_DISPLAY_OPTION_MESH_MIN].value.i)
- w->meshMax = w->screen->display->opt[COMP_DISPLAY_OPTION_MESH_MAX].value.i;
-
-+ /* Set the window */
-+
- for (i = 0; i < w->nMesh; i++)
- {
-
-@@ -2911,4 +2914,50 @@ updateMesh (CompWindow *w)
- free (total->triangles);
- free (total);
-
-+ /* Set the window frame */
-+
-+ matrixGetIdentity (&transform);
-+
-+ for (i = 0; i < w->nMesh; i++)
-+ {
-+
-+ mesh = createMesh (w,
-+ w->serverX - w->input.left,
-+ w->serverY - w->input.top,
-+ w->serverWidth + w->input.left + w->input.right,
-+ w->serverHeight + w->input.top + w->input.bottom);
-+
-+ if (!mesh || !mesh->triangles)
-+ return;
-+
-+ (*w->screen->transformMesh) (w, &transform, mesh, i, FALSE);
-+
-+ child = createMesh (w,
-+ 0,
-+ 0,
-+ w->serverWidth + w->input.left + w->input.right,
-+ w->serverHeight + w->input.top + w->input.bottom);
-+
-+ combineMeshes (&combinedArray[i], child, mesh);
-+
-+ }
-+
-+ total = combineMeshArray (combinedArray, w->nMesh);
-+
-+ if (!total)
-+ return;
-+
-+ nTriangles = total->width * total->height * 4 * w->nMesh;
-+
-+ XCompositeSetTriangularCoordinateMesh (w->screen->display->display,
-+ w->frame,
-+ total->triangles,
-+ nTriangles);
-+
-+ for (i = 0; i < w->nMesh; i++)
-+ free (combinedArray[i].triangles);
-+
-+ free (total->triangles);
-+ free (total);
-+
- }
-diff --git a/src/window.c b/src/window.c
-index c53e745..4d2029a 100644
---- a/src/window.c
-+++ b/src/window.c
-@@ -3470,8 +3470,6 @@ reconfigureXWindow (CompWindow *w,
- if (w->frame && (valueMask & (CWSibling | CWStackMode)))
- XConfigureWindow (w->screen->display->display, w->frame,
- valueMask & (CWSibling | CWStackMode), xwc);
--
-- updateMesh (w);
- }
-
- static Bool
---
-1.5.6
-