Input: Add DeepestSpriteWin function

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

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Daniel Stone 2011-01-18 20:16:36 +00:00
parent 65b54548dc
commit 7063264910
2 changed files with 12 additions and 2 deletions

View File

@ -2182,7 +2182,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
@ -2625,7 +2625,7 @@ XYToWindow(SpritePtr pSprite, int x, int y)
else
pWin = pWin->nextSib;
}
return pSprite->spriteTrace[pSprite->spriteTraceGood-1];
return DeepestSpriteWin(pSprite);
}
/**

View File

@ -591,4 +591,14 @@ typedef struct _EventSyncInfo {
extern EventSyncInfoRec syncEvents;
/**
* Given a sprite, returns the window at the bottom of the trace (i.e. the
* furthest window from the root).
*/
static inline WindowPtr DeepestSpriteWin(SpritePtr sprite)
{
assert(sprite->spriteTraceGood > 0);
return sprite->spriteTrace[sprite->spriteTraceGood - 1];
}
#endif /* INPUTSTRUCT_H */