diff options
author | Joel Bosveld <Joel.Bosveld@gmail.com> | 2009-06-27 16:27:31 +0800 |
---|---|---|
committer | Joel Bosveld <Joel.Bosveld@gmail.com> | 2009-06-27 16:27:31 +0800 |
commit | fe9f9a9aacb912777a8fdcbfd9ad701742e23286 (patch) | |
tree | b7de20017efc601234ef20070648a7da521e14ad | |
parent | 2cea332a7d0a54071b8dbb5a8153894063c92136 (diff) |
composite: redirect correctly when grab is active
-rw-r--r-- | composite/compwindow.c | 23 | ||||
-rw-r--r-- | dix/events.c | 20 | ||||
-rw-r--r-- | include/inputstr.h | 4 |
3 files changed, 40 insertions, 7 deletions
diff --git a/composite/compwindow.c b/composite/compwindow.c index 4456125cc..de53648af 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -1091,17 +1091,26 @@ CompositeXYScreenToWindowRootCoordinate (WindowPtr pWin, if (pDev) { - SpritePtr pSprite = pDev->spriteInfo->sprite; + WindowPtr *trace; + int n; + if (pDev->deviceGrab.grab && pDev->deviceGrab.grab->spriteTrace) + { + trace = pDev->deviceGrab.grab->spriteTrace; + n = pDev->deviceGrab.grab->spriteTraceGood; + } + else + { + trace = pDev->spriteInfo->sprite->spriteTraceUnredirected; + n = pDev->spriteInfo->sprite->spriteTraceGood; + } int i; - for (i = 0; i < pSprite->spriteTraceGood; i++) - if (pWin == pSprite->spriteTraceUnredirected[i]) + for (i = 0; i < n; i++) + if (pWin == trace[i]) { int j; for (j = 0; j < i; j++) - CompositeXYParentToChild ( - pSprite->spriteTraceUnredirected[j+1], - pSprite->spriteTraceUnredirected[j], - x, y, &x, &y); + CompositeXYParentToChild (trace[j+1], trace[j], + x, y, &x, &y); *rootX = x; *rootY = y; return; diff --git a/dix/events.c b/dix/events.c index 75bb07428..d9bf18696 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1521,6 +1521,20 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab, : mouse->spriteInfo->sprite->win; Bool isPassive = autoGrab & ~ImplicitGrabMask; +#ifdef COMPOSITE + SpritePtr pSprite; + if (IsMaster(mouse)/* && mouse->spriteInfo->spriteOwner*/) + pSprite = mouse->spriteInfo->sprite; + else + pSprite = mouse->spriteInfo->paired->spriteInfo->sprite; + + grab->spriteTrace = malloc (pSprite->spriteTraceGood * sizeof(WindowPtr)); + grab->spriteTraceGood = pSprite->spriteTraceGood; + if (grab->spriteTrace) + memcpy (grab->spriteTrace, pSprite->spriteTraceUnredirected, + pSprite->spriteTraceGood * sizeof(WindowPtr)); +#endif + /* slave devices need to float for the duration of the grab. */ if (!(autoGrab & ImplicitGrabMask) && !IsMaster(mouse)) DetachFromMaster(mouse); @@ -1580,6 +1594,12 @@ DeactivatePointerGrab(DeviceIntPtr mouse) if (grab->cursor) FreeCursor(grab->cursor, (Cursor)0); +#ifdef COMPOSITE + if (grab->spriteTrace) + xfree (grab->spriteTrace); + grab->spriteTraceGood = 0; +#endif + if (!wasImplicit) ReattachToOldMaster(mouse); diff --git a/include/inputstr.h b/include/inputstr.h index 7c4595a04..6580e1ce2 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -199,6 +199,10 @@ typedef struct _GrabRec { Mask deviceMask; /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; +#ifdef COMPOSITE + WindowPtr *spriteTrace; + int spriteTraceGood; +#endif } GrabRec; typedef struct _KeyClassRec { |