summaryrefslogtreecommitdiff
path: root/dix/events.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-03-31 23:55:25 -0700
committerKristian Høgsberg <krh@bitplanet.net>2014-04-01 10:30:42 -0700
commit73698d41e41ce76bef2d9a90b46ac0c24ae148dd (patch)
tree5b3071927bc4315321cc9872361b5763caf3806c /dix/events.c
parent9d20d18fb9dcc74bfa5392a2da40fd41b3e640d3 (diff)
Make XYToWindow a screen function
This allows DDXen to override the window picking to account for native windows not seen by the X server. The bulk of the picking logic is exposed as a new helper function, miSpriteTrace(). This function completes the sprite trace filled out by the caller, and can be set up to start the search from a given toplevel window. v2: Leave existing XYToWindow API in place for API compatibility Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Diffstat (limited to 'dix/events.c')
-rw-r--r--dix/events.c46
1 files changed, 3 insertions, 43 deletions
diff --git a/dix/events.c b/dix/events.c
index f05dada3d..125a0ee29 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2835,7 +2835,7 @@ DeliverEvents(WindowPtr pWin, xEvent *xE, int count, WindowPtr otherParent)
return deliveries;
}
-static Bool
+Bool
PointInBorderSize(WindowPtr pWin, int x, int y)
{
BoxRec box;
@@ -2876,49 +2876,9 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
WindowPtr
XYToWindow(SpritePtr pSprite, int x, int y)
{
- WindowPtr pWin;
- BoxRec box;
+ ScreenPtr pScreen = RootWindow(pSprite)->drawable.pScreen;
- pSprite->spriteTraceGood = 1; /* root window still there */
- pWin = RootWindow(pSprite)->firstChild;
- while (pWin) {
- if ((pWin->mapped) &&
- (x >= pWin->drawable.x - wBorderWidth(pWin)) &&
- (x < pWin->drawable.x + (int) pWin->drawable.width +
- wBorderWidth(pWin)) &&
- (y >= pWin->drawable.y - wBorderWidth(pWin)) &&
- (y < pWin->drawable.y + (int) pWin->drawable.height +
- wBorderWidth(pWin))
- /* When a window is shaped, a further check
- * is made to see if the point is inside
- * borderSize
- */
- && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
- && (!wInputShape(pWin) ||
- RegionContainsPoint(wInputShape(pWin),
- x - pWin->drawable.x,
- y - pWin->drawable.y, &box))
-#ifdef ROOTLESS
- /* In rootless mode windows may be offscreen, even when
- * they're in X's stack. (E.g. if the native window system
- * implements some form of virtual desktop system).
- */
- && !pWin->rootlessUnhittable
-#endif
- ) {
- if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) {
- pSprite->spriteTraceSize += 10;
- pSprite->spriteTrace = realloc(pSprite->spriteTrace,
- pSprite->spriteTraceSize *
- sizeof(WindowPtr));
- }
- pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin;
- pWin = pWin->firstChild;
- }
- else
- pWin = pWin->nextSib;
- }
- return DeepestSpriteWin(pSprite);
+ return (*pScreen->XYToWindow)(pScreen, pSprite, x, y);
}
/**