dix: switch DeliverGrabbedEvent to internal events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
fb858774b8
commit
1c38abd4b1
29
dix/events.c
29
dix/events.c
|
@ -3475,6 +3475,8 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
SpritePtr pSprite = thisDev->spriteInfo->sprite;
|
SpritePtr pSprite = thisDev->spriteInfo->sprite;
|
||||||
BOOL sendCore = FALSE;
|
BOOL sendCore = FALSE;
|
||||||
|
int rc, count = 0;
|
||||||
|
xEvent *xi = NULL;
|
||||||
|
|
||||||
grabinfo = &thisDev->deviceGrab;
|
grabinfo = &thisDev->deviceGrab;
|
||||||
grab = grabinfo->grab;
|
grab = grabinfo->grab;
|
||||||
|
@ -3510,12 +3512,20 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
}
|
}
|
||||||
if (!deliveries)
|
if (!deliveries)
|
||||||
{
|
{
|
||||||
/* FIXME: temporary solution only. The event masks need a rework,
|
/* XXX: In theory, we could pass the internal events through to
|
||||||
* especially for generic events. */
|
* everything and only convert just before hitting the wire. We can't
|
||||||
static int count;
|
* do that yet, so DGE is the last stop for internal events. From here
|
||||||
static xEvent xi[1000]; /* enough bytes for the events we have atm */
|
* onwards, we deal with core/XI events.
|
||||||
|
*/
|
||||||
|
|
||||||
count = ConvertBackToXI((InternalEvent*)event, xi);
|
rc = EventToXI(event, &xi, &count);
|
||||||
|
if (rc != Success)
|
||||||
|
{
|
||||||
|
ErrorF("[dix] %s: XI conversion failed in DGE (%d, %d). Skipping delivery.\n",
|
||||||
|
thisDev->name, event->u.any.type, rc);
|
||||||
|
goto unwind;
|
||||||
|
} else if (count == 0) /* no XI/Core event for you */
|
||||||
|
goto unwind;
|
||||||
|
|
||||||
if (xi->u.u.type == GenericEvent)
|
if (xi->u.u.type == GenericEvent)
|
||||||
{
|
{
|
||||||
|
@ -3524,7 +3534,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
GenericMaskPtr gemask = grab->genericMasks;
|
GenericMaskPtr gemask = grab->genericMasks;
|
||||||
|
|
||||||
if (!gemask || !gemask->eventMask[GEEXTIDX(ge)])
|
if (!gemask || !gemask->eventMask[GEEXTIDX(ge)])
|
||||||
return;
|
goto unwind;
|
||||||
|
|
||||||
if (GEEventFill(xi))
|
if (GEEventFill(xi))
|
||||||
GEEventFill(xi)(ge, thisDev, grab->window, grab);
|
GEEventFill(xi)(ge, thisDev, grab->window, grab);
|
||||||
|
@ -3541,13 +3551,12 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
if (sendCore && grab->coreGrab)
|
if (sendCore && grab->coreGrab)
|
||||||
{
|
{
|
||||||
xEvent core;
|
xEvent core;
|
||||||
int rc;
|
|
||||||
|
|
||||||
rc = EventToCore(event, &core);
|
rc = EventToCore(event, &core);
|
||||||
if (rc != Success && rc != BadMatch)
|
if (rc != Success && rc != BadMatch)
|
||||||
{
|
{
|
||||||
ErrorF("[dix] DeliverGrabbedEvent. Core conversion failed.\n");
|
ErrorF("[dix] DeliverGrabbedEvent. Core conversion failed.\n");
|
||||||
return;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
FixUpEventFromWindow(thisDev, &core, grab->window,
|
FixUpEventFromWindow(thisDev, &core, grab->window,
|
||||||
|
@ -3622,6 +3631,10 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unwind:
|
||||||
|
if (xi)
|
||||||
|
xfree(xi);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is used to set the key pressed or key released state -
|
/* This function is used to set the key pressed or key released state -
|
||||||
|
|
Loading…
Reference in New Issue