summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@XPS-SUSE.site>2008-11-29 12:17:59 +0900
committerSam Spilsbury <Sam@XPS-SUSE.site>2008-11-29 12:17:59 +0900
commit492be11733591f3158cf805b982f01ef8c9f1237 (patch)
treeaf65822eb905d045d6301199a2631b1bac7ec693
parent8df12f10108959cb12775ea33cb7d8366b2e740d (diff)
downloadcompiz-mpx-ir-492be11733591f3158cf805b982f01ef8c9f1237.tar.gz
compiz-mpx-ir-492be11733591f3158cf805b982f01ef8c9f1237.tar.bz2
Added lazypointer patch
-rw-r--r--fusion/plugins/lazypointer/0001-MPX-Support.patch245
1 files changed, 245 insertions, 0 deletions
diff --git a/fusion/plugins/lazypointer/0001-MPX-Support.patch b/fusion/plugins/lazypointer/0001-MPX-Support.patch
new file mode 100644
index 0000000..4a9a978
--- /dev/null
+++ b/fusion/plugins/lazypointer/0001-MPX-Support.patch
@@ -0,0 +1,245 @@
+From cc5a58cc955f5d712d4d2a19dfa2a6a12e2a174b Mon Sep 17 00:00:00 2001
+From: Sam Spilsbury <Sam@XPS-SUSE.site>
+Date: Sat, 29 Nov 2008 12:16:47 +0900
+Subject: [PATCH] MPX Support
+
+---
+ lazypointer.c | 82 +++++++++++++++++++++++++++++++++++++++++++++-----------
+ 1 files changed, 66 insertions(+), 16 deletions(-)
+
+diff --git a/lazypointer.c b/lazypointer.c
+index a356ac2..901f99f 100644
+--- a/lazypointer.c
++++ b/lazypointer.c
+@@ -40,6 +40,8 @@ static int displayPrivateIndex;
+ typedef struct _LpDisplay
+ {
+ int screenPrivateIndex;
++ HandleEventProc handleEvent;
++ CompDevice *lastDev;
+ } LpDisplay;
+
+ typedef struct _LpScreen
+@@ -74,6 +76,7 @@ lpPreparePaintScreen (CompScreen *s,
+ float speed = lazypointerGetSpeed (s->display);
+ float steps = ((float) ms / ((20.1 - speed) * 100));
+ LP_SCREEN (s);
++ LP_DISPLAY (s->display);
+
+ if (steps < 0.0005)
+ steps = 0.0005;
+@@ -106,7 +109,7 @@ lpPreparePaintScreen (CompScreen *s,
+ if (dx == 0 && dy == 0)
+ ls->needsWarp = FALSE;
+
+- warpPointer (s, dx, dy);
++ warpDevicePointer (s, ld->lastDev, dx, dy);
+ }
+
+ UNWRAP (ls, s, preparePaintScreen);
+@@ -144,7 +147,9 @@ lpPlaceWindow (CompWindow *w,
+ Bool ret;
+ Bool status;
+
+- ret = XQueryPointer(w->screen->display->display, w->screen->root,
++ LP_DISPLAY (w->screen->display);
++
++ ret = XQueryDevicePointer(w->screen->display->display, ld->lastDev->dev, w->screen->root,
+ &root, &child,
+ &rx, &ry, &winx, &winy, &mask);
+
+@@ -178,10 +183,11 @@ lpActivateWindow (CompWindow *w)
+ unsigned int mask;
+ Bool ret;
+
+- ret = XQueryPointer(w->screen->display->display, w->screen->root,
++ LP_DISPLAY (w->screen->display);
++
++ ret = XQueryDevicePointer(w->screen->display->display, ld->lastDev->dev, w->screen->root,
+ &root, &child,
+ &rx, &ry, &winx, &winy, &mask);
+-
+ if (ret && lazypointerGetCentreOnActivate (w->screen->display))
+ {
+ ls->initialX = rx;
+@@ -202,6 +208,7 @@ static Bool
+ lpFocusWindow (CompWindow *w)
+ {
+ LP_SCREEN (w->screen);
++ LP_DISPLAY (w->screen->display);
+
+ int cX = (w->attrib.x - w->input.left) + ((w->width + w->input.right + w->input.left) / 2);
+ int cY = (w->attrib.y - w->input.top) + ((w->height + w->input.top + w->input.bottom) / 2);
+@@ -211,7 +218,7 @@ lpFocusWindow (CompWindow *w)
+ Bool ret;
+ Bool status;
+
+- ret = XQueryPointer(w->screen->display->display, w->screen->root,
++ ret = XQueryDevicePointer(w->screen->display->display, ld->lastDev->dev, w->screen->root,
+ &root, &child,
+ &rx, &ry, &winx, &winy, &mask);
+
+@@ -233,6 +240,34 @@ lpFocusWindow (CompWindow *w)
+ return status;
+ }
+
++static void
++lazypointerHandleEvent (CompDisplay *d,
++ XEvent *event)
++{
++ LP_DISPLAY (d);
++
++ UNWRAP (ld, d, handleEvent);
++ (*d->handleEvent) (d, event);
++ WRAP (ld, d, handleEvent, lazypointerHandleEvent);
++
++ if (event->type == d->xi_motion)
++ {
++ XDeviceMotionEvent *mev = (XDeviceMotionEvent *) event;
++ CompDevice *dev = compFindDeviceById (d, mev->deviceid);
++
++ if (dev)
++ ld->lastDev = dev;
++ }
++ else if (event->type == d->xi_btpress || event->type == d->xi_btrelease)
++ {
++ XDeviceButtonEvent *bev = (XDeviceButtonEvent *) event;
++ CompDevice *dev = compFindDeviceById (d, bev->deviceid);
++
++ if (dev)
++ ld->lastDev = dev;
++ }
++}
++
+ static Bool
+ lpWinInitiate (CompDisplay *d,
+ CompAction *action,
+@@ -248,6 +283,7 @@ lpWinInitiate (CompDisplay *d,
+ return FALSE;
+
+ LP_SCREEN (w->screen);
++ LP_DISPLAY (w->screen->display);
+
+ int cX = (w->attrib.x - w->input.left) + ((w->width + w->input.right + w->input.left) / 2);
+ int cY = (w->attrib.y - w->input.top) + ((w->height + w->input.top + w->input.bottom) / 2);
+@@ -256,7 +292,7 @@ lpWinInitiate (CompDisplay *d,
+ unsigned int mask;
+ Bool ret;
+
+- ret = XQueryPointer(d->display, w->screen->root,
++ ret = XQueryDevicePointer(d->display, ld->lastDev->dev, w->screen->root,
+ &root, &child,
+ &rx, &ry, &winx, &winy, &mask);
+
+@@ -290,6 +326,7 @@ lpScreenInitiate (CompDisplay *d,
+ return FALSE;
+
+ LP_SCREEN (s);
++ LP_DISPLAY (s->display);
+
+ int cX = (s->width / 2);
+ int cY = (s->height / 2);
+@@ -298,7 +335,7 @@ lpScreenInitiate (CompDisplay *d,
+ unsigned int mask;
+ Bool ret;
+
+- ret = XQueryPointer(d->display, s->root,
++ ret = XQueryDevicePointer(d->display, ld->lastDev->dev, s->root,
+ &root, &child,
+ &rx, &ry, &winx, &winy, &mask);
+
+@@ -325,13 +362,15 @@ lpLeftInitiate (CompDisplay *d,
+ int nOption)
+ {
+ CompScreen *s;
++ CompDevice *dev;
+
+ s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "screen", 0));
++ dev = compFindDeviceById (d, getIntOptionNamed (option, nOption, "device", -1));
+
+- if (!s)
++ if (!s || !dev)
+ return FALSE;
+
+- warpPointer (s, -1, 0);
++ warpDevicePointer (s, dev, -1, 0);
+
+ return TRUE;
+ }
+@@ -344,13 +383,15 @@ lpRightInitiate (CompDisplay *d,
+ int nOption)
+ {
+ CompScreen *s;
++ CompDevice *dev;
+
+ s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "screen", 0));
++ dev = compFindDeviceById (d, getIntOptionNamed (option, nOption, "device", -1));
+
+- if (!s)
++ if (!s || !dev)
+ return FALSE;
+
+- warpPointer (s, 1, 0);
++ warpDevicePointer (s, dev, 1, 0);
+
+ return TRUE;
+ }
+@@ -363,13 +404,15 @@ lpUpInitiate (CompDisplay *d,
+ int nOption)
+ {
+ CompScreen *s;
+-
++ CompDevice *dev;
++
+ s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "screen", 0));
++ dev = compFindDeviceById (d, getIntOptionNamed (option, nOption, "device", -1));
+
+- if (!s)
++ if (!s || !dev)
+ return FALSE;
+
+- warpPointer (s, 0, -1);
++ warpDevicePointer (s, dev, 0, 1);
+
+ return TRUE;
+ }
+@@ -382,13 +425,15 @@ lpDownInitiate (CompDisplay *d,
+ int nOption)
+ {
+ CompScreen *s;
++ CompDevice *dev;
+
+ s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "screen", 0));
++ dev = compFindDeviceById (d, getIntOptionNamed (option, nOption, "device", -1));
+
+- if (!s)
++ if (!s || !dev)
+ return FALSE;
+
+- warpPointer (s, 0, -1);
++ warpDevicePointer (s, dev, 0, -1);
+
+ return TRUE;
+ }
+@@ -419,6 +464,9 @@ lpInitDisplay (CompPlugin *p,
+ lazypointerSetInitiateRightKeyInitiate (d, lpRightInitiate);
+ lazypointerSetInitiateUpKeyInitiate (d, lpUpInitiate);
+ lazypointerSetInitiateDownKeyInitiate (d, lpDownInitiate);
++
++ WRAP (d, ld, handleEvent, lazypointerHandleEvent);
++ ld->lastDev = NULL;
+
+ d->base.privates[displayPrivateIndex].ptr = ld;
+
+@@ -432,6 +480,8 @@ lpFiniDisplay (CompPlugin *p,
+ LP_DISPLAY (d);
+
+ freeScreenPrivateIndex (d, ld->screenPrivateIndex);
++
++ UNWRAP (d, ld, handleEvent);
+
+ free (ld);
+ }
+--
+1.5.6
+