dix: switch DeliverDeviceEvents to internal events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
3aa9404fcd
commit
fb858774b8
71
dix/events.c
71
dix/events.c
|
@ -2215,8 +2215,8 @@ FixUpEventFromWindow(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deliver events caused by input devices. Called for both core input events
|
* Deliver events caused by input devices.
|
||||||
* and XI events.
|
*
|
||||||
* For events from a non-grabbed, non-focus device, DeliverDeviceEvents is
|
* For events from a non-grabbed, non-focus device, DeliverDeviceEvents is
|
||||||
* called directly from the processInputProc.
|
* called directly from the processInputProc.
|
||||||
* For grabbed devices, DeliverGrabbedEvent is called first, and _may_ call
|
* For grabbed devices, DeliverGrabbedEvent is called first, and _may_ call
|
||||||
|
@ -2225,11 +2225,10 @@ FixUpEventFromWindow(
|
||||||
* DeliverDeviceEvents.
|
* DeliverDeviceEvents.
|
||||||
*
|
*
|
||||||
* @param pWin Window to deliver event to.
|
* @param pWin Window to deliver event to.
|
||||||
* @param xE Events to deliver.
|
* @param event The events to deliver, not yet in wire format.
|
||||||
* @param grab Possible grab on a device.
|
* @param grab Possible grab on a device.
|
||||||
* @param stopAt Don't recurse up to the root window.
|
* @param stopAt Don't recurse up to the root window.
|
||||||
* @param dev The device that is responsible for the event.
|
* @param dev The device that is responsible for the event.
|
||||||
* @param count number of events in xE.
|
|
||||||
*
|
*
|
||||||
* @see DeliverGrabbedEvent
|
* @see DeliverGrabbedEvent
|
||||||
* @see DeliverFocusedEvent
|
* @see DeliverFocusedEvent
|
||||||
|
@ -2245,17 +2244,28 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
||||||
OtherInputMasks *inputMasks;
|
OtherInputMasks *inputMasks;
|
||||||
int mskidx = dev->id;
|
int mskidx = dev->id;
|
||||||
xEvent core;
|
xEvent core;
|
||||||
/* FIXME: temporary solution only. */
|
xEvent *xE = NULL;
|
||||||
static int count;
|
int rc, count = 0;
|
||||||
static xEvent xE[1000]; /* enough bytes for the events we have atm */
|
|
||||||
|
|
||||||
/* FIXME: temporary only */
|
/* XXX: In theory, we could pass the internal events through to everything
|
||||||
count = ConvertBackToXI((InternalEvent*)event, xE);
|
* and only convert just before hitting the wire. We can't do that yet, so
|
||||||
type = xE->u.u.type;
|
* DDE is the last stop for internal events. From here onwards, we deal
|
||||||
filter = filters[dev->id][type];
|
* with core/XI events.
|
||||||
|
*/
|
||||||
|
rc = EventToXI(event, &xE, &count);
|
||||||
|
if (rc != Success)
|
||||||
|
{
|
||||||
|
ErrorF("[dix] %s: XI conversion failed in DDE (%d, %d). Skipping delivery.\n",
|
||||||
|
dev->name, event->u.any.type, rc);
|
||||||
|
goto unwind;
|
||||||
|
} else if (count == 0) /* no XI/Core event for you */
|
||||||
|
goto unwind;
|
||||||
|
|
||||||
if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, xE, count))
|
if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, xE, count))
|
||||||
return 0;
|
goto unwind;
|
||||||
|
|
||||||
|
type = xE->u.u.type;
|
||||||
|
filter = filters[dev->id][type];
|
||||||
|
|
||||||
/* handle generic events */
|
/* handle generic events */
|
||||||
/* XXX: Generic events aren't quite handled correctly yet. They should
|
/* XXX: Generic events aren't quite handled correctly yet. They should
|
||||||
|
@ -2269,7 +2279,8 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
||||||
if (count > 1)
|
if (count > 1)
|
||||||
{
|
{
|
||||||
ErrorF("[dix] Do not send more than one GenericEvent at a time!\n");
|
ErrorF("[dix] Do not send more than one GenericEvent at a time!\n");
|
||||||
return 0;
|
deliveries = 0;
|
||||||
|
goto unwind;
|
||||||
}
|
}
|
||||||
filter = generic_filters[GEEXTIDX(xE)][ge->evtype];
|
filter = generic_filters[GEEXTIDX(xE)][ge->evtype];
|
||||||
|
|
||||||
|
@ -2282,7 +2293,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
||||||
deliveries = DeliverEventsToWindow(dev, win, xE, count,
|
deliveries = DeliverEventsToWindow(dev, win, xE, count,
|
||||||
filter, grab, 0);
|
filter, grab, 0);
|
||||||
if (deliveries > 0)
|
if (deliveries > 0)
|
||||||
return deliveries;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
win = win->parent;
|
win = win->parent;
|
||||||
|
@ -2302,23 +2313,30 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
||||||
deliveries = DeliverEventsToWindow(dev, pWin, xE, count,
|
deliveries = DeliverEventsToWindow(dev, pWin, xE, count,
|
||||||
filter, grab, mskidx);
|
filter, grab, mskidx);
|
||||||
if (deliveries > 0)
|
if (deliveries > 0)
|
||||||
return deliveries;
|
goto unwind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((deliveries < 0) || (pWin == stopAt) ||
|
if ((deliveries < 0) || (pWin == stopAt) ||
|
||||||
(inputMasks && (filter & inputMasks->dontPropagateMask[mskidx])))
|
(inputMasks && (filter & inputMasks->dontPropagateMask[mskidx])))
|
||||||
return 0;
|
{
|
||||||
|
deliveries = 0;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
|
|
||||||
if (dev->isMaster && dev->coreEvents)
|
if (dev->isMaster && dev->coreEvents)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* no XI event delivered. Try core event */
|
/* no XI event delivered. Try core event */
|
||||||
memset(&core, 0, sizeof(xEvent));
|
rc = EventToCore(event, &core);
|
||||||
core = *xE;
|
if (rc != Success)
|
||||||
core.u.u.type = XItoCoreType(xE->u.u.type);
|
{
|
||||||
|
if (rc != BadMatch)
|
||||||
|
ErrorF("[dix] %s: Core conversion failed in DDE (%d, %d).\n",
|
||||||
|
dev->name, event->u.any.type, rc);
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
|
|
||||||
if (core.u.u.type && filter & pWin->deliverableEvents)
|
if (filter & pWin->deliverableEvents)
|
||||||
{
|
{
|
||||||
if ((wOtherEventMasks(pWin)|pWin->eventMask) & filter)
|
if ((wOtherEventMasks(pWin)|pWin->eventMask) & filter)
|
||||||
{
|
{
|
||||||
|
@ -2326,20 +2344,25 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
||||||
deliveries = DeliverEventsToWindow(dev, pWin, &core, 1,
|
deliveries = DeliverEventsToWindow(dev, pWin, &core, 1,
|
||||||
filter, grab, 0);
|
filter, grab, 0);
|
||||||
if (deliveries > 0)
|
if (deliveries > 0)
|
||||||
return deliveries;
|
goto unwind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((deliveries < 0) || (pWin == stopAt) ||
|
if ((deliveries < 0) || (pWin == stopAt) ||
|
||||||
(filter & wDontPropagateMask(pWin)))
|
(filter & wDontPropagateMask(pWin)))
|
||||||
return 0;
|
{
|
||||||
|
deliveries = 0;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
child = pWin->drawable.id;
|
child = pWin->drawable.id;
|
||||||
pWin = pWin->parent;
|
pWin = pWin->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
unwind:
|
||||||
|
xfree(xE);
|
||||||
|
return deliveries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue