[PATCH (v5) xserver 1/8] Input: Add DeepestSpriteWin macro

Daniel Stone daniel at fooishbar.org
Wed Jan 19 15:11:43 PST 2011


Does what it says on the box: returns the deepest child window in a
given sprite's trace.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---

v5: New.

 dix/events.c       |    4 ++--
 include/inputstr.h |    3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 07f8b05..5f8ce39 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2174,7 +2174,7 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
 
 static Window FindChildForEvent(SpritePtr pSprite, WindowPtr event)
 {
-    WindowPtr w = pSprite->spriteTrace[pSprite->spriteTraceGood-1];
+    WindowPtr w = DeepestSpriteWin(pSprite);
     Window child = None;
 
     /* If the search ends up past the root should the child field be
@@ -2591,7 +2591,7 @@ XYToWindow(SpritePtr pSprite, int x, int y)
 	else
 	    pWin = pWin->nextSib;
     }
-    return pSprite->spriteTrace[pSprite->spriteTraceGood-1];
+    return DeepestSpriteWin(pSprite);
 }
 
 /**
diff --git a/include/inputstr.h b/include/inputstr.h
index b74ee04..8291577 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -244,6 +244,9 @@ typedef struct _SpriteRec {
 
 } SpriteRec;
 
+#define DeepestSpriteWin(sprite) \
+    ((sprite)->spriteTrace[(sprite)->spriteTraceGood - 1])
+
 typedef struct _KeyClassRec {
     int			sourceid;
     CARD8		down[DOWN_LENGTH];
-- 
1.7.2.3



More information about the xorg-devel mailing list