dix: FixUpEventForWindow needs to handle XI2 events.
This commit is contained in:
parent
95ed2ab715
commit
77d51b94bd
112
dix/events.c
112
dix/events.c
|
@ -2101,6 +2101,37 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Window FindChildForEvent(DeviceIntPtr dev, WindowPtr event)
|
||||||
|
{
|
||||||
|
SpritePtr pSprite = dev->spriteInfo->sprite;
|
||||||
|
WindowPtr w = pSprite->spriteTrace[pSprite->spriteTraceGood-1];
|
||||||
|
Window child;
|
||||||
|
|
||||||
|
/* If the search ends up past the root should the child field be
|
||||||
|
set to none or should the value in the argument be passed
|
||||||
|
through. It probably doesn't matter since everyone calls
|
||||||
|
this function with child == None anyway. */
|
||||||
|
while (w)
|
||||||
|
{
|
||||||
|
/* If the source window is same as event window, child should be
|
||||||
|
none. Don't bother going all all the way back to the root. */
|
||||||
|
|
||||||
|
if (w == event)
|
||||||
|
{
|
||||||
|
child = None;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (w->parent == event)
|
||||||
|
{
|
||||||
|
child = w->drawable.id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
w = w->parent;
|
||||||
|
}
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust event fields to comply with the window properties.
|
* Adjust event fields to comply with the window properties.
|
||||||
*
|
*
|
||||||
|
@ -2119,53 +2150,50 @@ FixUpEventFromWindow(
|
||||||
{
|
{
|
||||||
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
||||||
|
|
||||||
if (xE->u.u.type == GenericEvent) /* just a safety barrier */
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (calcChild)
|
if (calcChild)
|
||||||
{
|
child = FindChildForEvent(pDev, pWin);
|
||||||
WindowPtr w= pSprite->spriteTrace[pSprite->spriteTraceGood-1];
|
|
||||||
/* If the search ends up past the root should the child field be
|
|
||||||
set to none or should the value in the argument be passed
|
|
||||||
through. It probably doesn't matter since everyone calls
|
|
||||||
this function with child == None anyway. */
|
|
||||||
|
|
||||||
while (w)
|
if (XI2_EVENT(xE))
|
||||||
|
{
|
||||||
|
xXIDeviceEvent* event = (xXIDeviceEvent*)xE;
|
||||||
|
event->root = RootWindow(pDev)->drawable.id;
|
||||||
|
event->event = pWin->drawable.id;
|
||||||
|
if (pSprite->hot.pScreen == pWin->drawable.pScreen)
|
||||||
{
|
{
|
||||||
/* If the source window is same as event window, child should be
|
event->event_x.integral = event->root_x.integral - pWin->drawable.x;
|
||||||
none. Don't bother going all all the way back to the root. */
|
event->event_y.integral = event->root_y.integral - pWin->drawable.y;
|
||||||
|
event->child = child;
|
||||||
if (w == pWin)
|
} else
|
||||||
{
|
{
|
||||||
child = None;
|
event->event_x.integral = 0;
|
||||||
break;
|
event->event_y.integral = 0;
|
||||||
}
|
event->child = None;
|
||||||
|
|
||||||
if (w->parent == pWin)
|
|
||||||
{
|
|
||||||
child = w->drawable.id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
w = w->parent;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
XE_KBPTR.root = RootWindow(pDev)->drawable.id;
|
if (event->evtype == XI_Enter || event->evtype == XI_Leave)
|
||||||
XE_KBPTR.event = pWin->drawable.id;
|
((xXIEnterEvent*)event)->same_screen =
|
||||||
if (pSprite->hot.pScreen == pWin->drawable.pScreen)
|
(pSprite->hot.pScreen == pWin->drawable.pScreen);
|
||||||
|
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
XE_KBPTR.sameScreen = xTrue;
|
XE_KBPTR.root = RootWindow(pDev)->drawable.id;
|
||||||
XE_KBPTR.child = child;
|
XE_KBPTR.event = pWin->drawable.id;
|
||||||
XE_KBPTR.eventX =
|
if (pSprite->hot.pScreen == pWin->drawable.pScreen)
|
||||||
XE_KBPTR.rootX - pWin->drawable.x;
|
{
|
||||||
XE_KBPTR.eventY =
|
XE_KBPTR.sameScreen = xTrue;
|
||||||
XE_KBPTR.rootY - pWin->drawable.y;
|
XE_KBPTR.child = child;
|
||||||
}
|
XE_KBPTR.eventX =
|
||||||
else
|
XE_KBPTR.rootX - pWin->drawable.x;
|
||||||
{
|
XE_KBPTR.eventY =
|
||||||
XE_KBPTR.sameScreen = xFalse;
|
XE_KBPTR.rootY - pWin->drawable.y;
|
||||||
XE_KBPTR.child = None;
|
}
|
||||||
XE_KBPTR.eventX = 0;
|
else
|
||||||
XE_KBPTR.eventY = 0;
|
{
|
||||||
|
XE_KBPTR.sameScreen = xFalse;
|
||||||
|
XE_KBPTR.child = None;
|
||||||
|
XE_KBPTR.eventX = 0;
|
||||||
|
XE_KBPTR.eventY = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue