Input: Pass sprite instead of device to XYToWindow, make non-static

XYToWindow calculates the position of the cursor and updates the sprite
trace, but does nothing else with the device.  Pass a SpritePtr instead
so we can update an alternate focus instead of hardcoding the device's
sprite.  Also make this function non-static, so we can use it elsewhere.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
Daniel Stone 2010-09-20 15:03:05 +10:00
parent 07a892cd82
commit 690476250f
2 changed files with 7 additions and 13 deletions

View File

@ -332,12 +332,6 @@ IsMaster(DeviceIntPtr dev)
return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD;
}
static WindowPtr XYToWindow(
DeviceIntPtr pDev,
int x,
int y
);
/**
* Max event opcode.
*/
@ -1290,7 +1284,8 @@ ComputeFreezes(void)
syncEvents.replayDev = (DeviceIntPtr)NULL;
w = XYToWindow(replayDev, event->root_x, event->root_y);
w = XYToWindow(replayDev->spriteInfo->sprite,
event->root_x, event->root_y);
if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin))
{
if (replayDev->focus && !IsPointerEvent((InternalEvent*)event))
@ -2553,16 +2548,14 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
*
* @returns the window at the given coordinates.
*/
static WindowPtr
XYToWindow(DeviceIntPtr pDev, int x, int y)
WindowPtr
XYToWindow(SpritePtr pSprite, int x, int y)
{
WindowPtr pWin;
BoxRec box;
SpritePtr pSprite;
pSprite = pDev->spriteInfo->sprite;
pSprite->spriteTraceGood = 1; /* root window still there */
pWin = GetCurrentRootWindow(pDev)->firstChild;
pWin = RootWindow(pSprite)->firstChild;
while (pWin)
{
if ((pWin->mapped) &&
@ -2775,7 +2768,7 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
ev->root_y = pSprite->hot.y;
}
newSpriteWin = XYToWindow(pDev, pSprite->hot.x, pSprite->hot.y);
newSpriteWin = XYToWindow(pSprite, pSprite->hot.x, pSprite->hot.y);
if (newSpriteWin != prevSpriteWin)
{

View File

@ -533,6 +533,7 @@ void FixUpEventFromWindow(SpritePtr pSprite,
WindowPtr pWin,
Window child,
Bool calcChild);
extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
WindowPtr win);
/**