dix: Switch DeliverGrabbedEvents to use internal events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
a371853698
commit
8c873e7f51
80
dix/events.c
80
dix/events.c
|
@ -3437,17 +3437,9 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
GrabInfoPtr grabinfo;
|
GrabInfoPtr grabinfo;
|
||||||
int deliveries = 0;
|
int deliveries = 0;
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
xEvent core;
|
|
||||||
SpritePtr pSprite = thisDev->spriteInfo->sprite;
|
SpritePtr pSprite = thisDev->spriteInfo->sprite;
|
||||||
BOOL sendCore = FALSE;
|
BOOL sendCore = FALSE;
|
||||||
|
|
||||||
/* FIXME: temporary solution only. */
|
|
||||||
static int count;
|
|
||||||
static xEvent xE[1000]; /* enough bytes for the events we have atm */
|
|
||||||
|
|
||||||
/* FIXME: temporary only */
|
|
||||||
count = ConvertBackToXI((InternalEvent*)event, xE);
|
|
||||||
|
|
||||||
grabinfo = &thisDev->deviceGrab;
|
grabinfo = &thisDev->deviceGrab;
|
||||||
grab = grabinfo->grab;
|
grab = grabinfo->grab;
|
||||||
|
|
||||||
|
@ -3482,18 +3474,25 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
}
|
}
|
||||||
if (!deliveries)
|
if (!deliveries)
|
||||||
{
|
{
|
||||||
if (xE->u.u.type == GenericEvent)
|
/* FIXME: temporary solution only. The event masks need a rework,
|
||||||
|
* especially for generic events. */
|
||||||
|
static int count;
|
||||||
|
static xEvent xi[1000]; /* enough bytes for the events we have atm */
|
||||||
|
|
||||||
|
count = ConvertBackToXI((InternalEvent*)event, xi);
|
||||||
|
|
||||||
|
if (xi->u.u.type == GenericEvent)
|
||||||
{
|
{
|
||||||
/* find evmask for event's extension */
|
/* find evmask for event's extension */
|
||||||
xGenericEvent* ge = ((xGenericEvent*)xE);
|
xGenericEvent* ge = ((xGenericEvent*)xi);
|
||||||
GenericMaskPtr gemask = grab->genericMasks;
|
GenericMaskPtr gemask = grab->genericMasks;
|
||||||
|
|
||||||
if (!gemask || !gemask->eventMask[GEEXTIDX(ge)])
|
if (!gemask || !gemask->eventMask[GEEXTIDX(ge)])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GEEventFill(xE))
|
if (GEEventFill(xi))
|
||||||
GEEventFill(xE)(ge, thisDev, grab->window, grab);
|
GEEventFill(xi)(ge, thisDev, grab->window, grab);
|
||||||
deliveries = TryClientEvents(rClient(grab), thisDev, xE,
|
deliveries = TryClientEvents(rClient(grab), thisDev, xi,
|
||||||
count, gemask->eventMask[GEEXTIDX(ge)],
|
count, gemask->eventMask[GEEXTIDX(ge)],
|
||||||
generic_filters[GEEXTIDX(ge)][ge->evtype],
|
generic_filters[GEEXTIDX(ge)][ge->evtype],
|
||||||
grab);
|
grab);
|
||||||
|
@ -3505,25 +3504,29 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
/* try core event */
|
/* try core event */
|
||||||
if (sendCore && grab->coreGrab)
|
if (sendCore && grab->coreGrab)
|
||||||
{
|
{
|
||||||
memset(&core, 0, sizeof(xEvent));
|
xEvent core;
|
||||||
core = *xE;
|
int rc;
|
||||||
core.u.u.type = XItoCoreType(xE->u.u.type);
|
|
||||||
if(core.u.u.type) {
|
rc = EventToCore(event, &core);
|
||||||
FixUpEventFromWindow(thisDev, &core, grab->window,
|
if (rc != Success && rc != BadMatch)
|
||||||
None, TRUE);
|
{
|
||||||
if (XaceHook(XACE_SEND_ACCESS, 0, thisDev,
|
ErrorF("[dix] DeliverGrabbedEvent. Core conversion failed.\n");
|
||||||
grab->window, &core, 1) ||
|
return;
|
||||||
XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
|
}
|
||||||
grab->window, &core, 1))
|
|
||||||
deliveries = 1; /* don't send, but pretend we did */
|
FixUpEventFromWindow(thisDev, &core, grab->window,
|
||||||
else if (!IsInterferingGrab(rClient(grab), thisDev,
|
None, TRUE);
|
||||||
&core))
|
if (XaceHook(XACE_SEND_ACCESS, 0, thisDev,
|
||||||
{
|
grab->window, &core, 1) ||
|
||||||
deliveries = TryClientEvents(rClient(grab), thisDev,
|
XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
|
||||||
&core, 1, mask,
|
grab->window, &core, 1))
|
||||||
filters[thisDev->id][core.u.u.type],
|
deliveries = 1; /* don't send, but pretend we did */
|
||||||
grab);
|
else if (!IsInterferingGrab(rClient(grab), thisDev, &core))
|
||||||
}
|
{
|
||||||
|
deliveries = TryClientEvents(rClient(grab), thisDev,
|
||||||
|
&core, 1, mask,
|
||||||
|
filters[thisDev->id][core.u.u.type],
|
||||||
|
grab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3531,24 +3534,23 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
{
|
{
|
||||||
/* try XI event */
|
/* try XI event */
|
||||||
if (grabinfo->fromPassiveGrab &&
|
if (grabinfo->fromPassiveGrab &&
|
||||||
grabinfo->implicitGrab &&
|
grabinfo->implicitGrab)
|
||||||
(xE->u.u.type & EXTENSION_EVENT_BASE))
|
|
||||||
mask = grab->deviceMask;
|
mask = grab->deviceMask;
|
||||||
FixUpEventFromWindow(thisDev, xE, grab->window,
|
FixUpEventFromWindow(thisDev, xi, grab->window,
|
||||||
None, TRUE);
|
None, TRUE);
|
||||||
|
|
||||||
if (XaceHook(XACE_SEND_ACCESS, 0, thisDev,
|
if (XaceHook(XACE_SEND_ACCESS, 0, thisDev,
|
||||||
grab->window, xE, count) ||
|
grab->window, xi, count) ||
|
||||||
XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
|
XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
|
||||||
grab->window, xE, count))
|
grab->window, xi, count))
|
||||||
deliveries = 1; /* don't send, but pretend we did */
|
deliveries = 1; /* don't send, but pretend we did */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
deliveries =
|
deliveries =
|
||||||
TryClientEvents(rClient(grab), thisDev,
|
TryClientEvents(rClient(grab), thisDev,
|
||||||
xE, count,
|
xi, count,
|
||||||
mask,
|
mask,
|
||||||
filters[thisDev->id][xE->u.u.type],
|
filters[thisDev->id][xi->u.u.type],
|
||||||
grab);
|
grab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user